diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/AzureMonitorTransmitter.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/AzureMonitorTransmitter.cs index 4cfef1a6f9d8..663a80fc728c 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/AzureMonitorTransmitter.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/AzureMonitorTransmitter.cs @@ -53,13 +53,13 @@ internal async ValueTask AddBatchActivityAsync(Batch batchActivit return 0; } - List telemetryItems = new List(); - TelemetryEnvelope telemetryItem; + List telemetryItems = new List(); + TelemetryItem telemetryItem; foreach (var activity in batchActivity) { telemetryItem = GeneratePartAEnvelope(activity); - telemetryItem.IKey = this.instrumentationKey; + telemetryItem.InstrumentationKey = this.instrumentationKey; telemetryItem.Data = GenerateTelemetryData(activity); telemetryItems.Add(telemetryItem); } @@ -79,24 +79,23 @@ internal async ValueTask AddBatchActivityAsync(Batch batchActivit return response.Value.ItemsAccepted.GetValueOrDefault(); } - private static TelemetryEnvelope GeneratePartAEnvelope(Activity activity) + private static TelemetryItem GeneratePartAEnvelope(Activity activity) { - // TODO: Get TelemetryEnvelope name changed in swagger - TelemetryEnvelope envelope = new TelemetryEnvelope(PartA_Name_Mapping[activity.GetTelemetryType()], activity.StartTimeUtc); + TelemetryItem telemetryItem = new TelemetryItem(PartA_Name_Mapping[activity.GetTelemetryType()], activity.StartTimeUtc); // TODO: Validate if Azure SDK has common function to generate role instance - envelope.Tags[ContextTagKeys.AiCloudRoleInstance.ToString()] = "testRoleInstance"; + telemetryItem.Tags[ContextTagKeys.AiCloudRoleInstance.ToString()] = "testRoleInstance"; - envelope.Tags[ContextTagKeys.AiOperationId.ToString()] = activity.TraceId.ToHexString(); + telemetryItem.Tags[ContextTagKeys.AiOperationId.ToString()] = activity.TraceId.ToHexString(); if (activity.Parent != null) { - envelope.Tags[ContextTagKeys.AiOperationParentId.ToString()] = activity.Parent.SpanId.ToHexString(); + telemetryItem.Tags[ContextTagKeys.AiOperationParentId.ToString()] = activity.Parent.SpanId.ToHexString(); } // TODO: "ai.location.ip" // TODO: Handle exception - envelope.Tags[ContextTagKeys.AiInternalSdkVersion.ToString()] = SdkVersionUtils.SdkVersion; + telemetryItem.Tags[ContextTagKeys.AiInternalSdkVersion.ToString()] = SdkVersionUtils.SdkVersion; - return envelope; + return telemetryItem; } private MonitorBase GenerateTelemetryData(Activity activity) @@ -123,7 +122,7 @@ private MonitorBase GenerateTelemetryData(Activity activity) } else if (telemetryType == TelemetryType.Dependency) { - var dependency = new RemoteDependencyData(2, activity.DisplayName, activity.Duration) + var dependency = new RemoteDependencyData(2, activity.DisplayName, activity.Duration.ToString("c", CultureInfo.InvariantCulture)) { Id = activity.Context.SpanId.ToHexString(), Success = activity.GetStatus().IsOk diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Base.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Base.cs deleted file mode 100644 index 3ae4f83959db..000000000000 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Base.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -using Azure.Core; - -#nullable disable - -namespace OpenTelemetry.Exporter.AzureMonitor.Models -{ - [CodeGenModel("Base")] - public partial class MonitorBase - { - } -} diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Domain.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Domain.cs deleted file mode 100644 index c8f10de7434b..000000000000 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Domain.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -using Azure.Core; - -#nullable disable - -namespace OpenTelemetry.Exporter.AzureMonitor.Models -{ - [CodeGenModel("Domain")] - public partial class MonitorDomain - { - } -} diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/AvailabilityData.Serialization.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/AvailabilityData.Serialization.cs index f12896af88e8..598d73072426 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/AvailabilityData.Serialization.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/AvailabilityData.Serialization.cs @@ -5,8 +5,6 @@ #nullable disable -using System; -using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -18,13 +16,13 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("ver"); - writer.WriteNumberValue(Ver); + writer.WriteNumberValue(Version); writer.WritePropertyName("id"); writer.WriteStringValue(Id); writer.WritePropertyName("name"); writer.WriteStringValue(Name); writer.WritePropertyName("duration"); - writer.WriteStringValue(Duration, "P"); + writer.WriteStringValue(Duration); writer.WritePropertyName("success"); writer.WriteBooleanValue(Success); if (Optional.IsDefined(RunLocation)) @@ -66,83 +64,5 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - - internal static AvailabilityData DeserializeAvailabilityData(JsonElement element) - { - int ver = default; - string id = default; - string name = default; - TimeSpan duration = default; - bool success = default; - Optional runLocation = default; - Optional message = default; - Optional> properties = default; - Optional> measurements = default; - Optional test = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("ver")) - { - ver = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("duration")) - { - duration = property.Value.GetTimeSpan("P"); - continue; - } - if (property.NameEquals("success")) - { - success = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("runLocation")) - { - runLocation = property.Value.GetString(); - continue; - } - if (property.NameEquals("message")) - { - message = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - properties = dictionary; - continue; - } - if (property.NameEquals("measurements")) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetDouble()); - } - measurements = dictionary; - continue; - } - if (property.NameEquals("test")) - { - test = property.Value.GetString(); - continue; - } - } - return new AvailabilityData(test.Value, ver, id, name, duration, success, runLocation.Value, message.Value, Optional.ToDictionary(properties), Optional.ToDictionary(measurements)); - } } } diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/AvailabilityData.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/AvailabilityData.cs index 051656de8734..1d3976a42ae2 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/AvailabilityData.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/AvailabilityData.cs @@ -15,13 +15,13 @@ namespace OpenTelemetry.Exporter.AzureMonitor.Models public partial class AvailabilityData : MonitorDomain { /// Initializes a new instance of AvailabilityData. - /// Schema version. + /// Schema version. /// Identifier of a test run. Use it to correlate steps of test run and telemetry generated by the service. /// Name of the test that these availability results represent. /// Duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days. /// Success flag. - /// or is null. - public AvailabilityData(int ver, string id, string name, TimeSpan duration, bool success) + /// , , or is null. + public AvailabilityData(int version, string id, string name, string duration, bool success) { if (id == null) { @@ -31,8 +31,12 @@ public AvailabilityData(int ver, string id, string name, TimeSpan duration, bool { throw new ArgumentNullException(nameof(name)); } + if (duration == null) + { + throw new ArgumentNullException(nameof(duration)); + } - Ver = ver; + Version = version; Id = id; Name = name; Duration = duration; @@ -41,47 +45,23 @@ public AvailabilityData(int ver, string id, string name, TimeSpan duration, bool Measurements = new ChangeTrackingDictionary(); } - /// Initializes a new instance of AvailabilityData. - /// Ignored value. - /// Schema version. - /// Identifier of a test run. Use it to correlate steps of test run and telemetry generated by the service. - /// Name of the test that these availability results represent. - /// Duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days. - /// Success flag. - /// Name of the location where the test was run from. - /// Diagnostic message for the result. - /// Collection of custom properties. TODO: max key length validate. - /// Collection of custom measurements. TODO: max key length validate. - internal AvailabilityData(string test, int ver, string id, string name, TimeSpan duration, bool success, string runLocation, string message, IDictionary properties, IDictionary measurements) : base(test) - { - Ver = ver; - Id = id; - Name = name; - Duration = duration; - Success = success; - RunLocation = runLocation; - Message = message; - Properties = properties; - Measurements = measurements; - } - /// Schema version. - public int Ver { get; set; } + public int Version { get; } /// Identifier of a test run. Use it to correlate steps of test run and telemetry generated by the service. - public string Id { get; set; } + public string Id { get; } /// Name of the test that these availability results represent. - public string Name { get; set; } + public string Name { get; } /// Duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days. - public TimeSpan Duration { get; set; } + public string Duration { get; } /// Success flag. - public bool Success { get; set; } + public bool Success { get; } /// Name of the location where the test was run from. public string RunLocation { get; set; } /// Diagnostic message for the result. public string Message { get; set; } - /// Collection of custom properties. TODO: max key length validate. + /// Collection of custom properties. public IDictionary Properties { get; } - /// Collection of custom measurements. TODO: max key length validate. + /// Collection of custom measurements. public IDictionary Measurements { get; } } } diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/DataPoint.Serialization.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/DataPoint.Serialization.cs deleted file mode 100644 index 3339db002f03..000000000000 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/DataPoint.Serialization.cs +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace OpenTelemetry.Exporter.AzureMonitor.Models -{ - public partial class DataPoint : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Ns)) - { - writer.WritePropertyName("ns"); - writer.WriteStringValue(Ns); - } - writer.WritePropertyName("name"); - writer.WriteStringValue(Name); - if (Optional.IsDefined(Kind)) - { - writer.WritePropertyName("kind"); - writer.WriteStringValue(Kind.Value.ToString()); - } - writer.WritePropertyName("value"); - writer.WriteNumberValue(Value); - if (Optional.IsDefined(Count)) - { - if (Count != null) - { - writer.WritePropertyName("count"); - writer.WriteNumberValue(Count.Value); - } - else - { - writer.WriteNull("count"); - } - } - if (Optional.IsDefined(Min)) - { - if (Min != null) - { - writer.WritePropertyName("min"); - writer.WriteNumberValue(Min.Value); - } - else - { - writer.WriteNull("min"); - } - } - if (Optional.IsDefined(Max)) - { - if (Max != null) - { - writer.WritePropertyName("max"); - writer.WriteNumberValue(Max.Value); - } - else - { - writer.WriteNull("max"); - } - } - if (Optional.IsDefined(StdDev)) - { - if (StdDev != null) - { - writer.WritePropertyName("stdDev"); - writer.WriteNumberValue(StdDev.Value); - } - else - { - writer.WriteNull("stdDev"); - } - } - writer.WriteEndObject(); - } - - internal static DataPoint DeserializeDataPoint(JsonElement element) - { - Optional ns = default; - string name = default; - Optional kind = default; - double value = default; - Optional count = default; - Optional min = default; - Optional max = default; - Optional stdDev = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("ns")) - { - ns = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("kind")) - { - kind = new DataPointType(property.Value.GetString()); - continue; - } - if (property.NameEquals("value")) - { - value = property.Value.GetDouble(); - continue; - } - if (property.NameEquals("count")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - count = null; - continue; - } - count = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("min")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - min = null; - continue; - } - min = property.Value.GetDouble(); - continue; - } - if (property.NameEquals("max")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - max = null; - continue; - } - max = property.Value.GetDouble(); - continue; - } - if (property.NameEquals("stdDev")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - stdDev = null; - continue; - } - stdDev = property.Value.GetDouble(); - continue; - } - } - return new DataPoint(ns.Value, name, Optional.ToNullable(kind), value, Optional.ToNullable(count), Optional.ToNullable(min), Optional.ToNullable(max), Optional.ToNullable(stdDev)); - } - } -} diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/EventData.Serialization.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/EventData.Serialization.cs deleted file mode 100644 index 0d49a2f95bfb..000000000000 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/EventData.Serialization.cs +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace OpenTelemetry.Exporter.AzureMonitor.Models -{ - public partial class EventData : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("ver"); - writer.WriteNumberValue(Ver); - writer.WritePropertyName("name"); - writer.WriteStringValue(Name); - if (Optional.IsCollectionDefined(Properties)) - { - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - foreach (var item in Properties) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsCollectionDefined(Measurements)) - { - writer.WritePropertyName("measurements"); - writer.WriteStartObject(); - foreach (var item in Measurements) - { - writer.WritePropertyName(item.Key); - writer.WriteNumberValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsDefined(Test)) - { - writer.WritePropertyName("test"); - writer.WriteStringValue(Test); - } - writer.WriteEndObject(); - } - - internal static EventData DeserializeEventData(JsonElement element) - { - int ver = default; - string name = default; - Optional> properties = default; - Optional> measurements = default; - Optional test = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("ver")) - { - ver = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - properties = dictionary; - continue; - } - if (property.NameEquals("measurements")) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetDouble()); - } - measurements = dictionary; - continue; - } - if (property.NameEquals("test")) - { - test = property.Value.GetString(); - continue; - } - } - return new EventData(test.Value, ver, name, Optional.ToDictionary(properties), Optional.ToDictionary(measurements)); - } - } -} diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/EventData.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/EventData.cs deleted file mode 100644 index 21c91a7cb0ab..000000000000 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/EventData.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace OpenTelemetry.Exporter.AzureMonitor.Models -{ - /// Instances of Event represent structured event records that can be grouped and searched by their properties. Event data item also creates a metric of event count by name. - public partial class EventData : MonitorDomain - { - /// Initializes a new instance of EventData. - /// Schema version. - /// Event name. Keep it low cardinality to allow proper grouping and useful metrics. - /// is null. - public EventData(int ver, string name) - { - if (name == null) - { - throw new ArgumentNullException(nameof(name)); - } - - Ver = ver; - Name = name; - Properties = new ChangeTrackingDictionary(); - Measurements = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of EventData. - /// Ignored value. - /// Schema version. - /// Event name. Keep it low cardinality to allow proper grouping and useful metrics. - /// Collection of custom properties. TODO: max key length validate. - /// Collection of custom measurements. TODO: max key length validate. - internal EventData(string test, int ver, string name, IDictionary properties, IDictionary measurements) : base(test) - { - Ver = ver; - Name = name; - Properties = properties; - Measurements = measurements; - } - - /// Schema version. - public int Ver { get; set; } - /// Event name. Keep it low cardinality to allow proper grouping and useful metrics. - public string Name { get; set; } - /// Collection of custom properties. TODO: max key length validate. - public IDictionary Properties { get; } - /// Collection of custom measurements. TODO: max key length validate. - public IDictionary Measurements { get; } - } -} diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/ExceptionData.Serialization.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/ExceptionData.Serialization.cs deleted file mode 100644 index 6eeb8caa6e74..000000000000 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/ExceptionData.Serialization.cs +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace OpenTelemetry.Exporter.AzureMonitor.Models -{ - public partial class ExceptionData : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("ver"); - writer.WriteNumberValue(Ver); - if (Optional.IsCollectionDefined(Exceptions)) - { - writer.WritePropertyName("exceptions"); - writer.WriteStartArray(); - foreach (var item in Exceptions) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(SeverityLevel)) - { - if (SeverityLevel != null) - { - writer.WritePropertyName("severityLevel"); - writer.WriteStringValue(SeverityLevel.Value.ToString()); - } - else - { - writer.WriteNull("severityLevel"); - } - } - if (Optional.IsDefined(ProblemId)) - { - writer.WritePropertyName("problemId"); - writer.WriteStringValue(ProblemId); - } - if (Optional.IsCollectionDefined(Properties)) - { - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - foreach (var item in Properties) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsCollectionDefined(Measurements)) - { - writer.WritePropertyName("measurements"); - writer.WriteStartObject(); - foreach (var item in Measurements) - { - writer.WritePropertyName(item.Key); - writer.WriteNumberValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsDefined(Test)) - { - writer.WritePropertyName("test"); - writer.WriteStringValue(Test); - } - writer.WriteEndObject(); - } - - internal static ExceptionData DeserializeExceptionData(JsonElement element) - { - int ver = default; - Optional> exceptions = default; - Optional severityLevel = default; - Optional problemId = default; - Optional> properties = default; - Optional> measurements = default; - Optional test = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("ver")) - { - ver = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("exceptions")) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ExceptionDetails.DeserializeExceptionDetails(item)); - } - exceptions = array; - continue; - } - if (property.NameEquals("severityLevel")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - severityLevel = null; - continue; - } - severityLevel = new SeverityLevel(property.Value.GetString()); - continue; - } - if (property.NameEquals("problemId")) - { - problemId = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - properties = dictionary; - continue; - } - if (property.NameEquals("measurements")) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetDouble()); - } - measurements = dictionary; - continue; - } - if (property.NameEquals("test")) - { - test = property.Value.GetString(); - continue; - } - } - return new ExceptionData(test.Value, ver, Optional.ToList(exceptions), Optional.ToNullable(severityLevel), problemId.Value, Optional.ToDictionary(properties), Optional.ToDictionary(measurements)); - } - } -} diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/ExceptionData.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/ExceptionData.cs deleted file mode 100644 index 55b93e98d2a4..000000000000 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/ExceptionData.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace OpenTelemetry.Exporter.AzureMonitor.Models -{ - /// An instance of Exception represents a handled or unhandled exception that occurred during execution of the monitored application. - public partial class ExceptionData : MonitorDomain - { - /// Initializes a new instance of ExceptionData. - /// Schema version. - public ExceptionData(int ver) - { - Ver = ver; - Exceptions = new ChangeTrackingList(); - Properties = new ChangeTrackingDictionary(); - Measurements = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of ExceptionData. - /// Ignored value. - /// Schema version. - /// Exception chain - list of inner exceptions. - /// Severity level. Mostly used to indicate exception severity level when it is reported by logging library. - /// Identifier of where the exception was thrown in code. Used for exceptions grouping. Typically a combination of exception type and a function from the call stack. - /// Collection of custom properties. TODO: max key length validate. - /// Collection of custom measurements. TODO: max key length validate. - internal ExceptionData(string test, int ver, IList exceptions, SeverityLevel? severityLevel, string problemId, IDictionary properties, IDictionary measurements) : base(test) - { - Ver = ver; - Exceptions = exceptions; - SeverityLevel = severityLevel; - ProblemId = problemId; - Properties = properties; - Measurements = measurements; - } - - /// Schema version. - public int Ver { get; set; } - /// Exception chain - list of inner exceptions. - public IList Exceptions { get; } - /// Severity level. Mostly used to indicate exception severity level when it is reported by logging library. - public SeverityLevel? SeverityLevel { get; set; } - /// Identifier of where the exception was thrown in code. Used for exceptions grouping. Typically a combination of exception type and a function from the call stack. - public string ProblemId { get; set; } - /// Collection of custom properties. TODO: max key length validate. - public IDictionary Properties { get; } - /// Collection of custom measurements. TODO: max key length validate. - public IDictionary Measurements { get; } - } -} diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/ExceptionDetails.Serialization.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/ExceptionDetails.Serialization.cs deleted file mode 100644 index daf83c083cef..000000000000 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/ExceptionDetails.Serialization.cs +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace OpenTelemetry.Exporter.AzureMonitor.Models -{ - public partial class ExceptionDetails : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Id)) - { - writer.WritePropertyName("id"); - writer.WriteNumberValue(Id.Value); - } - if (Optional.IsDefined(OuterId)) - { - writer.WritePropertyName("outerId"); - writer.WriteNumberValue(OuterId.Value); - } - if (Optional.IsDefined(TypeName)) - { - writer.WritePropertyName("typeName"); - writer.WriteStringValue(TypeName); - } - writer.WritePropertyName("message"); - writer.WriteStringValue(Message); - if (Optional.IsDefined(HasFullStack)) - { - writer.WritePropertyName("hasFullStack"); - writer.WriteBooleanValue(HasFullStack.Value); - } - if (Optional.IsDefined(Stack)) - { - writer.WritePropertyName("stack"); - writer.WriteStringValue(Stack); - } - if (Optional.IsCollectionDefined(ParsedStack)) - { - writer.WritePropertyName("parsedStack"); - writer.WriteStartArray(); - foreach (var item in ParsedStack) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); - } - - internal static ExceptionDetails DeserializeExceptionDetails(JsonElement element) - { - Optional id = default; - Optional outerId = default; - Optional typeName = default; - string message = default; - Optional hasFullStack = default; - Optional stack = default; - Optional> parsedStack = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("outerId")) - { - outerId = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("typeName")) - { - typeName = property.Value.GetString(); - continue; - } - if (property.NameEquals("message")) - { - message = property.Value.GetString(); - continue; - } - if (property.NameEquals("hasFullStack")) - { - hasFullStack = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("stack")) - { - stack = property.Value.GetString(); - continue; - } - if (property.NameEquals("parsedStack")) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(StackFrame.DeserializeStackFrame(item)); - } - parsedStack = array; - continue; - } - } - return new ExceptionDetails(Optional.ToNullable(id), Optional.ToNullable(outerId), typeName.Value, message, Optional.ToNullable(hasFullStack), stack.Value, Optional.ToList(parsedStack)); - } - } -} diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MessageData.Serialization.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MessageData.Serialization.cs index 5b6da1fb0f62..c943fbebab92 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MessageData.Serialization.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MessageData.Serialization.cs @@ -5,7 +5,6 @@ #nullable disable -using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -17,7 +16,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("ver"); - writer.WriteNumberValue(Ver); + writer.WriteNumberValue(Version); writer.WritePropertyName("message"); writer.WriteStringValue(Message); if (Optional.IsDefined(SeverityLevel)) @@ -54,59 +53,5 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - - internal static MessageData DeserializeMessageData(JsonElement element) - { - int ver = default; - string message = default; - Optional severityLevel = default; - Optional> properties = default; - Optional> measurements = default; - Optional test = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("ver")) - { - ver = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("message")) - { - message = property.Value.GetString(); - continue; - } - if (property.NameEquals("severityLevel")) - { - severityLevel = new SeverityLevel(property.Value.GetString()); - continue; - } - if (property.NameEquals("properties")) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - properties = dictionary; - continue; - } - if (property.NameEquals("measurements")) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetDouble()); - } - measurements = dictionary; - continue; - } - if (property.NameEquals("test")) - { - test = property.Value.GetString(); - continue; - } - } - return new MessageData(test.Value, ver, message, Optional.ToNullable(severityLevel), Optional.ToDictionary(properties), Optional.ToDictionary(measurements)); - } } } diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MessageData.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MessageData.cs index 5db0cc6d97a5..072ba336b98d 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MessageData.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MessageData.cs @@ -15,47 +15,31 @@ namespace OpenTelemetry.Exporter.AzureMonitor.Models public partial class MessageData : MonitorDomain { /// Initializes a new instance of MessageData. - /// Schema version. + /// Schema version. /// Trace message. /// is null. - public MessageData(int ver, string message) + public MessageData(int version, string message) { if (message == null) { throw new ArgumentNullException(nameof(message)); } - Ver = ver; + Version = version; Message = message; Properties = new ChangeTrackingDictionary(); Measurements = new ChangeTrackingDictionary(); } - /// Initializes a new instance of MessageData. - /// Ignored value. - /// Schema version. - /// Trace message. - /// Trace severity level. - /// Collection of custom properties. TODO: max key length validate. - /// Collection of custom measurements. TODO: max key length validate. - internal MessageData(string test, int ver, string message, SeverityLevel? severityLevel, IDictionary properties, IDictionary measurements) : base(test) - { - Ver = ver; - Message = message; - SeverityLevel = severityLevel; - Properties = properties; - Measurements = measurements; - } - /// Schema version. - public int Ver { get; set; } + public int Version { get; } /// Trace message. - public string Message { get; set; } + public string Message { get; } /// Trace severity level. public SeverityLevel? SeverityLevel { get; set; } - /// Collection of custom properties. TODO: max key length validate. + /// Collection of custom properties. public IDictionary Properties { get; } - /// Collection of custom measurements. TODO: max key length validate. + /// Collection of custom measurements. public IDictionary Measurements { get; } } } diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MetricDataPoint.Serialization.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MetricDataPoint.Serialization.cs new file mode 100644 index 000000000000..25c708b74124 --- /dev/null +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MetricDataPoint.Serialization.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace OpenTelemetry.Exporter.AzureMonitor.Models +{ + public partial class MetricDataPoint : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Namespace)) + { + writer.WritePropertyName("ns"); + writer.WriteStringValue(Namespace); + } + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + if (Optional.IsDefined(DataPointType)) + { + writer.WritePropertyName("kind"); + writer.WriteStringValue(DataPointType.Value.ToString()); + } + writer.WritePropertyName("value"); + writer.WriteNumberValue(Value); + if (Optional.IsDefined(Count)) + { + if (Count != null) + { + writer.WritePropertyName("count"); + writer.WriteNumberValue(Count.Value); + } + else + { + writer.WriteNull("count"); + } + } + if (Optional.IsDefined(Min)) + { + if (Min != null) + { + writer.WritePropertyName("min"); + writer.WriteNumberValue(Min.Value); + } + else + { + writer.WriteNull("min"); + } + } + if (Optional.IsDefined(Max)) + { + if (Max != null) + { + writer.WritePropertyName("max"); + writer.WriteNumberValue(Max.Value); + } + else + { + writer.WriteNull("max"); + } + } + if (Optional.IsDefined(StdDev)) + { + if (StdDev != null) + { + writer.WritePropertyName("stdDev"); + writer.WriteNumberValue(StdDev.Value); + } + else + { + writer.WriteNull("stdDev"); + } + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/DataPoint.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MetricDataPoint.cs similarity index 50% rename from sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/DataPoint.cs rename to sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MetricDataPoint.cs index 3040fbb4d632..c7632d1da6d6 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/DataPoint.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MetricDataPoint.cs @@ -10,13 +10,13 @@ namespace OpenTelemetry.Exporter.AzureMonitor.Models { /// Metric data single measurement. - public partial class DataPoint + public partial class MetricDataPoint { - /// Initializes a new instance of DataPoint. + /// Initializes a new instance of MetricDataPoint. /// Name of the metric. /// Single value for measurement. Sum of individual measurements for the aggregation. /// is null. - public DataPoint(string name, double value) + public MetricDataPoint(string name, double value) { if (name == null) { @@ -27,35 +27,14 @@ public DataPoint(string name, double value) Value = value; } - /// Initializes a new instance of DataPoint. - /// Namespace of the metric. - /// Name of the metric. - /// Metric type. Single measurement or the aggregated value. TODO: add default. - /// Single value for measurement. Sum of individual measurements for the aggregation. - /// Metric weight of the aggregated metric. Should not be set for a measurement. - /// Minimum value of the aggregated metric. Should not be set for a measurement. - /// Maximum value of the aggregated metric. Should not be set for a measurement. - /// Standard deviation of the aggregated metric. Should not be set for a measurement. - internal DataPoint(string ns, string name, DataPointType? kind, double value, int? count, double? min, double? max, double? stdDev) - { - Ns = ns; - Name = name; - Kind = kind; - Value = value; - Count = count; - Min = min; - Max = max; - StdDev = stdDev; - } - /// Namespace of the metric. - public string Ns { get; set; } + public string Namespace { get; set; } /// Name of the metric. - public string Name { get; set; } - /// Metric type. Single measurement or the aggregated value. TODO: add default. - public DataPointType? Kind { get; set; } + public string Name { get; } + /// Metric type. Single measurement or the aggregated value. + public DataPointType? DataPointType { get; set; } /// Single value for measurement. Sum of individual measurements for the aggregation. - public double Value { get; set; } + public double Value { get; } /// Metric weight of the aggregated metric. Should not be set for a measurement. public int? Count { get; set; } /// Minimum value of the aggregated metric. Should not be set for a measurement. diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MetricsData.Serialization.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MetricsData.Serialization.cs index e798a18bf511..4a157c925fa5 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MetricsData.Serialization.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MetricsData.Serialization.cs @@ -5,7 +5,6 @@ #nullable disable -using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -17,7 +16,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("ver"); - writer.WriteNumberValue(Ver); + writer.WriteNumberValue(Version); writer.WritePropertyName("metrics"); writer.WriteStartArray(); foreach (var item in Metrics) @@ -43,47 +42,5 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - - internal static MetricsData DeserializeMetricsData(JsonElement element) - { - int ver = default; - IList metrics = default; - Optional> properties = default; - Optional test = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("ver")) - { - ver = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("metrics")) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(DataPoint.DeserializeDataPoint(item)); - } - metrics = array; - continue; - } - if (property.NameEquals("properties")) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - properties = dictionary; - continue; - } - if (property.NameEquals("test")) - { - test = property.Value.GetString(); - continue; - } - } - return new MetricsData(test.Value, ver, metrics, Optional.ToDictionary(properties)); - } } } diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MetricsData.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MetricsData.cs index 9e8de5c6c7bf..d68a038d0bbd 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MetricsData.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MetricsData.cs @@ -16,38 +16,26 @@ namespace OpenTelemetry.Exporter.AzureMonitor.Models public partial class MetricsData : MonitorDomain { /// Initializes a new instance of MetricsData. - /// Schema version. + /// Schema version. /// List of metrics. Only one metric in the list is currently supported by Application Insights storage. If multiple data points were sent only the first one will be used. /// is null. - public MetricsData(int ver, IEnumerable metrics) + public MetricsData(int version, IEnumerable metrics) { if (metrics == null) { throw new ArgumentNullException(nameof(metrics)); } - Ver = ver; + Version = version; Metrics = metrics.ToList(); Properties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of MetricsData. - /// Ignored value. - /// Schema version. - /// List of metrics. Only one metric in the list is currently supported by Application Insights storage. If multiple data points were sent only the first one will be used. - /// Collection of custom properties. TODO: max key length validate. - internal MetricsData(string test, int ver, IList metrics, IDictionary properties) : base(test) - { - Ver = ver; - Metrics = metrics; - Properties = properties; - } - /// Schema version. - public int Ver { get; set; } + public int Version { get; } /// List of metrics. Only one metric in the list is currently supported by Application Insights storage. If multiple data points were sent only the first one will be used. - public IList Metrics { get; } - /// Collection of custom properties. TODO: max key length validate. + public IList Metrics { get; } + /// Collection of custom properties. public IDictionary Properties { get; } } } diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MonitorDomain.Serialization.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MonitorDomain.Serialization.cs index 1aa35825b1e7..db373a5019d8 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MonitorDomain.Serialization.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MonitorDomain.Serialization.cs @@ -22,19 +22,5 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - - internal static MonitorDomain DeserializeMonitorDomain(JsonElement element) - { - Optional test = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("test")) - { - test = property.Value.GetString(); - continue; - } - } - return new MonitorDomain(test.Value); - } } } diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MonitorDomain.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MonitorDomain.cs index 66ccdf1a7a63..09bc74cd8f4f 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MonitorDomain.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/MonitorDomain.cs @@ -15,13 +15,6 @@ public MonitorDomain() { } - /// Initializes a new instance of MonitorDomain. - /// Ignored value. - internal MonitorDomain(string test) - { - Test = test; - } - /// Ignored value. public string Test { get; set; } } diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/PageViewData.Serialization.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/PageViewData.Serialization.cs index ccc5ec804f71..93eee571f7d9 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/PageViewData.Serialization.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/PageViewData.Serialization.cs @@ -5,8 +5,6 @@ #nullable disable -using System; -using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -18,7 +16,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("ver"); - writer.WriteNumberValue(Ver); + writer.WriteNumberValue(Version); writer.WritePropertyName("id"); writer.WriteStringValue(Id); writer.WritePropertyName("name"); @@ -31,7 +29,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Duration)) { writer.WritePropertyName("duration"); - writer.WriteStringValue(Duration.Value, "P"); + writer.WriteStringValue(Duration); } if (Optional.IsDefined(ReferredUri)) { @@ -67,77 +65,5 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - - internal static PageViewData DeserializePageViewData(JsonElement element) - { - int ver = default; - string id = default; - string name = default; - Optional url = default; - Optional duration = default; - Optional referredUri = default; - Optional> properties = default; - Optional> measurements = default; - Optional test = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("ver")) - { - ver = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("url")) - { - url = property.Value.GetString(); - continue; - } - if (property.NameEquals("duration")) - { - duration = property.Value.GetTimeSpan("P"); - continue; - } - if (property.NameEquals("referredUri")) - { - referredUri = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - properties = dictionary; - continue; - } - if (property.NameEquals("measurements")) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetDouble()); - } - measurements = dictionary; - continue; - } - if (property.NameEquals("test")) - { - test = property.Value.GetString(); - continue; - } - } - return new PageViewData(test.Value, ver, id, name, url.Value, Optional.ToNullable(duration), referredUri.Value, Optional.ToDictionary(properties), Optional.ToDictionary(measurements)); - } } } diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/PageViewData.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/PageViewData.cs index dd6d653716d5..8a36fbeb52b0 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/PageViewData.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/PageViewData.cs @@ -15,11 +15,11 @@ namespace OpenTelemetry.Exporter.AzureMonitor.Models public partial class PageViewData : MonitorDomain { /// Initializes a new instance of PageViewData. - /// Schema version. + /// Schema version. /// Identifier of a page view instance. Used for correlation between page view and other telemetry items. /// Event name. Keep it low cardinality to allow proper grouping and useful metrics. /// or is null. - public PageViewData(int ver, string id, string name) + public PageViewData(int version, string id, string name) { if (id == null) { @@ -30,50 +30,28 @@ public PageViewData(int ver, string id, string name) throw new ArgumentNullException(nameof(name)); } - Ver = ver; + Version = version; Id = id; Name = name; Properties = new ChangeTrackingDictionary(); Measurements = new ChangeTrackingDictionary(); } - /// Initializes a new instance of PageViewData. - /// Ignored value. - /// Schema version. - /// Identifier of a page view instance. Used for correlation between page view and other telemetry items. - /// Event name. Keep it low cardinality to allow proper grouping and useful metrics. - /// Request URL with all query string parameters. - /// Request duration in format: DD.HH:MM:SS.MMMMMM. For a page view (PageViewData), this is the duration. For a page view with performance information (PageViewPerfData), this is the page load time. Must be less than 1000 days. - /// Fully qualified page URI or URL of the referring page; if unknown, leave blank. - /// Collection of custom properties. TODO: max key length validate. - /// Collection of custom measurements. TODO: max key length validate. - internal PageViewData(string test, int ver, string id, string name, string url, TimeSpan? duration, string referredUri, IDictionary properties, IDictionary measurements) : base(test) - { - Ver = ver; - Id = id; - Name = name; - Url = url; - Duration = duration; - ReferredUri = referredUri; - Properties = properties; - Measurements = measurements; - } - /// Schema version. - public int Ver { get; set; } + public int Version { get; } /// Identifier of a page view instance. Used for correlation between page view and other telemetry items. - public string Id { get; set; } + public string Id { get; } /// Event name. Keep it low cardinality to allow proper grouping and useful metrics. - public string Name { get; set; } + public string Name { get; } /// Request URL with all query string parameters. public string Url { get; set; } /// Request duration in format: DD.HH:MM:SS.MMMMMM. For a page view (PageViewData), this is the duration. For a page view with performance information (PageViewPerfData), this is the page load time. Must be less than 1000 days. - public TimeSpan? Duration { get; set; } + public string Duration { get; set; } /// Fully qualified page URI or URL of the referring page; if unknown, leave blank. public string ReferredUri { get; set; } - /// Collection of custom properties. TODO: max key length validate. + /// Collection of custom properties. public IDictionary Properties { get; } - /// Collection of custom measurements. TODO: max key length validate. + /// Collection of custom measurements. public IDictionary Measurements { get; } } } diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/PageViewPerfData.Serialization.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/PageViewPerfData.Serialization.cs index 8cd75ae7b466..176c9b2c98e3 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/PageViewPerfData.Serialization.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/PageViewPerfData.Serialization.cs @@ -5,8 +5,6 @@ #nullable disable -using System; -using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -18,7 +16,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("ver"); - writer.WriteNumberValue(Ver); + writer.WriteNumberValue(Version); writer.WritePropertyName("id"); writer.WriteStringValue(Id); writer.WritePropertyName("name"); @@ -31,32 +29,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Duration)) { writer.WritePropertyName("duration"); - writer.WriteStringValue(Duration.Value, "P"); + writer.WriteStringValue(Duration); } if (Optional.IsDefined(PerfTotal)) { writer.WritePropertyName("perfTotal"); - writer.WriteStringValue(PerfTotal.Value, "P"); + writer.WriteStringValue(PerfTotal); } if (Optional.IsDefined(NetworkConnect)) { writer.WritePropertyName("networkConnect"); - writer.WriteStringValue(NetworkConnect.Value, "P"); + writer.WriteStringValue(NetworkConnect); } if (Optional.IsDefined(SentRequest)) { writer.WritePropertyName("sentRequest"); - writer.WriteStringValue(SentRequest.Value, "P"); + writer.WriteStringValue(SentRequest); } if (Optional.IsDefined(ReceivedResponse)) { writer.WritePropertyName("receivedResponse"); - writer.WriteStringValue(ReceivedResponse.Value, "P"); + writer.WriteStringValue(ReceivedResponse); } if (Optional.IsDefined(DomProcessing)) { writer.WritePropertyName("domProcessing"); - writer.WriteStringValue(DomProcessing.Value, "P"); + writer.WriteStringValue(DomProcessing); } if (Optional.IsCollectionDefined(Properties)) { @@ -87,101 +85,5 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - - internal static PageViewPerfData DeserializePageViewPerfData(JsonElement element) - { - int ver = default; - string id = default; - string name = default; - Optional url = default; - Optional duration = default; - Optional perfTotal = default; - Optional networkConnect = default; - Optional sentRequest = default; - Optional receivedResponse = default; - Optional domProcessing = default; - Optional> properties = default; - Optional> measurements = default; - Optional test = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("ver")) - { - ver = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("url")) - { - url = property.Value.GetString(); - continue; - } - if (property.NameEquals("duration")) - { - duration = property.Value.GetTimeSpan("P"); - continue; - } - if (property.NameEquals("perfTotal")) - { - perfTotal = property.Value.GetTimeSpan("P"); - continue; - } - if (property.NameEquals("networkConnect")) - { - networkConnect = property.Value.GetTimeSpan("P"); - continue; - } - if (property.NameEquals("sentRequest")) - { - sentRequest = property.Value.GetTimeSpan("P"); - continue; - } - if (property.NameEquals("receivedResponse")) - { - receivedResponse = property.Value.GetTimeSpan("P"); - continue; - } - if (property.NameEquals("domProcessing")) - { - domProcessing = property.Value.GetTimeSpan("P"); - continue; - } - if (property.NameEquals("properties")) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - properties = dictionary; - continue; - } - if (property.NameEquals("measurements")) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetDouble()); - } - measurements = dictionary; - continue; - } - if (property.NameEquals("test")) - { - test = property.Value.GetString(); - continue; - } - } - return new PageViewPerfData(test.Value, ver, id, name, url.Value, Optional.ToNullable(duration), Optional.ToNullable(perfTotal), Optional.ToNullable(networkConnect), Optional.ToNullable(sentRequest), Optional.ToNullable(receivedResponse), Optional.ToNullable(domProcessing), Optional.ToDictionary(properties), Optional.ToDictionary(measurements)); - } } } diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/PageViewPerfData.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/PageViewPerfData.cs index 85c9678131f2..2d760a8c4768 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/PageViewPerfData.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/PageViewPerfData.cs @@ -15,11 +15,11 @@ namespace OpenTelemetry.Exporter.AzureMonitor.Models public partial class PageViewPerfData : MonitorDomain { /// Initializes a new instance of PageViewPerfData. - /// Schema version. + /// Schema version. /// Identifier of a page view instance. Used for correlation between page view and other telemetry items. /// Event name. Keep it low cardinality to allow proper grouping and useful metrics. /// or is null. - public PageViewPerfData(int ver, string id, string name) + public PageViewPerfData(int version, string id, string name) { if (id == null) { @@ -30,66 +30,36 @@ public PageViewPerfData(int ver, string id, string name) throw new ArgumentNullException(nameof(name)); } - Ver = ver; + Version = version; Id = id; Name = name; Properties = new ChangeTrackingDictionary(); Measurements = new ChangeTrackingDictionary(); } - /// Initializes a new instance of PageViewPerfData. - /// Ignored value. - /// Schema version. - /// Identifier of a page view instance. Used for correlation between page view and other telemetry items. - /// Event name. Keep it low cardinality to allow proper grouping and useful metrics. - /// Request URL with all query string parameters. - /// Request duration in format: DD.HH:MM:SS.MMMMMM. For a page view (PageViewData), this is the duration. For a page view with performance information (PageViewPerfData), this is the page load time. Must be less than 1000 days. - /// Performance total in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff. - /// Network connection time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff. - /// Sent request time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff. - /// Received response time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff. - /// DOM processing time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff. - /// Collection of custom properties. TODO: max key length validate. - /// Collection of custom measurements. TODO: max key length validate. - internal PageViewPerfData(string test, int ver, string id, string name, string url, TimeSpan? duration, TimeSpan? perfTotal, TimeSpan? networkConnect, TimeSpan? sentRequest, TimeSpan? receivedResponse, TimeSpan? domProcessing, IDictionary properties, IDictionary measurements) : base(test) - { - Ver = ver; - Id = id; - Name = name; - Url = url; - Duration = duration; - PerfTotal = perfTotal; - NetworkConnect = networkConnect; - SentRequest = sentRequest; - ReceivedResponse = receivedResponse; - DomProcessing = domProcessing; - Properties = properties; - Measurements = measurements; - } - /// Schema version. - public int Ver { get; set; } + public int Version { get; } /// Identifier of a page view instance. Used for correlation between page view and other telemetry items. - public string Id { get; set; } + public string Id { get; } /// Event name. Keep it low cardinality to allow proper grouping and useful metrics. - public string Name { get; set; } + public string Name { get; } /// Request URL with all query string parameters. public string Url { get; set; } /// Request duration in format: DD.HH:MM:SS.MMMMMM. For a page view (PageViewData), this is the duration. For a page view with performance information (PageViewPerfData), this is the page load time. Must be less than 1000 days. - public TimeSpan? Duration { get; set; } + public string Duration { get; set; } /// Performance total in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff. - public TimeSpan? PerfTotal { get; set; } + public string PerfTotal { get; set; } /// Network connection time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff. - public TimeSpan? NetworkConnect { get; set; } + public string NetworkConnect { get; set; } /// Sent request time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff. - public TimeSpan? SentRequest { get; set; } + public string SentRequest { get; set; } /// Received response time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff. - public TimeSpan? ReceivedResponse { get; set; } + public string ReceivedResponse { get; set; } /// DOM processing time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff. - public TimeSpan? DomProcessing { get; set; } - /// Collection of custom properties. TODO: max key length validate. + public string DomProcessing { get; set; } + /// Collection of custom properties. public IDictionary Properties { get; } - /// Collection of custom measurements. TODO: max key length validate. + /// Collection of custom measurements. public IDictionary Measurements { get; } } } diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/RemoteDependencyData.Serialization.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/RemoteDependencyData.Serialization.cs index f8d9e068d0ff..877406928d88 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/RemoteDependencyData.Serialization.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/RemoteDependencyData.Serialization.cs @@ -5,8 +5,6 @@ #nullable disable -using System; -using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -18,7 +16,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("ver"); - writer.WriteNumberValue(Ver); + writer.WriteNumberValue(Version); if (Optional.IsDefined(Id)) { writer.WritePropertyName("id"); @@ -47,7 +45,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Target); } writer.WritePropertyName("duration"); - writer.WriteStringValue(Duration, "P"); + writer.WriteStringValue(Duration); if (Optional.IsDefined(Success)) { writer.WritePropertyName("success"); @@ -82,95 +80,5 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - - internal static RemoteDependencyData DeserializeRemoteDependencyData(JsonElement element) - { - int ver = default; - Optional id = default; - string name = default; - Optional resultCode = default; - Optional data = default; - Optional type = default; - Optional target = default; - TimeSpan duration = default; - Optional success = default; - Optional> properties = default; - Optional> measurements = default; - Optional test = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("ver")) - { - ver = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultCode")) - { - resultCode = property.Value.GetString(); - continue; - } - if (property.NameEquals("data")) - { - data = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("target")) - { - target = property.Value.GetString(); - continue; - } - if (property.NameEquals("duration")) - { - duration = property.Value.GetTimeSpan("P"); - continue; - } - if (property.NameEquals("success")) - { - success = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("properties")) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - properties = dictionary; - continue; - } - if (property.NameEquals("measurements")) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetDouble()); - } - measurements = dictionary; - continue; - } - if (property.NameEquals("test")) - { - test = property.Value.GetString(); - continue; - } - } - return new RemoteDependencyData(test.Value, ver, id.Value, name, resultCode.Value, data.Value, type.Value, target.Value, duration, Optional.ToNullable(success), Optional.ToDictionary(properties), Optional.ToDictionary(measurements)); - } } } diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/RemoteDependencyData.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/RemoteDependencyData.cs index 4f717d17b425..a08b2426a926 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/RemoteDependencyData.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/RemoteDependencyData.cs @@ -15,58 +15,34 @@ namespace OpenTelemetry.Exporter.AzureMonitor.Models public partial class RemoteDependencyData : MonitorDomain { /// Initializes a new instance of RemoteDependencyData. - /// Schema version. + /// Schema version. /// Name of the command initiated with this dependency call. Low cardinality value. Examples are stored procedure name and URL path template. /// Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days. - /// is null. - public RemoteDependencyData(int ver, string name, TimeSpan duration) + /// or is null. + public RemoteDependencyData(int version, string name, string duration) { if (name == null) { throw new ArgumentNullException(nameof(name)); } + if (duration == null) + { + throw new ArgumentNullException(nameof(duration)); + } - Ver = ver; + Version = version; Name = name; Duration = duration; Properties = new ChangeTrackingDictionary(); Measurements = new ChangeTrackingDictionary(); } - /// Initializes a new instance of RemoteDependencyData. - /// Ignored value. - /// Schema version. - /// Identifier of a dependency call instance. Used for correlation with the request telemetry item corresponding to this dependency call. - /// Name of the command initiated with this dependency call. Low cardinality value. Examples are stored procedure name and URL path template. - /// Result code of a dependency call. Examples are SQL error code and HTTP status code. - /// Command initiated by this dependency call. Examples are SQL statement and HTTP URL's with all query parameters. - /// Dependency type name. Very low cardinality value for logical grouping of dependencies and interpretation of other fields like commandName and resultCode. Examples are SQL, Azure table, and HTTP. - /// Target site of a dependency call. Examples are server name, host address. - /// Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days. - /// Indication of successfull or unsuccessfull call. - /// Collection of custom properties. TODO: max key length validate. - /// Collection of custom measurements. TODO: max key length validate. - internal RemoteDependencyData(string test, int ver, string id, string name, string resultCode, string data, string type, string target, TimeSpan duration, bool? success, IDictionary properties, IDictionary measurements) : base(test) - { - Ver = ver; - Id = id; - Name = name; - ResultCode = resultCode; - Data = data; - Type = type; - Target = target; - Duration = duration; - Success = success; - Properties = properties; - Measurements = measurements; - } - /// Schema version. - public int Ver { get; set; } + public int Version { get; } /// Identifier of a dependency call instance. Used for correlation with the request telemetry item corresponding to this dependency call. public string Id { get; set; } /// Name of the command initiated with this dependency call. Low cardinality value. Examples are stored procedure name and URL path template. - public string Name { get; set; } + public string Name { get; } /// Result code of a dependency call. Examples are SQL error code and HTTP status code. public string ResultCode { get; set; } /// Command initiated by this dependency call. Examples are SQL statement and HTTP URL's with all query parameters. @@ -76,12 +52,12 @@ internal RemoteDependencyData(string test, int ver, string id, string name, stri /// Target site of a dependency call. Examples are server name, host address. public string Target { get; set; } /// Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days. - public TimeSpan Duration { get; set; } + public string Duration { get; } /// Indication of successfull or unsuccessfull call. public bool? Success { get; set; } - /// Collection of custom properties. TODO: max key length validate. + /// Collection of custom properties. public IDictionary Properties { get; } - /// Collection of custom measurements. TODO: max key length validate. + /// Collection of custom measurements. public IDictionary Measurements { get; } } } diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/RequestData.Serialization.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/RequestData.Serialization.cs index f6bc5a3dda90..610e695c43e5 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/RequestData.Serialization.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/RequestData.Serialization.cs @@ -5,7 +5,6 @@ #nullable disable -using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -17,7 +16,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("ver"); - writer.WriteNumberValue(Ver); + writer.WriteNumberValue(Version); writer.WritePropertyName("id"); writer.WriteStringValue(Id); if (Optional.IsDefined(Name)) @@ -70,89 +69,5 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - - internal static RequestData DeserializeRequestData(JsonElement element) - { - int ver = default; - string id = default; - Optional name = default; - string duration = default; - bool success = default; - string responseCode = default; - Optional source = default; - Optional url = default; - Optional> properties = default; - Optional> measurements = default; - Optional test = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("ver")) - { - ver = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("duration")) - { - duration = property.Value.GetString(); - continue; - } - if (property.NameEquals("success")) - { - success = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("responseCode")) - { - responseCode = property.Value.GetString(); - continue; - } - if (property.NameEquals("source")) - { - source = property.Value.GetString(); - continue; - } - if (property.NameEquals("url")) - { - url = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - properties = dictionary; - continue; - } - if (property.NameEquals("measurements")) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetDouble()); - } - measurements = dictionary; - continue; - } - if (property.NameEquals("test")) - { - test = property.Value.GetString(); - continue; - } - } - return new RequestData(test.Value, ver, id, name.Value, duration, success, responseCode, source.Value, url.Value, Optional.ToDictionary(properties), Optional.ToDictionary(measurements)); - } } } diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/RequestData.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/RequestData.cs index 5930dda8ad6c..d9433729d0f0 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/RequestData.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/RequestData.cs @@ -15,13 +15,13 @@ namespace OpenTelemetry.Exporter.AzureMonitor.Models public partial class RequestData : MonitorDomain { /// Initializes a new instance of RequestData. - /// Schema version. + /// Schema version. /// Identifier of a request call instance. Used for correlation between request and other telemetry items. /// Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days. /// Indication of successfull or unsuccessfull call. /// Result of a request execution. HTTP status code for HTTP requests. /// , , or is null. - public RequestData(int ver, string id, string duration, bool success, string responseCode) + public RequestData(int version, string id, string duration, bool success, string responseCode) { if (id == null) { @@ -36,7 +36,7 @@ public RequestData(int ver, string id, string duration, bool success, string res throw new ArgumentNullException(nameof(responseCode)); } - Ver = ver; + Version = version; Id = id; Duration = duration; Success = success; @@ -45,49 +45,25 @@ public RequestData(int ver, string id, string duration, bool success, string res Measurements = new ChangeTrackingDictionary(); } - /// Initializes a new instance of RequestData. - /// Ignored value. - /// Schema version. - /// Identifier of a request call instance. Used for correlation between request and other telemetry items. - /// Name of the request. Represents code path taken to process request. Low cardinality value to allow better grouping of requests. For HTTP requests it represents the HTTP method and URL path template like 'GET /values/{id}'. - /// Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days. - /// Indication of successfull or unsuccessfull call. - /// Result of a request execution. HTTP status code for HTTP requests. - /// Source of the request. Examples are the instrumentation key of the caller or the ip address of the caller. - /// Request URL with all query string parameters. - /// Collection of custom properties. TODO: max key length validate. - /// Collection of custom measurements. TODO: max key length validate. - internal RequestData(string test, int ver, string id, string name, string duration, bool success, string responseCode, string source, string url, IDictionary properties, IDictionary measurements) : base(test) - { - Ver = ver; - Id = id; - Name = name; - Duration = duration; - Success = success; - ResponseCode = responseCode; - Source = source; - Url = url; - Properties = properties; - Measurements = measurements; - } - /// Schema version. - public int Ver { get; set; } + public int Version { get; } /// Identifier of a request call instance. Used for correlation between request and other telemetry items. - public string Id { get; set; } + public string Id { get; } /// Name of the request. Represents code path taken to process request. Low cardinality value to allow better grouping of requests. For HTTP requests it represents the HTTP method and URL path template like 'GET /values/{id}'. public string Name { get; set; } + /// Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days. + public string Duration { get; } /// Indication of successfull or unsuccessfull call. - public bool Success { get; set; } + public bool Success { get; } /// Result of a request execution. HTTP status code for HTTP requests. - public string ResponseCode { get; set; } + public string ResponseCode { get; } /// Source of the request. Examples are the instrumentation key of the caller or the ip address of the caller. public string Source { get; set; } /// Request URL with all query string parameters. public string Url { get; set; } - /// Collection of custom properties. TODO: max key length validate. + /// Collection of custom properties. public IDictionary Properties { get; } - /// Collection of custom measurements. TODO: max key length validate. + /// Collection of custom measurements. public IDictionary Measurements { get; } } } diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/StackFrame.Serialization.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/StackFrame.Serialization.cs index fb473c2733f3..ba73a941dadd 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/StackFrame.Serialization.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/StackFrame.Serialization.cs @@ -36,43 +36,5 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - - internal static StackFrame DeserializeStackFrame(JsonElement element) - { - int level = default; - string method = default; - Optional assembly = default; - Optional fileName = default; - Optional line = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("level")) - { - level = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("method")) - { - method = property.Value.GetString(); - continue; - } - if (property.NameEquals("assembly")) - { - assembly = property.Value.GetString(); - continue; - } - if (property.NameEquals("fileName")) - { - fileName = property.Value.GetString(); - continue; - } - if (property.NameEquals("line")) - { - line = property.Value.GetInt32(); - continue; - } - } - return new StackFrame(level, method, assembly.Value, fileName.Value, Optional.ToNullable(line)); - } } } diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/StackFrame.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/StackFrame.cs index 6aa4d45e633c..f5be4250f62e 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/StackFrame.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/StackFrame.cs @@ -27,22 +27,9 @@ public StackFrame(int level, string method) Method = method; } - /// Initializes a new instance of StackFrame. - /// . - /// Method name. - /// Name of the assembly (dll, jar, etc.) containing this function. - /// File name or URL of the method implementation. - /// Line number of the code implementation. - internal StackFrame(int level, string method, string assembly, string fileName, int? line) - { - Level = level; - Method = method; - Assembly = assembly; - FileName = fileName; - Line = line; - } + public int Level { get; } /// Method name. - public string Method { get; set; } + public string Method { get; } /// Name of the assembly (dll, jar, etc.) containing this function. public string Assembly { get; set; } /// File name or URL of the method implementation. diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/ErrorDetails.Serialization.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryErrorDetails.Serialization.cs similarity index 79% rename from sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/ErrorDetails.Serialization.cs rename to sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryErrorDetails.Serialization.cs index ac6007974cf9..1ae188ab0b65 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/ErrorDetails.Serialization.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryErrorDetails.Serialization.cs @@ -10,9 +10,9 @@ namespace OpenTelemetry.Exporter.AzureMonitor.Models { - public partial class ErrorDetails + public partial class TelemetryErrorDetails { - internal static ErrorDetails DeserializeErrorDetails(JsonElement element) + internal static TelemetryErrorDetails DeserializeTelemetryErrorDetails(JsonElement element) { Optional index = default; Optional statusCode = default; @@ -35,7 +35,7 @@ internal static ErrorDetails DeserializeErrorDetails(JsonElement element) continue; } } - return new ErrorDetails(Optional.ToNullable(index), Optional.ToNullable(statusCode), message.Value); + return new TelemetryErrorDetails(Optional.ToNullable(index), Optional.ToNullable(statusCode), message.Value); } } } diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/ErrorDetails.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryErrorDetails.cs similarity index 74% rename from sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/ErrorDetails.cs rename to sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryErrorDetails.cs index 63a606401015..26e66910c9f9 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/ErrorDetails.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryErrorDetails.cs @@ -8,18 +8,18 @@ namespace OpenTelemetry.Exporter.AzureMonitor.Models { /// The error details. - public partial class ErrorDetails + public partial class TelemetryErrorDetails { - /// Initializes a new instance of ErrorDetails. - internal ErrorDetails() + /// Initializes a new instance of TelemetryErrorDetails. + internal TelemetryErrorDetails() { } - /// Initializes a new instance of ErrorDetails. + /// Initializes a new instance of TelemetryErrorDetails. /// The index in the original payload of the item. /// The item specific [HTTP Response status code](#Response Status Codes). /// The error message. - internal ErrorDetails(int? index, int? statusCode, string message) + internal TelemetryErrorDetails(int? index, int? statusCode, string message) { Index = index; StatusCode = statusCode; diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryEventData.Serialization.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryEventData.Serialization.cs new file mode 100644 index 000000000000..60a3ac15247d --- /dev/null +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryEventData.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace OpenTelemetry.Exporter.AzureMonitor.Models +{ + public partial class TelemetryEventData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("ver"); + writer.WriteNumberValue(Version); + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + if (Optional.IsCollectionDefined(Properties)) + { + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + foreach (var item in Properties) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(Measurements)) + { + writer.WritePropertyName("measurements"); + writer.WriteStartObject(); + foreach (var item in Measurements) + { + writer.WritePropertyName(item.Key); + writer.WriteNumberValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Test)) + { + writer.WritePropertyName("test"); + writer.WriteStringValue(Test); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryEventData.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryEventData.cs new file mode 100644 index 000000000000..cc051f1df07e --- /dev/null +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryEventData.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace OpenTelemetry.Exporter.AzureMonitor.Models +{ + /// Instances of Event represent structured event records that can be grouped and searched by their properties. Event data item also creates a metric of event count by name. + public partial class TelemetryEventData : MonitorDomain + { + /// Initializes a new instance of TelemetryEventData. + /// Schema version. + /// Event name. Keep it low cardinality to allow proper grouping and useful metrics. + /// is null. + public TelemetryEventData(int version, string name) + { + if (name == null) + { + throw new ArgumentNullException(nameof(name)); + } + + Version = version; + Name = name; + Properties = new ChangeTrackingDictionary(); + Measurements = new ChangeTrackingDictionary(); + } + + /// Schema version. + public int Version { get; } + /// Event name. Keep it low cardinality to allow proper grouping and useful metrics. + public string Name { get; } + /// Collection of custom properties. + public IDictionary Properties { get; } + /// Collection of custom measurements. + public IDictionary Measurements { get; } + } +} diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryExceptionData.Serialization.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryExceptionData.Serialization.cs new file mode 100644 index 000000000000..896de6487a9d --- /dev/null +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryExceptionData.Serialization.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace OpenTelemetry.Exporter.AzureMonitor.Models +{ + public partial class TelemetryExceptionData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("ver"); + writer.WriteNumberValue(Version); + if (Optional.IsCollectionDefined(Exceptions)) + { + writer.WritePropertyName("exceptions"); + writer.WriteStartArray(); + foreach (var item in Exceptions) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(SeverityLevel)) + { + if (SeverityLevel != null) + { + writer.WritePropertyName("severityLevel"); + writer.WriteStringValue(SeverityLevel.Value.ToString()); + } + else + { + writer.WriteNull("severityLevel"); + } + } + if (Optional.IsDefined(ProblemId)) + { + writer.WritePropertyName("problemId"); + writer.WriteStringValue(ProblemId); + } + if (Optional.IsCollectionDefined(Properties)) + { + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + foreach (var item in Properties) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(Measurements)) + { + writer.WritePropertyName("measurements"); + writer.WriteStartObject(); + foreach (var item in Measurements) + { + writer.WritePropertyName(item.Key); + writer.WriteNumberValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Test)) + { + writer.WritePropertyName("test"); + writer.WriteStringValue(Test); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryExceptionData.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryExceptionData.cs new file mode 100644 index 000000000000..c5e1ef34ad79 --- /dev/null +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryExceptionData.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace OpenTelemetry.Exporter.AzureMonitor.Models +{ + /// An instance of Exception represents a handled or unhandled exception that occurred during execution of the monitored application. + public partial class TelemetryExceptionData : MonitorDomain + { + /// Initializes a new instance of TelemetryExceptionData. + /// Schema version. + public TelemetryExceptionData(int version) + { + Version = version; + Exceptions = new ChangeTrackingList(); + Properties = new ChangeTrackingDictionary(); + Measurements = new ChangeTrackingDictionary(); + } + + /// Schema version. + public int Version { get; } + /// Exception chain - list of inner exceptions. + public IList Exceptions { get; } + /// Severity level. Mostly used to indicate exception severity level when it is reported by logging library. + public SeverityLevel? SeverityLevel { get; set; } + /// Identifier of where the exception was thrown in code. Used for exceptions grouping. Typically a combination of exception type and a function from the call stack. + public string ProblemId { get; set; } + /// Collection of custom properties. + public IDictionary Properties { get; } + /// Collection of custom measurements. + public IDictionary Measurements { get; } + } +} diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryExceptionDetails.Serialization.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryExceptionDetails.Serialization.cs new file mode 100644 index 000000000000..95cee0ce3ed7 --- /dev/null +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryExceptionDetails.Serialization.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace OpenTelemetry.Exporter.AzureMonitor.Models +{ + public partial class TelemetryExceptionDetails : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteNumberValue(Id.Value); + } + if (Optional.IsDefined(OuterId)) + { + writer.WritePropertyName("outerId"); + writer.WriteNumberValue(OuterId.Value); + } + if (Optional.IsDefined(TypeName)) + { + writer.WritePropertyName("typeName"); + writer.WriteStringValue(TypeName); + } + writer.WritePropertyName("message"); + writer.WriteStringValue(Message); + if (Optional.IsDefined(HasFullStack)) + { + writer.WritePropertyName("hasFullStack"); + writer.WriteBooleanValue(HasFullStack.Value); + } + if (Optional.IsDefined(Stack)) + { + writer.WritePropertyName("stack"); + writer.WriteStringValue(Stack); + } + if (Optional.IsCollectionDefined(ParsedStack)) + { + writer.WritePropertyName("parsedStack"); + writer.WriteStartArray(); + foreach (var item in ParsedStack) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/ExceptionDetails.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryExceptionDetails.cs similarity index 53% rename from sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/ExceptionDetails.cs rename to sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryExceptionDetails.cs index 30043a305804..b7f5b3bca1e4 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/ExceptionDetails.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryExceptionDetails.cs @@ -12,12 +12,12 @@ namespace OpenTelemetry.Exporter.AzureMonitor.Models { /// Exception details of the exception in a chain. - public partial class ExceptionDetails + public partial class TelemetryExceptionDetails { - /// Initializes a new instance of ExceptionDetails. + /// Initializes a new instance of TelemetryExceptionDetails. /// Exception message. /// is null. - public ExceptionDetails(string message) + public TelemetryExceptionDetails(string message) { if (message == null) { @@ -28,25 +28,6 @@ public ExceptionDetails(string message) ParsedStack = new ChangeTrackingList(); } - /// Initializes a new instance of ExceptionDetails. - /// In case exception is nested (outer exception contains inner one), the id and outerId properties are used to represent the nesting. - /// The value of outerId is a reference to an element in ExceptionDetails that represents the outer exception. - /// Exception type name. - /// Exception message. - /// Indicates if full exception stack is provided in the exception. The stack may be trimmed, such as in the case of a StackOverflow exception. - /// Text describing the stack. Either stack or parsedStack should have a value. - /// List of stack frames. Either stack or parsedStack should have a value. - internal ExceptionDetails(int? id, int? outerId, string typeName, string message, bool? hasFullStack, string stack, IList parsedStack) - { - Id = id; - OuterId = outerId; - TypeName = typeName; - Message = message; - HasFullStack = hasFullStack; - Stack = stack; - ParsedStack = parsedStack; - } - /// In case exception is nested (outer exception contains inner one), the id and outerId properties are used to represent the nesting. public int? Id { get; set; } /// The value of outerId is a reference to an element in ExceptionDetails that represents the outer exception. @@ -54,7 +35,7 @@ internal ExceptionDetails(int? id, int? outerId, string typeName, string message /// Exception type name. public string TypeName { get; set; } /// Exception message. - public string Message { get; set; } + public string Message { get; } /// Indicates if full exception stack is provided in the exception. The stack may be trimmed, such as in the case of a StackOverflow exception. public bool? HasFullStack { get; set; } /// Text describing the stack. Either stack or parsedStack should have a value. diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryEnvelope.Serialization.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryItem.Serialization.cs similarity index 80% rename from sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryEnvelope.Serialization.cs rename to sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryItem.Serialization.cs index 3c48d23bbf84..e0683c4c3b33 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryEnvelope.Serialization.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryItem.Serialization.cs @@ -10,15 +10,15 @@ namespace OpenTelemetry.Exporter.AzureMonitor.Models { - public partial class TelemetryEnvelope : IUtf8JsonSerializable + public partial class TelemetryItem : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - if (Optional.IsDefined(Ver)) + if (Optional.IsDefined(Version)) { writer.WritePropertyName("ver"); - writer.WriteNumberValue(Ver.Value); + writer.WriteNumberValue(Version.Value); } writer.WritePropertyName("name"); writer.WriteStringValue(Name); @@ -29,15 +29,15 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sampleRate"); writer.WriteNumberValue(SampleRate.Value); } - if (Optional.IsDefined(Seq)) + if (Optional.IsDefined(Sequence)) { writer.WritePropertyName("seq"); - writer.WriteStringValue(Seq); + writer.WriteStringValue(Sequence); } - if (Optional.IsDefined(IKey)) + if (Optional.IsDefined(InstrumentationKey)) { writer.WritePropertyName("iKey"); - writer.WriteStringValue(IKey); + writer.WriteStringValue(InstrumentationKey); } if (Optional.IsCollectionDefined(Tags)) { diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryEnvelope.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryItem.cs similarity index 90% rename from sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryEnvelope.cs rename to sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryItem.cs index b186711ebd9c..ec2599f2ace2 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryEnvelope.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TelemetryItem.cs @@ -12,13 +12,13 @@ namespace OpenTelemetry.Exporter.AzureMonitor.Models { /// System variables for a telemetry item. - public partial class TelemetryEnvelope + public partial class TelemetryItem { - /// Initializes a new instance of TelemetryEnvelope. + /// Initializes a new instance of TelemetryItem. /// Type name of telemetry data item. /// Event date time when telemetry item was created. This is the wall clock time on the client when the event was generated. There is no guarantee that the client's time is accurate. This field must be formatted in UTC ISO 8601 format, with a trailing 'Z' character, as described publicly on https://en.wikipedia.org/wiki/ISO_8601#UTC. Note: the number of decimal seconds digits provided are variable (and unspecified). Consumers should handle this, i.e. managed code consumers should not use format 'O' for parsing as it specifies a fixed length. Example: 2009-06-15T13:45:30.0000000Z. /// is null. - public TelemetryEnvelope(string name, DateTimeOffset time) + public TelemetryItem(string name, DateTimeOffset time) { if (name == null) { @@ -31,7 +31,7 @@ public TelemetryEnvelope(string name, DateTimeOffset time) } /// Envelope version. For internal use only. By assigning this the default, it will not be serialized within the payload unless changed to a value other than #1. - public int? Ver { get; set; } + public int? Version { get; set; } /// Type name of telemetry data item. public string Name { get; } /// Event date time when telemetry item was created. This is the wall clock time on the client when the event was generated. There is no guarantee that the client's time is accurate. This field must be formatted in UTC ISO 8601 format, with a trailing 'Z' character, as described publicly on https://en.wikipedia.org/wiki/ISO_8601#UTC. Note: the number of decimal seconds digits provided are variable (and unspecified). Consumers should handle this, i.e. managed code consumers should not use format 'O' for parsing as it specifies a fixed length. Example: 2009-06-15T13:45:30.0000000Z. @@ -39,9 +39,9 @@ public TelemetryEnvelope(string name, DateTimeOffset time) /// Sampling rate used in application. This telemetry item represents 1 / sampleRate actual telemetry items. public float? SampleRate { get; set; } /// Sequence field used to track absolute order of uploaded events. - public string Seq { get; set; } + public string Sequence { get; set; } /// The instrumentation key of the Application Insights resource. - public string IKey { get; set; } + public string InstrumentationKey { get; set; } /// Key/value collection of context properties. See ContextTagKeys for information on available properties. public IDictionary Tags { get; } /// Telemetry data item. diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TrackResponse.Serialization.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TrackResponse.Serialization.cs index 8705fa09b8e3..ee097a4a0360 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TrackResponse.Serialization.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TrackResponse.Serialization.cs @@ -17,7 +17,7 @@ internal static TrackResponse DeserializeTrackResponse(JsonElement element) { Optional itemsReceived = default; Optional itemsAccepted = default; - Optional> errors = default; + Optional> errors = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("itemsReceived")) @@ -32,10 +32,10 @@ internal static TrackResponse DeserializeTrackResponse(JsonElement element) } if (property.NameEquals("errors")) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(ErrorDetails.DeserializeErrorDetails(item)); + array.Add(TelemetryErrorDetails.DeserializeTelemetryErrorDetails(item)); } errors = array; continue; diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TrackResponse.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TrackResponse.cs index 42d5cf181494..346b16b0d95b 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TrackResponse.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/Models/TrackResponse.cs @@ -16,14 +16,14 @@ public partial class TrackResponse /// Initializes a new instance of TrackResponse. internal TrackResponse() { - Errors = new ChangeTrackingList(); + Errors = new ChangeTrackingList(); } /// Initializes a new instance of TrackResponse. /// The number of items received. /// The number of items accepted. /// An array of error detail objects. - internal TrackResponse(int? itemsReceived, int? itemsAccepted, IReadOnlyList errors) + internal TrackResponse(int? itemsReceived, int? itemsAccepted, IReadOnlyList errors) { ItemsReceived = itemsReceived; ItemsAccepted = itemsAccepted; @@ -35,6 +35,6 @@ internal TrackResponse(int? itemsReceived, int? itemsAccepted, IReadOnlyList The number of items accepted. public int? ItemsAccepted { get; } /// An array of error detail objects. - public IReadOnlyList Errors { get; } + public IReadOnlyList Errors { get; } } } diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/ServiceRestClient.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/ServiceRestClient.cs index 4854f1e1bb25..43c6172c2e3c 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/ServiceRestClient.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Generated/ServiceRestClient.cs @@ -44,7 +44,7 @@ public ServiceRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipel /// Time series points and period if needed. Advanced model parameters can also be set in the request. /// The cancellation token to use. /// is null. - public async Task> TrackAsync(IEnumerable body, CancellationToken cancellationToken = default) + public async Task> TrackAsync(IEnumerable body, CancellationToken cancellationToken = default) { if (body == null) { @@ -77,7 +77,7 @@ public async Task> TrackAsync(IEnumerable Time series points and period if needed. Advanced model parameters can also be set in the request. /// The cancellation token to use. /// is null. - public Response Track(IEnumerable body, CancellationToken cancellationToken = default) + public Response Track(IEnumerable body, CancellationToken cancellationToken = default) { if (body == null) { diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/RequestData.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/RequestData.cs deleted file mode 100644 index 9173ff23ffb2..000000000000 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/RequestData.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace OpenTelemetry.Exporter.AzureMonitor.Models -{ - public partial class RequestData - { - /// Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days. - public string Duration { get; set; } - } -} diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/ServiceRestClient.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/ServiceRestClient.cs index be79952b8ab7..c536367cd6dc 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/ServiceRestClient.cs +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/ServiceRestClient.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System.Collections.Generic; @@ -9,7 +9,7 @@ namespace OpenTelemetry.Exporter.AzureMonitor { internal partial class ServiceRestClient { - internal HttpMessage CreateTrackRequest(IEnumerable body) + internal HttpMessage CreateTrackRequest(IEnumerable body) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -20,6 +20,7 @@ internal HttpMessage CreateTrackRequest(IEnumerable body) uri.AppendPath("/track", false); request.Uri = uri; request.Headers.Add("Content-Type", "application/json"); + request.Headers.Add("Accept", "application/json"); using var content = new NDJsonWriter(); foreach (var item in body) { diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/StackFrame.cs b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/StackFrame.cs deleted file mode 100644 index 3a31543e650c..000000000000 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/StackFrame.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace OpenTelemetry.Exporter.AzureMonitor.Models -{ - public partial class StackFrame - { - /// Method name. - public int Level { get; set; } - } -} diff --git a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/autorest.md b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/autorest.md index b34c30eb52eb..6817750bece7 100644 --- a/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/autorest.md +++ b/sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/autorest.md @@ -4,6 +4,5 @@ Run `dotnet msbuild /t:GenerateCode` to generate code. ``` yaml input-file: - - https://raw.githubusercontent.com/srnagar/swagger/d93c35263ce8b28fefdafd702adbb1a0e2347156/application-insights.json -namespace: OpenTelemetry.Exporter.AzureMonitor + - https://github.com/srnagar/swagger/blob/05b8ab86a14164a364ac18869fa2b2e689324403/application-insights.json ```