From b19ac3064dabd80fec180aabed9644382c5c3a98 Mon Sep 17 00:00:00 2001 From: Rajkumar Rangaraj Date: Mon, 30 Oct 2023 15:28:47 -0700 Subject: [PATCH] Add Azure.Monitor.OpenTelemetry.LiveMetrics with auto-generated classes (#39602) * Add auto-generated classes for live metrics swagger. * fix readme and changelog location * Fix CI yaml --- .../CHANGELOG.md | 3 + .../README.md | 34 ++ ...e.Monitor.OpenTelemetry.LiveMetrics.csproj | 15 + ...lectionConfigurationError.Serialization.cs | 46 +++ .../Models/CollectionConfigurationError.cs | 31 ++ .../CollectionConfigurationErrorType.cs | 84 +++++ ...llectionConfigurationInfo.Serialization.cs | 74 ++++ .../Models/CollectionConfigurationInfo.cs | 45 +++ .../Models/DerivedMetricInfo.Serialization.cs | 71 ++++ .../src/Generated/Models/DerivedMetricInfo.cs | 48 +++ .../Models/DerivedMetricInfoAggregation.cs | 57 ++++ ...ilterConjunctionGroupInfo.Serialization.cs | 47 +++ .../DocumentFilterConjunctionGroupInfo.cs | 32 ++ ...FilterConjunctionGroupInfoTelemetryType.cs | 66 ++++ .../Models/DocumentIngress.Serialization.cs | 51 +++ .../src/Generated/Models/DocumentIngress.cs | 30 ++ .../Models/DocumentIngressDocumentType.cs | 60 ++++ .../DocumentStreamInfo.Serialization.cs | 49 +++ .../Generated/Models/DocumentStreamInfo.cs | 36 ++ .../EventDocumentIngress.Serialization.cs | 56 ++++ .../Generated/Models/EventDocumentIngress.cs | 21 ++ .../ExceptionDocumentIngress.Serialization.cs | 61 ++++ .../Models/ExceptionDocumentIngress.cs | 23 ++ ...ilterConjunctionGroupInfo.Serialization.cs | 43 +++ .../Models/FilterConjunctionGroupInfo.cs | 32 ++ .../Models/FilterInfo.Serialization.cs | 49 +++ .../src/Generated/Models/FilterInfo.cs | 36 ++ .../Generated/Models/FilterInfoPredicate.cs | 69 ++++ .../KeyValuePairString.Serialization.cs | 31 ++ .../Generated/Models/KeyValuePairString.cs | 23 ++ .../Models/MetricPoint.Serialization.cs | 36 ++ .../src/Generated/Models/MetricPoint.cs | 25 ++ .../MonitoringDataPoint.Serialization.cs | 111 ++++++ .../Generated/Models/MonitoringDataPoint.cs | 55 +++ .../Models/ProcessCpuData.Serialization.cs | 31 ++ .../src/Generated/Models/ProcessCpuData.cs | 23 ++ .../QuotaConfigurationInfo.Serialization.cs | 49 +++ .../Models/QuotaConfigurationInfo.cs | 40 +++ ...DependencyDocumentIngress.Serialization.cs | 71 ++++ .../Models/RemoteDependencyDocumentIngress.cs | 27 ++ .../RequestDocumentIngress.Serialization.cs | 71 ++++ .../Models/RequestDocumentIngress.cs | 27 ++ .../Models/ServiceError.Serialization.cs | 62 ++++ .../src/Generated/Models/ServiceError.cs | 46 +++ .../TraceDocumentIngress.Serialization.cs | 56 ++++ .../Generated/Models/TraceDocumentIngress.cs | 21 ++ .../QuickPulseSDKClientAPIsPingHeaders.cs | 29 ++ .../QuickPulseSDKClientAPIsPostHeaders.cs | 31 ++ .../QuickPulseSDKClientAPIsRestClient.cs | 317 ++++++++++++++++++ .../src/autorest.md | 17 + sdk/monitor/Azure.Monitor.OpenTelemetry.sln | 6 + sdk/monitor/ci.yml | 4 + 52 files changed, 2478 insertions(+) create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/CHANGELOG.md create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/README.md create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Azure.Monitor.OpenTelemetry.LiveMetrics.csproj create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationError.Serialization.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationError.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationErrorType.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationInfo.Serialization.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationInfo.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DerivedMetricInfo.Serialization.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DerivedMetricInfo.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DerivedMetricInfoAggregation.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentFilterConjunctionGroupInfo.Serialization.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentFilterConjunctionGroupInfo.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentFilterConjunctionGroupInfoTelemetryType.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentIngress.Serialization.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentIngress.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentIngressDocumentType.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentStreamInfo.Serialization.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentStreamInfo.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/EventDocumentIngress.Serialization.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/EventDocumentIngress.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ExceptionDocumentIngress.Serialization.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ExceptionDocumentIngress.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterConjunctionGroupInfo.Serialization.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterConjunctionGroupInfo.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterInfo.Serialization.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterInfo.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterInfoPredicate.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/KeyValuePairString.Serialization.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/KeyValuePairString.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MetricPoint.Serialization.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MetricPoint.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MonitoringDataPoint.Serialization.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MonitoringDataPoint.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ProcessCpuData.Serialization.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ProcessCpuData.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/QuotaConfigurationInfo.Serialization.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/QuotaConfigurationInfo.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RemoteDependencyDocumentIngress.Serialization.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RemoteDependencyDocumentIngress.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RequestDocumentIngress.Serialization.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RequestDocumentIngress.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ServiceError.Serialization.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ServiceError.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/TraceDocumentIngress.Serialization.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/TraceDocumentIngress.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/QuickPulseSDKClientAPIsPingHeaders.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/QuickPulseSDKClientAPIsPostHeaders.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/QuickPulseSDKClientAPIsRestClient.cs create mode 100644 sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/autorest.md diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/CHANGELOG.md b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/CHANGELOG.md new file mode 100644 index 0000000000000..4144f75694a03 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/CHANGELOG.md @@ -0,0 +1,3 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/README.md b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/README.md new file mode 100644 index 0000000000000..9cec295712bd6 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/README.md @@ -0,0 +1,34 @@ +# Azure Monitor Live Metrics client library for .NET + +TODO + +## Getting started + +### Install the package + + +### Prerequisites + + +### Authenticate the client + + +## Key concepts + +TODO + +## Examples + +TODO + +## Troubleshooting + +TODO + +## Next steps + +TODO + +## Contributing + +TODO \ No newline at end of file diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Azure.Monitor.OpenTelemetry.LiveMetrics.csproj b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Azure.Monitor.OpenTelemetry.LiveMetrics.csproj new file mode 100644 index 0000000000000..fcd0e277daa8d --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Azure.Monitor.OpenTelemetry.LiveMetrics.csproj @@ -0,0 +1,15 @@ + + + An OpenTelemetry .NET AzureMonitor OpenTelemetry Live Metrics + AzureMonitor OpenTelemetry Live Metrics + 1.0.0-beta.1 + Azure Monitor OpenTelemetry live Metrics ApplicationInsights + $(RequiredTargetFrameworks) + true + + + + + + + diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationError.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationError.Serialization.cs new file mode 100644 index 0000000000000..7c09d874a5e2d --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationError.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class CollectionConfigurationError : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(CollectionConfigurationErrorType)) + { + writer.WritePropertyName("CollectionConfigurationErrorType"u8); + writer.WriteStringValue(CollectionConfigurationErrorType.Value.ToString()); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("Message"u8); + writer.WriteStringValue(Message); + } + if (Optional.IsDefined(FullException)) + { + writer.WritePropertyName("FullException"u8); + writer.WriteStringValue(FullException); + } + if (Optional.IsCollectionDefined(Data)) + { + writer.WritePropertyName("Data"u8); + writer.WriteStartArray(); + foreach (var item in Data) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationError.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationError.cs new file mode 100644 index 0000000000000..5ce71e78e08e5 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationError.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Represents an error while SDK parsing and applying an instance of CollectionConfigurationInfo. + internal partial class CollectionConfigurationError + { + /// Initializes a new instance of CollectionConfigurationError. + public CollectionConfigurationError() + { + Data = new ChangeTrackingList(); + } + + /// Collection configuration error type reported by SDK. + public CollectionConfigurationErrorType? CollectionConfigurationErrorType { get; set; } + /// Error message. + public string Message { get; set; } + /// Exception that leads to the creation of the configuration error. + public string FullException { get; set; } + /// Custom properties to add more information to the error. + public IList Data { get; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationErrorType.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationErrorType.cs new file mode 100644 index 0000000000000..70720b3a08a14 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationErrorType.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Collection configuration error type reported by SDK. + internal readonly partial struct CollectionConfigurationErrorType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CollectionConfigurationErrorType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string PerformanceCounterParsingValue = "PerformanceCounterParsing"; + private const string PerformanceCounterUnexpectedValue = "PerformanceCounterUnexpected"; + private const string PerformanceCounterDuplicateIdsValue = "PerformanceCounterDuplicateIds"; + private const string DocumentStreamDuplicateIdsValue = "DocumentStreamDuplicateIds"; + private const string DocumentStreamFailureToCreateValue = "DocumentStreamFailureToCreate"; + private const string DocumentStreamFailureToCreateFilterUnexpectedValue = "DocumentStreamFailureToCreateFilterUnexpected"; + private const string MetricDuplicateIdsValue = "MetricDuplicateIds"; + private const string MetricTelemetryTypeUnsupportedValue = "MetricTelemetryTypeUnsupported"; + private const string MetricFailureToCreateValue = "MetricFailureToCreate"; + private const string MetricFailureToCreateFilterUnexpectedValue = "MetricFailureToCreateFilterUnexpected"; + private const string FilterFailureToCreateUnexpectedValue = "FilterFailureToCreateUnexpected"; + private const string CollectionConfigurationFailureToCreateUnexpectedValue = "CollectionConfigurationFailureToCreateUnexpected"; + + /// Unknown. + public static CollectionConfigurationErrorType Unknown { get; } = new CollectionConfigurationErrorType(UnknownValue); + /// PerformanceCounterParsing. + public static CollectionConfigurationErrorType PerformanceCounterParsing { get; } = new CollectionConfigurationErrorType(PerformanceCounterParsingValue); + /// PerformanceCounterUnexpected. + public static CollectionConfigurationErrorType PerformanceCounterUnexpected { get; } = new CollectionConfigurationErrorType(PerformanceCounterUnexpectedValue); + /// PerformanceCounterDuplicateIds. + public static CollectionConfigurationErrorType PerformanceCounterDuplicateIds { get; } = new CollectionConfigurationErrorType(PerformanceCounterDuplicateIdsValue); + /// DocumentStreamDuplicateIds. + public static CollectionConfigurationErrorType DocumentStreamDuplicateIds { get; } = new CollectionConfigurationErrorType(DocumentStreamDuplicateIdsValue); + /// DocumentStreamFailureToCreate. + public static CollectionConfigurationErrorType DocumentStreamFailureToCreate { get; } = new CollectionConfigurationErrorType(DocumentStreamFailureToCreateValue); + /// DocumentStreamFailureToCreateFilterUnexpected. + public static CollectionConfigurationErrorType DocumentStreamFailureToCreateFilterUnexpected { get; } = new CollectionConfigurationErrorType(DocumentStreamFailureToCreateFilterUnexpectedValue); + /// MetricDuplicateIds. + public static CollectionConfigurationErrorType MetricDuplicateIds { get; } = new CollectionConfigurationErrorType(MetricDuplicateIdsValue); + /// MetricTelemetryTypeUnsupported. + public static CollectionConfigurationErrorType MetricTelemetryTypeUnsupported { get; } = new CollectionConfigurationErrorType(MetricTelemetryTypeUnsupportedValue); + /// MetricFailureToCreate. + public static CollectionConfigurationErrorType MetricFailureToCreate { get; } = new CollectionConfigurationErrorType(MetricFailureToCreateValue); + /// MetricFailureToCreateFilterUnexpected. + public static CollectionConfigurationErrorType MetricFailureToCreateFilterUnexpected { get; } = new CollectionConfigurationErrorType(MetricFailureToCreateFilterUnexpectedValue); + /// FilterFailureToCreateUnexpected. + public static CollectionConfigurationErrorType FilterFailureToCreateUnexpected { get; } = new CollectionConfigurationErrorType(FilterFailureToCreateUnexpectedValue); + /// CollectionConfigurationFailureToCreateUnexpected. + public static CollectionConfigurationErrorType CollectionConfigurationFailureToCreateUnexpected { get; } = new CollectionConfigurationErrorType(CollectionConfigurationFailureToCreateUnexpectedValue); + /// Determines if two values are the same. + public static bool operator ==(CollectionConfigurationErrorType left, CollectionConfigurationErrorType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CollectionConfigurationErrorType left, CollectionConfigurationErrorType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator CollectionConfigurationErrorType(string value) => new CollectionConfigurationErrorType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CollectionConfigurationErrorType other && Equals(other); + /// + public bool Equals(CollectionConfigurationErrorType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationInfo.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationInfo.Serialization.cs new file mode 100644 index 0000000000000..29158710af8c3 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationInfo.Serialization.cs @@ -0,0 +1,74 @@ +// 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 Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class CollectionConfigurationInfo + { + internal static CollectionConfigurationInfo DeserializeCollectionConfigurationInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional etag = default; + Optional> metrics = default; + Optional> documentStreams = default; + Optional quotaInfo = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("Etag"u8)) + { + etag = property.Value.GetString(); + continue; + } + if (property.NameEquals("Metrics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DerivedMetricInfo.DeserializeDerivedMetricInfo(item)); + } + metrics = array; + continue; + } + if (property.NameEquals("DocumentStreams"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentStreamInfo.DeserializeDocumentStreamInfo(item)); + } + documentStreams = array; + continue; + } + if (property.NameEquals("QuotaInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + quotaInfo = QuotaConfigurationInfo.DeserializeQuotaConfigurationInfo(property.Value); + continue; + } + } + return new CollectionConfigurationInfo(etag.Value, Optional.ToList(metrics), Optional.ToList(documentStreams), quotaInfo.Value); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationInfo.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationInfo.cs new file mode 100644 index 0000000000000..e231ed3380694 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationInfo.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Represents the collection configuration - a customizable description of performance counters, metrics, and full telemetry documents to be collected by the SDK. + internal partial class CollectionConfigurationInfo + { + /// Initializes a new instance of CollectionConfigurationInfo. + internal CollectionConfigurationInfo() + { + Metrics = new ChangeTrackingList(); + DocumentStreams = new ChangeTrackingList(); + } + + /// Initializes a new instance of CollectionConfigurationInfo. + /// An encoded string that indicates whether the collection configuration is changed. + /// An array of metric configuration info. + /// An array of document stream configuration info. + /// Control document quotas for QuickPulse. + internal CollectionConfigurationInfo(string etag, IReadOnlyList metrics, IReadOnlyList documentStreams, QuotaConfigurationInfo quotaInfo) + { + Etag = etag; + Metrics = metrics; + DocumentStreams = documentStreams; + QuotaInfo = quotaInfo; + } + + /// An encoded string that indicates whether the collection configuration is changed. + public string Etag { get; } + /// An array of metric configuration info. + public IReadOnlyList Metrics { get; } + /// An array of document stream configuration info. + public IReadOnlyList DocumentStreams { get; } + /// Control document quotas for QuickPulse. + public QuotaConfigurationInfo QuotaInfo { get; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DerivedMetricInfo.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DerivedMetricInfo.Serialization.cs new file mode 100644 index 0000000000000..bbd69405810e5 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DerivedMetricInfo.Serialization.cs @@ -0,0 +1,71 @@ +// 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 Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class DerivedMetricInfo + { + internal static DerivedMetricInfo DeserializeDerivedMetricInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional id = default; + Optional telemetryType = default; + Optional> filterGroups = default; + Optional projection = default; + Optional aggregation = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("Id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("TelemetryType"u8)) + { + telemetryType = property.Value.GetString(); + continue; + } + if (property.NameEquals("FilterGroups"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FilterConjunctionGroupInfo.DeserializeFilterConjunctionGroupInfo(item)); + } + filterGroups = array; + continue; + } + if (property.NameEquals("Projection"u8)) + { + projection = property.Value.GetString(); + continue; + } + if (property.NameEquals("Aggregation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + aggregation = new DerivedMetricInfoAggregation(property.Value.GetString()); + continue; + } + } + return new DerivedMetricInfo(id.Value, telemetryType.Value, Optional.ToList(filterGroups), projection.Value, Optional.ToNullable(aggregation)); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DerivedMetricInfo.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DerivedMetricInfo.cs new file mode 100644 index 0000000000000..c82d222d3f9c4 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DerivedMetricInfo.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// A metric configuration set by UX to scope the metrics it's interested in. + internal partial class DerivedMetricInfo + { + /// Initializes a new instance of DerivedMetricInfo. + internal DerivedMetricInfo() + { + FilterGroups = new ChangeTrackingList(); + } + + /// Initializes a new instance of DerivedMetricInfo. + /// metric configuration identifier. + /// Telemetry type. + /// A collection of filters to scope metrics that UX needs. + /// Telemetry's metric dimension whose value is to be aggregated. Example values: Duration, Count(),... + /// Aggregation type. + internal DerivedMetricInfo(string id, string telemetryType, IReadOnlyList filterGroups, string projection, DerivedMetricInfoAggregation? aggregation) + { + Id = id; + TelemetryType = telemetryType; + FilterGroups = filterGroups; + Projection = projection; + Aggregation = aggregation; + } + + /// metric configuration identifier. + public string Id { get; } + /// Telemetry type. + public string TelemetryType { get; } + /// A collection of filters to scope metrics that UX needs. + public IReadOnlyList FilterGroups { get; } + /// Telemetry's metric dimension whose value is to be aggregated. Example values: Duration, Count(),... + public string Projection { get; } + /// Aggregation type. + public DerivedMetricInfoAggregation? Aggregation { get; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DerivedMetricInfoAggregation.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DerivedMetricInfoAggregation.cs new file mode 100644 index 0000000000000..92713bca6f496 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DerivedMetricInfoAggregation.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Aggregation type. + public readonly partial struct DerivedMetricInfoAggregation : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DerivedMetricInfoAggregation(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AvgValue = "Avg"; + private const string SumValue = "Sum"; + private const string MinValue = "Min"; + private const string MaxValue = "Max"; + + /// Avg. + public static DerivedMetricInfoAggregation Avg { get; } = new DerivedMetricInfoAggregation(AvgValue); + /// Sum. + public static DerivedMetricInfoAggregation Sum { get; } = new DerivedMetricInfoAggregation(SumValue); + /// Min. + public static DerivedMetricInfoAggregation Min { get; } = new DerivedMetricInfoAggregation(MinValue); + /// Max. + public static DerivedMetricInfoAggregation Max { get; } = new DerivedMetricInfoAggregation(MaxValue); + /// Determines if two values are the same. + public static bool operator ==(DerivedMetricInfoAggregation left, DerivedMetricInfoAggregation right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DerivedMetricInfoAggregation left, DerivedMetricInfoAggregation right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DerivedMetricInfoAggregation(string value) => new DerivedMetricInfoAggregation(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DerivedMetricInfoAggregation other && Equals(other); + /// + public bool Equals(DerivedMetricInfoAggregation other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentFilterConjunctionGroupInfo.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentFilterConjunctionGroupInfo.Serialization.cs new file mode 100644 index 0000000000000..03bfba4cfc4ae --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentFilterConjunctionGroupInfo.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class DocumentFilterConjunctionGroupInfo + { + internal static DocumentFilterConjunctionGroupInfo DeserializeDocumentFilterConjunctionGroupInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional telemetryType = default; + Optional filters = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("TelemetryType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + telemetryType = new DocumentFilterConjunctionGroupInfoTelemetryType(property.Value.GetString()); + continue; + } + if (property.NameEquals("Filters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + filters = FilterConjunctionGroupInfo.DeserializeFilterConjunctionGroupInfo(property.Value); + continue; + } + } + return new DocumentFilterConjunctionGroupInfo(Optional.ToNullable(telemetryType), filters.Value); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentFilterConjunctionGroupInfo.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentFilterConjunctionGroupInfo.cs new file mode 100644 index 0000000000000..37e7b11ec03cb --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentFilterConjunctionGroupInfo.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// A collection of filters for a specificy telemetry type. + internal partial class DocumentFilterConjunctionGroupInfo + { + /// Initializes a new instance of DocumentFilterConjunctionGroupInfo. + internal DocumentFilterConjunctionGroupInfo() + { + } + + /// Initializes a new instance of DocumentFilterConjunctionGroupInfo. + /// Telemetry type. + /// An AND-connected group of FilterInfo objects. + internal DocumentFilterConjunctionGroupInfo(DocumentFilterConjunctionGroupInfoTelemetryType? telemetryType, FilterConjunctionGroupInfo filters) + { + TelemetryType = telemetryType; + Filters = filters; + } + + /// Telemetry type. + public DocumentFilterConjunctionGroupInfoTelemetryType? TelemetryType { get; } + /// An AND-connected group of FilterInfo objects. + public FilterConjunctionGroupInfo Filters { get; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentFilterConjunctionGroupInfoTelemetryType.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentFilterConjunctionGroupInfoTelemetryType.cs new file mode 100644 index 0000000000000..f63ac090c40ab --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentFilterConjunctionGroupInfoTelemetryType.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Telemetry type. + public readonly partial struct DocumentFilterConjunctionGroupInfoTelemetryType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DocumentFilterConjunctionGroupInfoTelemetryType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string RequestValue = "Request"; + private const string DependencyValue = "Dependency"; + private const string ExceptionValue = "Exception"; + private const string EventValue = "Event"; + private const string MetricValue = "Metric"; + private const string PerformanceCounterValue = "PerformanceCounter"; + private const string TraceValue = "Trace"; + + /// Request. + public static DocumentFilterConjunctionGroupInfoTelemetryType Request { get; } = new DocumentFilterConjunctionGroupInfoTelemetryType(RequestValue); + /// Dependency. + public static DocumentFilterConjunctionGroupInfoTelemetryType Dependency { get; } = new DocumentFilterConjunctionGroupInfoTelemetryType(DependencyValue); + /// Exception. + public static DocumentFilterConjunctionGroupInfoTelemetryType Exception { get; } = new DocumentFilterConjunctionGroupInfoTelemetryType(ExceptionValue); + /// Event. + public static DocumentFilterConjunctionGroupInfoTelemetryType Event { get; } = new DocumentFilterConjunctionGroupInfoTelemetryType(EventValue); + /// Metric. + public static DocumentFilterConjunctionGroupInfoTelemetryType Metric { get; } = new DocumentFilterConjunctionGroupInfoTelemetryType(MetricValue); + /// PerformanceCounter. + public static DocumentFilterConjunctionGroupInfoTelemetryType PerformanceCounter { get; } = new DocumentFilterConjunctionGroupInfoTelemetryType(PerformanceCounterValue); + /// Trace. + public static DocumentFilterConjunctionGroupInfoTelemetryType Trace { get; } = new DocumentFilterConjunctionGroupInfoTelemetryType(TraceValue); + /// Determines if two values are the same. + public static bool operator ==(DocumentFilterConjunctionGroupInfoTelemetryType left, DocumentFilterConjunctionGroupInfoTelemetryType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DocumentFilterConjunctionGroupInfoTelemetryType left, DocumentFilterConjunctionGroupInfoTelemetryType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DocumentFilterConjunctionGroupInfoTelemetryType(string value) => new DocumentFilterConjunctionGroupInfoTelemetryType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DocumentFilterConjunctionGroupInfoTelemetryType other && Equals(other); + /// + public bool Equals(DocumentFilterConjunctionGroupInfoTelemetryType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentIngress.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentIngress.Serialization.cs new file mode 100644 index 0000000000000..79d0a7a9effc3 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentIngress.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class DocumentIngress : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(DocumentType)) + { + writer.WritePropertyName("DocumentType"u8); + writer.WriteStringValue(DocumentType.Value.ToString()); + } + if (Optional.IsCollectionDefined(DocumentStreamIds)) + { + writer.WritePropertyName("DocumentStreamIds"u8); + writer.WriteStartArray(); + foreach (var item in DocumentStreamIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Properties)) + { + writer.WritePropertyName("Properties"u8); + writer.WriteStartArray(); + foreach (var item in Properties) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentIngress.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentIngress.cs new file mode 100644 index 0000000000000..51687e7b5ef98 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentIngress.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Base class of the specific document types. + internal partial class DocumentIngress + { + /// Initializes a new instance of DocumentIngress. + public DocumentIngress() + { + DocumentStreamIds = new ChangeTrackingList(); + Properties = new ChangeTrackingList(); + } + + /// Telemetry type. Types not defined in enum will get replaced with a 'Unknown' type. + public DocumentIngressDocumentType? DocumentType { get; set; } + /// An array of document streaming ids. Each id identifies a flow of documents customized by UX customers. + public IList DocumentStreamIds { get; } + /// Collection of custom properties. + public IList Properties { get; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentIngressDocumentType.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentIngressDocumentType.cs new file mode 100644 index 0000000000000..04c6c0fc1b05c --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentIngressDocumentType.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Telemetry type. Types not defined in enum will get replaced with a 'Unknown' type. + public readonly partial struct DocumentIngressDocumentType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DocumentIngressDocumentType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string RequestValue = "Request"; + private const string RemoteDependencyValue = "RemoteDependency"; + private const string ExceptionValue = "Exception"; + private const string EventValue = "Event"; + private const string TraceValue = "Trace"; + + /// Request. + public static DocumentIngressDocumentType Request { get; } = new DocumentIngressDocumentType(RequestValue); + /// RemoteDependency. + public static DocumentIngressDocumentType RemoteDependency { get; } = new DocumentIngressDocumentType(RemoteDependencyValue); + /// Exception. + public static DocumentIngressDocumentType Exception { get; } = new DocumentIngressDocumentType(ExceptionValue); + /// Event. + public static DocumentIngressDocumentType Event { get; } = new DocumentIngressDocumentType(EventValue); + /// Trace. + public static DocumentIngressDocumentType Trace { get; } = new DocumentIngressDocumentType(TraceValue); + /// Determines if two values are the same. + public static bool operator ==(DocumentIngressDocumentType left, DocumentIngressDocumentType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DocumentIngressDocumentType left, DocumentIngressDocumentType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DocumentIngressDocumentType(string value) => new DocumentIngressDocumentType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DocumentIngressDocumentType other && Equals(other); + /// + public bool Equals(DocumentIngressDocumentType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentStreamInfo.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentStreamInfo.Serialization.cs new file mode 100644 index 0000000000000..1e2b3364f446e --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentStreamInfo.Serialization.cs @@ -0,0 +1,49 @@ +// 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 Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class DocumentStreamInfo + { + internal static DocumentStreamInfo DeserializeDocumentStreamInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional id = default; + Optional> documentFilterGroups = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("Id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("DocumentFilterGroups"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentFilterConjunctionGroupInfo.DeserializeDocumentFilterConjunctionGroupInfo(item)); + } + documentFilterGroups = array; + continue; + } + } + return new DocumentStreamInfo(id.Value, Optional.ToList(documentFilterGroups)); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentStreamInfo.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentStreamInfo.cs new file mode 100644 index 0000000000000..f299b56c1a247 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentStreamInfo.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Configurations/filters set by UX to scope the document/telemetry it's interested in. + internal partial class DocumentStreamInfo + { + /// Initializes a new instance of DocumentStreamInfo. + internal DocumentStreamInfo() + { + DocumentFilterGroups = new ChangeTrackingList(); + } + + /// Initializes a new instance of DocumentStreamInfo. + /// Identifier of the document stream initiated by a UX. + /// Gets or sets an OR-connected collection of filter groups. + internal DocumentStreamInfo(string id, IReadOnlyList documentFilterGroups) + { + Id = id; + DocumentFilterGroups = documentFilterGroups; + } + + /// Identifier of the document stream initiated by a UX. + public string Id { get; } + /// Gets or sets an OR-connected collection of filter groups. + public IReadOnlyList DocumentFilterGroups { get; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/EventDocumentIngress.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/EventDocumentIngress.Serialization.cs new file mode 100644 index 0000000000000..cefd2718c8921 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/EventDocumentIngress.Serialization.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class EventDocumentIngress : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("Name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DocumentType)) + { + writer.WritePropertyName("DocumentType"u8); + writer.WriteStringValue(DocumentType.Value.ToString()); + } + if (Optional.IsCollectionDefined(DocumentStreamIds)) + { + writer.WritePropertyName("DocumentStreamIds"u8); + writer.WriteStartArray(); + foreach (var item in DocumentStreamIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Properties)) + { + writer.WritePropertyName("Properties"u8); + writer.WriteStartArray(); + foreach (var item in Properties) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/EventDocumentIngress.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/EventDocumentIngress.cs new file mode 100644 index 0000000000000..984f14806bf04 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/EventDocumentIngress.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Event type document. + internal partial class EventDocumentIngress : DocumentIngress + { + /// Initializes a new instance of EventDocumentIngress. + public EventDocumentIngress() + { + } + + /// Event name. + public string Name { get; set; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ExceptionDocumentIngress.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ExceptionDocumentIngress.Serialization.cs new file mode 100644 index 0000000000000..faef7728f474a --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ExceptionDocumentIngress.Serialization.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class ExceptionDocumentIngress : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ExceptionType)) + { + writer.WritePropertyName("ExceptionType"u8); + writer.WriteStringValue(ExceptionType); + } + if (Optional.IsDefined(ExceptionMessage)) + { + writer.WritePropertyName("ExceptionMessage"u8); + writer.WriteStringValue(ExceptionMessage); + } + if (Optional.IsDefined(DocumentType)) + { + writer.WritePropertyName("DocumentType"u8); + writer.WriteStringValue(DocumentType.Value.ToString()); + } + if (Optional.IsCollectionDefined(DocumentStreamIds)) + { + writer.WritePropertyName("DocumentStreamIds"u8); + writer.WriteStartArray(); + foreach (var item in DocumentStreamIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Properties)) + { + writer.WritePropertyName("Properties"u8); + writer.WriteStartArray(); + foreach (var item in Properties) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ExceptionDocumentIngress.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ExceptionDocumentIngress.cs new file mode 100644 index 0000000000000..d4a79e61927a3 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ExceptionDocumentIngress.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Exception type document. + internal partial class ExceptionDocumentIngress : DocumentIngress + { + /// Initializes a new instance of ExceptionDocumentIngress. + public ExceptionDocumentIngress() + { + } + + /// Exception type name. + public string ExceptionType { get; set; } + /// Exception message. + public string ExceptionMessage { get; set; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterConjunctionGroupInfo.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterConjunctionGroupInfo.Serialization.cs new file mode 100644 index 0000000000000..807a813562fee --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterConjunctionGroupInfo.Serialization.cs @@ -0,0 +1,43 @@ +// 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 Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class FilterConjunctionGroupInfo + { + internal static FilterConjunctionGroupInfo DeserializeFilterConjunctionGroupInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> filters = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("Filters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FilterInfo.DeserializeFilterInfo(item)); + } + filters = array; + continue; + } + } + return new FilterConjunctionGroupInfo(Optional.ToList(filters)); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterConjunctionGroupInfo.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterConjunctionGroupInfo.cs new file mode 100644 index 0000000000000..964c26f34c636 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterConjunctionGroupInfo.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// An AND-connected group of FilterInfo objects. + internal partial class FilterConjunctionGroupInfo + { + /// Initializes a new instance of FilterConjunctionGroupInfo. + internal FilterConjunctionGroupInfo() + { + Filters = new ChangeTrackingList(); + } + + /// Initializes a new instance of FilterConjunctionGroupInfo. + /// + internal FilterConjunctionGroupInfo(IReadOnlyList filters) + { + Filters = filters; + } + + /// Gets the filters. + public IReadOnlyList Filters { get; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterInfo.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterInfo.Serialization.cs new file mode 100644 index 0000000000000..3189997922c13 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterInfo.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class FilterInfo + { + internal static FilterInfo DeserializeFilterInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional fieldName = default; + Optional predicate = default; + Optional comparand = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("FieldName"u8)) + { + fieldName = property.Value.GetString(); + continue; + } + if (property.NameEquals("Predicate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + predicate = new FilterInfoPredicate(property.Value.GetString()); + continue; + } + if (property.NameEquals("Comparand"u8)) + { + comparand = property.Value.GetString(); + continue; + } + } + return new FilterInfo(fieldName.Value, Optional.ToNullable(predicate), comparand.Value); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterInfo.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterInfo.cs new file mode 100644 index 0000000000000..d2ce94c3d9037 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterInfo.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// A filter set on UX. + internal partial class FilterInfo + { + /// Initializes a new instance of FilterInfo. + internal FilterInfo() + { + } + + /// Initializes a new instance of FilterInfo. + /// dimension name of the filter. + /// Operator of the filter. + /// + internal FilterInfo(string fieldName, FilterInfoPredicate? predicate, string comparand) + { + FieldName = fieldName; + Predicate = predicate; + Comparand = comparand; + } + + /// dimension name of the filter. + public string FieldName { get; } + /// Operator of the filter. + public FilterInfoPredicate? Predicate { get; } + /// Gets the comparand. + public string Comparand { get; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterInfoPredicate.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterInfoPredicate.cs new file mode 100644 index 0000000000000..ee08e533204ab --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterInfoPredicate.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Operator of the filter. + public readonly partial struct FilterInfoPredicate : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FilterInfoPredicate(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EqualValue = "Equal"; + private const string NotEqualValue = "NotEqual"; + private const string LessThanValue = "LessThan"; + private const string GreaterThanValue = "GreaterThan"; + private const string LessThanOrEqualValue = "LessThanOrEqual"; + private const string GreaterThanOrEqualValue = "GreaterThanOrEqual"; + private const string ContainsValue = "Contains"; + private const string DoesNotContainValue = "DoesNotContain"; + + /// Equal. + public static FilterInfoPredicate Equal { get; } = new FilterInfoPredicate(EqualValue); + /// NotEqual. + public static FilterInfoPredicate NotEqual { get; } = new FilterInfoPredicate(NotEqualValue); + /// LessThan. + public static FilterInfoPredicate LessThan { get; } = new FilterInfoPredicate(LessThanValue); + /// GreaterThan. + public static FilterInfoPredicate GreaterThan { get; } = new FilterInfoPredicate(GreaterThanValue); + /// LessThanOrEqual. + public static FilterInfoPredicate LessThanOrEqual { get; } = new FilterInfoPredicate(LessThanOrEqualValue); + /// GreaterThanOrEqual. + public static FilterInfoPredicate GreaterThanOrEqual { get; } = new FilterInfoPredicate(GreaterThanOrEqualValue); + /// Contains. + public static FilterInfoPredicate Contains { get; } = new FilterInfoPredicate(ContainsValue); + /// DoesNotContain. + public static FilterInfoPredicate DoesNotContain { get; } = new FilterInfoPredicate(DoesNotContainValue); + /// Determines if two values are the same. + public static bool operator ==(FilterInfoPredicate left, FilterInfoPredicate right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FilterInfoPredicate left, FilterInfoPredicate right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator FilterInfoPredicate(string value) => new FilterInfoPredicate(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FilterInfoPredicate other && Equals(other); + /// + public bool Equals(FilterInfoPredicate other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/KeyValuePairString.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/KeyValuePairString.Serialization.cs new file mode 100644 index 0000000000000..e1177642fbf1c --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/KeyValuePairString.Serialization.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class KeyValuePairString : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/KeyValuePairString.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/KeyValuePairString.cs new file mode 100644 index 0000000000000..0c44085dcad46 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/KeyValuePairString.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// The KeyValuePairString. + internal partial class KeyValuePairString + { + /// Initializes a new instance of KeyValuePairString. + public KeyValuePairString() + { + } + + /// Gets or sets the key. + public string Key { get; set; } + /// Gets or sets the value. + public string Value { get; set; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MetricPoint.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MetricPoint.Serialization.cs new file mode 100644 index 0000000000000..d1c257968f8d1 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MetricPoint.Serialization.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class MetricPoint : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("Name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("Value"u8); + writer.WriteNumberValue(Value.Value); + } + if (Optional.IsDefined(Weight)) + { + writer.WritePropertyName("Weight"u8); + writer.WriteNumberValue(Weight.Value); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MetricPoint.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MetricPoint.cs new file mode 100644 index 0000000000000..cd738c171aa94 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MetricPoint.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Metric data point. + internal partial class MetricPoint + { + /// Initializes a new instance of MetricPoint. + public MetricPoint() + { + } + + /// Metric name. + public string Name { get; set; } + /// Metric value. + public float? Value { get; set; } + /// Metric weight. + public int? Weight { get; set; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MonitoringDataPoint.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MonitoringDataPoint.Serialization.cs new file mode 100644 index 0000000000000..8d399d3ed7625 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MonitoringDataPoint.Serialization.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class MonitoringDataPoint : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Version)) + { + writer.WritePropertyName("Version"u8); + writer.WriteStringValue(Version); + } + if (Optional.IsDefined(InvariantVersion)) + { + writer.WritePropertyName("InvariantVersion"u8); + writer.WriteNumberValue(InvariantVersion.Value); + } + if (Optional.IsDefined(Instance)) + { + writer.WritePropertyName("Instance"u8); + writer.WriteStringValue(Instance); + } + if (Optional.IsDefined(RoleName)) + { + writer.WritePropertyName("RoleName"u8); + writer.WriteStringValue(RoleName); + } + if (Optional.IsDefined(MachineName)) + { + writer.WritePropertyName("MachineName"u8); + writer.WriteStringValue(MachineName); + } + if (Optional.IsDefined(StreamId)) + { + writer.WritePropertyName("StreamId"u8); + writer.WriteStringValue(StreamId); + } + if (Optional.IsDefined(Timestamp)) + { + writer.WritePropertyName("Timestamp"u8); + writer.WriteStringValue(Timestamp.Value, "O"); + } + if (Optional.IsDefined(TransmissionTime)) + { + writer.WritePropertyName("TransmissionTime"u8); + writer.WriteStringValue(TransmissionTime.Value, "O"); + } + if (Optional.IsDefined(IsWebApp)) + { + writer.WritePropertyName("IsWebApp"u8); + writer.WriteBooleanValue(IsWebApp.Value); + } + if (Optional.IsDefined(PerformanceCollectionSupported)) + { + writer.WritePropertyName("PerformanceCollectionSupported"u8); + writer.WriteBooleanValue(PerformanceCollectionSupported.Value); + } + if (Optional.IsCollectionDefined(Metrics)) + { + writer.WritePropertyName("Metrics"u8); + writer.WriteStartArray(); + foreach (var item in Metrics) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Documents)) + { + writer.WritePropertyName("Documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(TopCpuProcesses)) + { + writer.WritePropertyName("TopCpuProcesses"u8); + writer.WriteStartArray(); + foreach (var item in TopCpuProcesses) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(CollectionConfigurationErrors)) + { + writer.WritePropertyName("CollectionConfigurationErrors"u8); + writer.WriteStartArray(); + foreach (var item in CollectionConfigurationErrors) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MonitoringDataPoint.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MonitoringDataPoint.cs new file mode 100644 index 0000000000000..2ff80f257640e --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MonitoringDataPoint.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Monitoring data point coming from SDK, which includes metrics, documents and other metadata info. + internal partial class MonitoringDataPoint + { + /// Initializes a new instance of MonitoringDataPoint. + public MonitoringDataPoint() + { + Metrics = new ChangeTrackingList(); + Documents = new ChangeTrackingList(); + TopCpuProcesses = new ChangeTrackingList(); + CollectionConfigurationErrors = new ChangeTrackingList(); + } + + /// AI SDK version. + public string Version { get; set; } + /// Version/generation of the data contract (MonitoringDataPoint) between SDK and QuickPulse. + public int? InvariantVersion { get; set; } + /// Service instance name where AI SDK lives. + public string Instance { get; set; } + /// Service role name. + public string RoleName { get; set; } + /// Computer name where AI SDK lives. + public string MachineName { get; set; } + /// Identifies an AI SDK as a trusted agent to report metrics and documents. + public string StreamId { get; set; } + /// Data point generation timestamp. + public DateTimeOffset? Timestamp { get; set; } + /// Timestamp when SDK transmits the metrics and documents to QuickPulse. A 8-byte long type of ticks. + public DateTimeOffset? TransmissionTime { get; set; } + /// True if the current application is an Azure Web App. + public bool? IsWebApp { get; set; } + /// True if performance counters collection is supported. + public bool? PerformanceCollectionSupported { get; set; } + /// An array of meric data points. + public IList Metrics { get; } + /// An array of documents of a specific type {RequestDocumentIngress}, {RemoteDependencyDocumentIngress}, {ExceptionDocumentIngress}, {EventDocumentIngress}, or {TraceDocumentIngress}. + public IList Documents { get; } + /// An array of top cpu consumption data point. + public IList TopCpuProcesses { get; } + /// An array of error while parsing and applying . + public IList CollectionConfigurationErrors { get; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ProcessCpuData.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ProcessCpuData.Serialization.cs new file mode 100644 index 0000000000000..bb67299131319 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ProcessCpuData.Serialization.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class ProcessCpuData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ProcessName)) + { + writer.WritePropertyName("ProcessName"u8); + writer.WriteStringValue(ProcessName); + } + if (Optional.IsDefined(CpuPercentage)) + { + writer.WritePropertyName("CpuPercentage"u8); + writer.WriteNumberValue(CpuPercentage.Value); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ProcessCpuData.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ProcessCpuData.cs new file mode 100644 index 0000000000000..af92288abe385 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ProcessCpuData.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// CPU consumption datapoint. + internal partial class ProcessCpuData + { + /// Initializes a new instance of ProcessCpuData. + public ProcessCpuData() + { + } + + /// Process name. + public string ProcessName { get; set; } + /// CPU consumption percentage. + public int? CpuPercentage { get; set; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/QuotaConfigurationInfo.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/QuotaConfigurationInfo.Serialization.cs new file mode 100644 index 0000000000000..fc0a47b73cf07 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/QuotaConfigurationInfo.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class QuotaConfigurationInfo + { + internal static QuotaConfigurationInfo DeserializeQuotaConfigurationInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional initialQuota = default; + float maxQuota = default; + float quotaAccrualRatePerSec = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("InitialQuota"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + initialQuota = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("MaxQuota"u8)) + { + maxQuota = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("QuotaAccrualRatePerSec"u8)) + { + quotaAccrualRatePerSec = property.Value.GetSingle(); + continue; + } + } + return new QuotaConfigurationInfo(Optional.ToNullable(initialQuota), maxQuota, quotaAccrualRatePerSec); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/QuotaConfigurationInfo.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/QuotaConfigurationInfo.cs new file mode 100644 index 0000000000000..526dc740a8f8a --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/QuotaConfigurationInfo.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Control document quotas for QuickPulse. + internal partial class QuotaConfigurationInfo + { + /// Initializes a new instance of QuotaConfigurationInfo. + /// Max quota. + /// Quota accrual rate per second. + internal QuotaConfigurationInfo(float maxQuota, float quotaAccrualRatePerSec) + { + MaxQuota = maxQuota; + QuotaAccrualRatePerSec = quotaAccrualRatePerSec; + } + + /// Initializes a new instance of QuotaConfigurationInfo. + /// Initial quota. + /// Max quota. + /// Quota accrual rate per second. + internal QuotaConfigurationInfo(float? initialQuota, float maxQuota, float quotaAccrualRatePerSec) + { + InitialQuota = initialQuota; + MaxQuota = maxQuota; + QuotaAccrualRatePerSec = quotaAccrualRatePerSec; + } + + /// Initial quota. + public float? InitialQuota { get; } + /// Max quota. + public float MaxQuota { get; } + /// Quota accrual rate per second. + public float QuotaAccrualRatePerSec { get; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RemoteDependencyDocumentIngress.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RemoteDependencyDocumentIngress.Serialization.cs new file mode 100644 index 0000000000000..3c8e1df58ac13 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RemoteDependencyDocumentIngress.Serialization.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class RemoteDependencyDocumentIngress : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("Name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(CommandName)) + { + writer.WritePropertyName("CommandName"u8); + writer.WriteStringValue(CommandName); + } + if (Optional.IsDefined(ResultCode)) + { + writer.WritePropertyName("ResultCode"u8); + writer.WriteStringValue(ResultCode); + } + if (Optional.IsDefined(Duration)) + { + writer.WritePropertyName("Duration"u8); + writer.WriteStringValue(Duration); + } + if (Optional.IsDefined(DocumentType)) + { + writer.WritePropertyName("DocumentType"u8); + writer.WriteStringValue(DocumentType.Value.ToString()); + } + if (Optional.IsCollectionDefined(DocumentStreamIds)) + { + writer.WritePropertyName("DocumentStreamIds"u8); + writer.WriteStartArray(); + foreach (var item in DocumentStreamIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Properties)) + { + writer.WritePropertyName("Properties"u8); + writer.WriteStartArray(); + foreach (var item in Properties) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RemoteDependencyDocumentIngress.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RemoteDependencyDocumentIngress.cs new file mode 100644 index 0000000000000..97f4539bbc186 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RemoteDependencyDocumentIngress.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Dependency type document. + internal partial class RemoteDependencyDocumentIngress : DocumentIngress + { + /// Initializes a new instance of RemoteDependencyDocumentIngress. + public RemoteDependencyDocumentIngress() + { + } + + /// Name of the command initiated with this dependency call, e.g., GET /username. + public string Name { get; set; } + /// URL of the dependency call to the target, with all query string parameters. + public string CommandName { get; set; } + /// Result code of a dependency call. Examples are SQL error code and HTTP status code. + public string ResultCode { get; set; } + /// Request duration in ISO 8601 duration format, i.e., P[n]Y[n]M[n]DT[n]H[n]M[n]S or P[n]W. + public string Duration { get; set; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RequestDocumentIngress.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RequestDocumentIngress.Serialization.cs new file mode 100644 index 0000000000000..d093befddf43e --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RequestDocumentIngress.Serialization.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class RequestDocumentIngress : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("Name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Url)) + { + writer.WritePropertyName("Url"u8); + writer.WriteStringValue(Url); + } + if (Optional.IsDefined(ResponseCode)) + { + writer.WritePropertyName("ResponseCode"u8); + writer.WriteStringValue(ResponseCode); + } + if (Optional.IsDefined(Duration)) + { + writer.WritePropertyName("Duration"u8); + writer.WriteStringValue(Duration); + } + if (Optional.IsDefined(DocumentType)) + { + writer.WritePropertyName("DocumentType"u8); + writer.WriteStringValue(DocumentType.Value.ToString()); + } + if (Optional.IsCollectionDefined(DocumentStreamIds)) + { + writer.WritePropertyName("DocumentStreamIds"u8); + writer.WriteStartArray(); + foreach (var item in DocumentStreamIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Properties)) + { + writer.WritePropertyName("Properties"u8); + writer.WriteStartArray(); + foreach (var item in Properties) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RequestDocumentIngress.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RequestDocumentIngress.cs new file mode 100644 index 0000000000000..0c445fbc529a1 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RequestDocumentIngress.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Request type document. + internal partial class RequestDocumentIngress : DocumentIngress + { + /// Initializes a new instance of RequestDocumentIngress. + public RequestDocumentIngress() + { + } + + /// Name of the request, e.g., 'GET /values/{id}'. + public string Name { get; set; } + /// Request URL with all query string parameters. + public string Url { get; set; } + /// Result of a request execution. For http requestss, it could be some HTTP status code. + public string ResponseCode { get; set; } + /// Request duration in ISO 8601 duration format, i.e., P[n]Y[n]M[n]DT[n]H[n]M[n]S or P[n]W. + public string Duration { get; set; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ServiceError.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ServiceError.Serialization.cs new file mode 100644 index 0000000000000..71737f1794ee1 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ServiceError.Serialization.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class ServiceError + { + internal static ServiceError DeserializeServiceError(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional requestId = default; + Optional responseDateTime = default; + Optional code = default; + Optional message = default; + Optional exception = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("RequestId"u8)) + { + requestId = property.Value.GetString(); + continue; + } + if (property.NameEquals("ResponseDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + responseDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("Code"u8)) + { + code = property.Value.GetString(); + continue; + } + if (property.NameEquals("Message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("Exception"u8)) + { + exception = property.Value.GetString(); + continue; + } + } + return new ServiceError(requestId.Value, Optional.ToNullable(responseDateTime), code.Value, message.Value, exception.Value); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ServiceError.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ServiceError.cs new file mode 100644 index 0000000000000..68a11a28f53e9 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ServiceError.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Optional http response body, whose existance carries additional error descriptions. + internal partial class ServiceError + { + /// Initializes a new instance of ServiceError. + internal ServiceError() + { + } + + /// Initializes a new instance of ServiceError. + /// A guid of the request that triggers the service error. + /// Service error response date time. + /// Error code. + /// Error message. + /// Message of the exception that triggers the error response. + internal ServiceError(string requestId, DateTimeOffset? responseDateTime, string code, string message, string exception) + { + RequestId = requestId; + ResponseDateTime = responseDateTime; + Code = code; + Message = message; + Exception = exception; + } + + /// A guid of the request that triggers the service error. + public string RequestId { get; } + /// Service error response date time. + public DateTimeOffset? ResponseDateTime { get; } + /// Error code. + public string Code { get; } + /// Error message. + public string Message { get; } + /// Message of the exception that triggers the error response. + public string Exception { get; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/TraceDocumentIngress.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/TraceDocumentIngress.Serialization.cs new file mode 100644 index 0000000000000..3e1f93e02034d --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/TraceDocumentIngress.Serialization.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class TraceDocumentIngress : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("Message"u8); + writer.WriteStringValue(Message); + } + if (Optional.IsDefined(DocumentType)) + { + writer.WritePropertyName("DocumentType"u8); + writer.WriteStringValue(DocumentType.Value.ToString()); + } + if (Optional.IsCollectionDefined(DocumentStreamIds)) + { + writer.WritePropertyName("DocumentStreamIds"u8); + writer.WriteStartArray(); + foreach (var item in DocumentStreamIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Properties)) + { + writer.WritePropertyName("Properties"u8); + writer.WriteStartArray(); + foreach (var item in Properties) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/TraceDocumentIngress.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/TraceDocumentIngress.cs new file mode 100644 index 0000000000000..04e901241dc27 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/TraceDocumentIngress.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Trace type name. + internal partial class TraceDocumentIngress : DocumentIngress + { + /// Initializes a new instance of TraceDocumentIngress. + public TraceDocumentIngress() + { + } + + /// Trace message. + public string Message { get; set; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/QuickPulseSDKClientAPIsPingHeaders.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/QuickPulseSDKClientAPIsPingHeaders.cs new file mode 100644 index 0000000000000..f957e91c10208 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/QuickPulseSDKClientAPIsPingHeaders.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics +{ + internal partial class QuickPulseSDKClientAPIsPingHeaders + { + private readonly Response _response; + public QuickPulseSDKClientAPIsPingHeaders(Response response) + { + _response = response; + } + /// A boolean flag indicating whether there are active user sessions 'watching' the SDK's ikey. If true, SDK must start collecting data and post'ing it to QuickPulse. Otherwise, SDK must keep ping'ing. + public string XMsQpsSubscribed => _response.Headers.TryGetValue("x-ms-qps-subscribed", out string value) ? value : null; + /// An encoded string that indicates whether the collection configuration is changed. + public string XMsQpsConfigurationEtag => _response.Headers.TryGetValue("x-ms-qps-configuration-etag", out string value) ? value : null; + /// Recommended time (in milliseconds) before an SDK should ping the service again. This header exists only when ikey is not watched by UX. + public int? XMsQpsServicePollingIntervalHint => _response.Headers.TryGetValue("x-ms-qps-service-polling-interval-hint", out int? value) ? value : null; + /// Contains a URI of the service endpoint that an SDK must permanently use for the particular resource. This header exists only when SDK is talking to QuickPulse's global endpoint. + public string XMsQpsServiceEndpointRedirectV2 => _response.Headers.TryGetValue("x-ms-qps-service-endpoint-redirect-v2", out string value) ? value : null; + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/QuickPulseSDKClientAPIsPostHeaders.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/QuickPulseSDKClientAPIsPostHeaders.cs new file mode 100644 index 0000000000000..3cfb5c570bcb2 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/QuickPulseSDKClientAPIsPostHeaders.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics +{ + internal partial class QuickPulseSDKClientAPIsPostHeaders + { + private readonly Response _response; + public QuickPulseSDKClientAPIsPostHeaders(Response response) + { + _response = response; + } + /// Tells SDK whether the input ikey is subscribed to by UX. + public string XMsQpsSubscribed => _response.Headers.TryGetValue("x-ms-qps-subscribed", out string value) ? value : null; + /// An encoded string that indicates whether the collection configuration is changed. + public string XMsQpsConfigurationEtag => _response.Headers.TryGetValue("x-ms-qps-configuration-etag", out string value) ? value : null; + /// A 8-byte long type of milliseconds QuickPulse suggests SDK polling period. + public int? XMsQpsServicePollingIntervalHint => _response.Headers.TryGetValue("x-ms-qps-service-polling-interval-hint", out int? value) ? value : null; + /// All official SDKs now uses v2 header. Use v2 instead. + public string XMsQpsServiceEndpointRedirect => _response.Headers.TryGetValue("x-ms-qps-service-endpoint-redirect", out string value) ? value : null; + /// URI of the service endpoint that an SDK must permanently use for the particular resource. + public string XMsQpsServiceEndpointRedirectV2 => _response.Headers.TryGetValue("x-ms-qps-service-endpoint-redirect-v2", out string value) ? value : null; + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/QuickPulseSDKClientAPIsRestClient.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/QuickPulseSDKClientAPIsRestClient.cs new file mode 100644 index 0000000000000..67635f0abd525 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/QuickPulseSDKClientAPIsRestClient.cs @@ -0,0 +1,317 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.Monitor.OpenTelemetry.LiveMetrics.Models; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics +{ + internal partial class QuickPulseSDKClientAPIsRestClient + { + private readonly HttpPipeline _pipeline; + private readonly string _host; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// Initializes a new instance of QuickPulseSDKClientAPIsRestClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// QuickPulse endpoint: https://rt.services.visualstudio.com. The default value is "https://rt.services.visualstudio.com". + /// , or is null. + public QuickPulseSDKClientAPIsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string host) + { + ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _host = host ?? throw new ArgumentNullException(nameof(host)); + } + + internal HttpMessage CreatePingRequest(string ikey, string apikey, int? xMsQpsTransmissionTime, string xMsQpsMachineName, string xMsQpsInstanceName, string xMsQpsStreamId, string xMsQpsRoleName, string xMsQpsInvariantVersion, string xMsQpsConfigurationEtag, MonitoringDataPoint monitoringDataPoint) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw(_host, false); + uri.AppendPath("/QuickPulseService.svc/ping", false); + uri.AppendQuery("ikey", ikey, true); + if (apikey != null) + { + uri.AppendQuery("apikey", apikey, true); + } + request.Uri = uri; + if (xMsQpsTransmissionTime != null) + { + request.Headers.Add("x-ms-qps-transmission-time", xMsQpsTransmissionTime.Value); + } + if (xMsQpsMachineName != null) + { + request.Headers.Add("x-ms-qps-machine-name", xMsQpsMachineName); + } + if (xMsQpsInstanceName != null) + { + request.Headers.Add("x-ms-qps-instance-name", xMsQpsInstanceName); + } + if (xMsQpsStreamId != null) + { + request.Headers.Add("x-ms-qps-stream-id", xMsQpsStreamId); + } + if (xMsQpsRoleName != null) + { + request.Headers.Add("x-ms-qps-role-name", xMsQpsRoleName); + } + if (xMsQpsInvariantVersion != null) + { + request.Headers.Add("x-ms-qps-invariant-version", xMsQpsInvariantVersion); + } + if (xMsQpsConfigurationEtag != null) + { + request.Headers.Add("x-ms-qps-configuration-etag", xMsQpsConfigurationEtag); + } + request.Headers.Add("Accept", "application/json"); + if (monitoringDataPoint != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(monitoringDataPoint); + request.Content = content; + } + return message; + } + + /// SDK ping. + /// The ikey of the target Application Insights component that displays server info sent by /QuickPulseService.svc/ping. + /// Deprecated. An alternative way to pass api key. Use AAD auth instead. + /// Timestamp when SDK transmits the metrics and documents to QuickPulse. A 8-byte long type of ticks. + /// Computer name where AI SDK lives. QuickPulse uses machine name with instance name as a backup. + /// Service instance name where AI SDK lives. QuickPulse uses machine name with instance name as a backup. + /// Identifies an AI SDK as trusted agent to report metrics and documents. + /// Cloud role name for which SDK reports metrics and documents. + /// Version/generation of the data contract (MonitoringDataPoint) between SDK and QuickPulse. + /// An encoded string that indicates whether the collection configuration is changed. + /// Data contract between SDK and QuickPulse. /QuickPulseService.svc/ping uses this as a backup source of machine name, instance name and invariant version. + /// The cancellation token to use. + /// is null. + public async Task> PingAsync(string ikey, string apikey = null, int? xMsQpsTransmissionTime = null, string xMsQpsMachineName = null, string xMsQpsInstanceName = null, string xMsQpsStreamId = null, string xMsQpsRoleName = null, string xMsQpsInvariantVersion = null, string xMsQpsConfigurationEtag = null, MonitoringDataPoint monitoringDataPoint = null, CancellationToken cancellationToken = default) + { + if (ikey == null) + { + throw new ArgumentNullException(nameof(ikey)); + } + + using var message = CreatePingRequest(ikey, apikey, xMsQpsTransmissionTime, xMsQpsMachineName, xMsQpsInstanceName, xMsQpsStreamId, xMsQpsRoleName, xMsQpsInvariantVersion, xMsQpsConfigurationEtag, monitoringDataPoint); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new QuickPulseSDKClientAPIsPingHeaders(message.Response); + switch (message.Response.Status) + { + case 200: + { + CollectionConfigurationInfo value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = CollectionConfigurationInfo.DeserializeCollectionConfigurationInfo(document.RootElement); + return ResponseWithHeaders.FromValue(value, headers, message.Response); + } + case 400: + case 401: + case 403: + case 404: + case 500: + case 503: + { + ServiceError value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServiceError.DeserializeServiceError(document.RootElement); + return ResponseWithHeaders.FromValue(value, headers, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// SDK ping. + /// The ikey of the target Application Insights component that displays server info sent by /QuickPulseService.svc/ping. + /// Deprecated. An alternative way to pass api key. Use AAD auth instead. + /// Timestamp when SDK transmits the metrics and documents to QuickPulse. A 8-byte long type of ticks. + /// Computer name where AI SDK lives. QuickPulse uses machine name with instance name as a backup. + /// Service instance name where AI SDK lives. QuickPulse uses machine name with instance name as a backup. + /// Identifies an AI SDK as trusted agent to report metrics and documents. + /// Cloud role name for which SDK reports metrics and documents. + /// Version/generation of the data contract (MonitoringDataPoint) between SDK and QuickPulse. + /// An encoded string that indicates whether the collection configuration is changed. + /// Data contract between SDK and QuickPulse. /QuickPulseService.svc/ping uses this as a backup source of machine name, instance name and invariant version. + /// The cancellation token to use. + /// is null. + public ResponseWithHeaders Ping(string ikey, string apikey = null, int? xMsQpsTransmissionTime = null, string xMsQpsMachineName = null, string xMsQpsInstanceName = null, string xMsQpsStreamId = null, string xMsQpsRoleName = null, string xMsQpsInvariantVersion = null, string xMsQpsConfigurationEtag = null, MonitoringDataPoint monitoringDataPoint = null, CancellationToken cancellationToken = default) + { + if (ikey == null) + { + throw new ArgumentNullException(nameof(ikey)); + } + + using var message = CreatePingRequest(ikey, apikey, xMsQpsTransmissionTime, xMsQpsMachineName, xMsQpsInstanceName, xMsQpsStreamId, xMsQpsRoleName, xMsQpsInvariantVersion, xMsQpsConfigurationEtag, monitoringDataPoint); + _pipeline.Send(message, cancellationToken); + var headers = new QuickPulseSDKClientAPIsPingHeaders(message.Response); + switch (message.Response.Status) + { + case 200: + { + CollectionConfigurationInfo value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = CollectionConfigurationInfo.DeserializeCollectionConfigurationInfo(document.RootElement); + return ResponseWithHeaders.FromValue(value, headers, message.Response); + } + case 400: + case 401: + case 403: + case 404: + case 500: + case 503: + { + ServiceError value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServiceError.DeserializeServiceError(document.RootElement); + return ResponseWithHeaders.FromValue(value, headers, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreatePostRequest(string ikey, string apikey, string xMsQpsConfigurationEtag, int? xMsQpsTransmissionTime, IEnumerable monitoringDataPoints) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw(_host, false); + uri.AppendPath("/QuickPulseService.svc/post", false); + uri.AppendQuery("ikey", ikey, true); + if (apikey != null) + { + uri.AppendQuery("apikey", apikey, true); + } + request.Uri = uri; + if (xMsQpsConfigurationEtag != null) + { + request.Headers.Add("x-ms-qps-configuration-etag", xMsQpsConfigurationEtag); + } + if (xMsQpsTransmissionTime != null) + { + request.Headers.Add("x-ms-qps-transmission-time", xMsQpsTransmissionTime.Value); + } + request.Headers.Add("Accept", "application/json"); + if (monitoringDataPoints != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteStartArray(); + foreach (var item in monitoringDataPoints) + { + content.JsonWriter.WriteObjectValue(item); + } + content.JsonWriter.WriteEndArray(); + request.Content = content; + } + return message; + } + + /// SDK post. + /// The ikey of the target Application Insights component that displays metrics and documents sent by /QuickPulseService.svc/post. + /// An alternative way to pass api key. Deprecated. Use AAD authentication instead. + /// An encoded string that indicates whether the collection configuration is changed. + /// Timestamp when SDK transmits the metrics and documents to QuickPulse. A 8-byte long type of ticks. + /// Data contract between SDK and QuickPulse. /QuickPulseService.svc/post uses this to publish metrics and documents to the backend QuickPulse server. + /// The cancellation token to use. + /// is null. + public async Task> PostAsync(string ikey, string apikey = null, string xMsQpsConfigurationEtag = null, int? xMsQpsTransmissionTime = null, IEnumerable monitoringDataPoints = null, CancellationToken cancellationToken = default) + { + if (ikey == null) + { + throw new ArgumentNullException(nameof(ikey)); + } + + using var message = CreatePostRequest(ikey, apikey, xMsQpsConfigurationEtag, xMsQpsTransmissionTime, monitoringDataPoints); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new QuickPulseSDKClientAPIsPostHeaders(message.Response); + switch (message.Response.Status) + { + case 200: + { + CollectionConfigurationInfo value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = CollectionConfigurationInfo.DeserializeCollectionConfigurationInfo(document.RootElement); + return ResponseWithHeaders.FromValue(value, headers, message.Response); + } + case 400: + case 401: + case 403: + case 404: + case 500: + case 503: + { + ServiceError value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServiceError.DeserializeServiceError(document.RootElement); + return ResponseWithHeaders.FromValue(value, headers, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// SDK post. + /// The ikey of the target Application Insights component that displays metrics and documents sent by /QuickPulseService.svc/post. + /// An alternative way to pass api key. Deprecated. Use AAD authentication instead. + /// An encoded string that indicates whether the collection configuration is changed. + /// Timestamp when SDK transmits the metrics and documents to QuickPulse. A 8-byte long type of ticks. + /// Data contract between SDK and QuickPulse. /QuickPulseService.svc/post uses this to publish metrics and documents to the backend QuickPulse server. + /// The cancellation token to use. + /// is null. + public ResponseWithHeaders Post(string ikey, string apikey = null, string xMsQpsConfigurationEtag = null, int? xMsQpsTransmissionTime = null, IEnumerable monitoringDataPoints = null, CancellationToken cancellationToken = default) + { + if (ikey == null) + { + throw new ArgumentNullException(nameof(ikey)); + } + + using var message = CreatePostRequest(ikey, apikey, xMsQpsConfigurationEtag, xMsQpsTransmissionTime, monitoringDataPoints); + _pipeline.Send(message, cancellationToken); + var headers = new QuickPulseSDKClientAPIsPostHeaders(message.Response); + switch (message.Response.Status) + { + case 200: + { + CollectionConfigurationInfo value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = CollectionConfigurationInfo.DeserializeCollectionConfigurationInfo(document.RootElement); + return ResponseWithHeaders.FromValue(value, headers, message.Response); + } + case 400: + case 401: + case 403: + case 404: + case 500: + case 503: + { + ServiceError value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServiceError.DeserializeServiceError(document.RootElement); + return ResponseWithHeaders.FromValue(value, headers, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/autorest.md b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/autorest.md new file mode 100644 index 0000000000000..c999fae32e5f7 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/autorest.md @@ -0,0 +1,17 @@ +# Generated code configuration + +Run `dotnet build /t:GenerateCode` to generate code. + +``` yaml +input-file: + - https://quickpulsespecs.blob.core.windows.net/specs/swagger-v2-for%20sdk%20only.json. +generation1-convenience-client: true +``` + +``` yaml +directive: +- from: swagger-document + where: $.definitions.* + transform: > + $["x-accessibility"]="internal" +``` diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.sln b/sdk/monitor/Azure.Monitor.OpenTelemetry.sln index e44b61ad022d8..dad63c76642e5 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.sln +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.sln @@ -52,6 +52,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core", "..\core\Azure EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Monitor.OpenTelemetry.Exporter.AotCompatibilityTestApp", "Azure.Monitor.OpenTelemetry.Exporter\tests\Azure.Monitor.OpenTelemetry.Exporter.AotCompatibilityTestApp\Azure.Monitor.OpenTelemetry.Exporter.AotCompatibilityTestApp.csproj", "{D2174A00-93CF-4337-8600-4CE758C7D4AC}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Monitor.OpenTelemetry.LiveMetrics", "Azure.Monitor.OpenTelemetry.LiveMetrics\src\Azure.Monitor.OpenTelemetry.LiveMetrics.csproj", "{C13C8648-2B37-4334-97DC-322344E8EE8C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -114,6 +116,10 @@ Global {D2174A00-93CF-4337-8600-4CE758C7D4AC}.Debug|Any CPU.Build.0 = Debug|Any CPU {D2174A00-93CF-4337-8600-4CE758C7D4AC}.Release|Any CPU.ActiveCfg = Release|Any CPU {D2174A00-93CF-4337-8600-4CE758C7D4AC}.Release|Any CPU.Build.0 = Release|Any CPU + {C13C8648-2B37-4334-97DC-322344E8EE8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C13C8648-2B37-4334-97DC-322344E8EE8C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C13C8648-2B37-4334-97DC-322344E8EE8C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C13C8648-2B37-4334-97DC-322344E8EE8C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/sdk/monitor/ci.yml b/sdk/monitor/ci.yml index 8ec6766f9e41d..1b6e0860d7711 100644 --- a/sdk/monitor/ci.yml +++ b/sdk/monitor/ci.yml @@ -13,6 +13,7 @@ trigger: - sdk/monitor/service.projects - sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore - sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter + - sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics - sdk/monitor/Azure.Monitor.Query - sdk/monitor/Azure.Monitor.Ingestion @@ -29,6 +30,7 @@ pr: - sdk/monitor/service.projects - sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore - sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter + - sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics - sdk/monitor/Azure.Monitor.Query - sdk/monitor/Azure.Monitor.Ingestion @@ -43,6 +45,8 @@ extends: safeName: AzureMonitorOpenTelemetryAspNetCore - name: Azure.Monitor.OpenTelemetry.Exporter safeName: AzureMonitorOpenTelemetryExporter + - name: Azure.Monitor.OpenTelemetry.LiveMetrics + safeName: AzureMonitorOpenTelemetryLiveMetrics - name: Azure.Monitor.Query safeName: AzureMonitorQuery - name: Azure.Monitor.Ingestion