|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Text.Json.Serialization;
using Aspire.Otlp.Serialization;
namespace Aspire.Dashboard.Otlp.Model.Serialization;
/// <summary>
/// Represents the combined telemetry data in OTLP JSON format.
/// This type can contain logs, traces, and/or metrics data.
/// </summary>
internal sealed class OtlpTelemetryDataJson
{
/// <summary>
/// An array of ResourceSpans.
/// </summary>
[JsonPropertyName("resourceSpans")]
public OtlpResourceSpansJson[]? ResourceSpans { get; set; }
/// <summary>
/// An array of ResourceLogs.
/// </summary>
[JsonPropertyName("resourceLogs")]
public OtlpResourceLogsJson[]? ResourceLogs { get; set; }
/// <summary>
/// An array of ResourceMetrics.
/// </summary>
[JsonPropertyName("resourceMetrics")]
public OtlpResourceMetricsJson[]? ResourceMetrics { get; set; }
}
/// <summary>
/// Represents the export trace service response.
/// </summary>
internal sealed class OtlpExportTraceServiceResponseJson
{
/// <summary>
/// The details of a partially successful export request.
/// </summary>
[JsonPropertyName("partialSuccess")]
public OtlpExportTracePartialSuccessJson? PartialSuccess { get; set; }
}
/// <summary>
/// Represents partial success information for trace export.
/// </summary>
internal sealed class OtlpExportTracePartialSuccessJson
{
/// <summary>
/// The number of rejected spans. Serialized as string per protojson spec for int64.
/// </summary>
[JsonPropertyName("rejectedSpans")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
[JsonNumberHandling(JsonNumberHandling.WriteAsString | JsonNumberHandling.AllowReadingFromString)]
public long RejectedSpans { get; set; }
/// <summary>
/// A developer-facing human-readable error message.
/// </summary>
[JsonPropertyName("errorMessage")]
public string? ErrorMessage { get; set; }
}
/// <summary>
/// Represents the export logs service response.
/// </summary>
internal sealed class OtlpExportLogsServiceResponseJson
{
/// <summary>
/// The details of a partially successful export request.
/// </summary>
[JsonPropertyName("partialSuccess")]
public OtlpExportLogsPartialSuccessJson? PartialSuccess { get; set; }
}
/// <summary>
/// Represents partial success information for logs export.
/// </summary>
internal sealed class OtlpExportLogsPartialSuccessJson
{
/// <summary>
/// The number of rejected log records. Serialized as string per protojson spec for int64.
/// </summary>
[JsonPropertyName("rejectedLogRecords")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
[JsonNumberHandling(JsonNumberHandling.WriteAsString | JsonNumberHandling.AllowReadingFromString)]
public long RejectedLogRecords { get; set; }
/// <summary>
/// A developer-facing human-readable error message.
/// </summary>
[JsonPropertyName("errorMessage")]
public string? ErrorMessage { get; set; }
}
|