Update OpenTelemetry protos to v0.16.0 (#3160)
* Update proto files to v0.16.0 * Replace InstrumentationLibrary with InstrumentationScope * Add TODO * Update changelog Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
This commit is contained in:
parent
ef92479506
commit
40b779cea6
|
|
@ -2,6 +2,13 @@
|
|||
|
||||
## Unreleased
|
||||
|
||||
* Updated underlying proto files to
|
||||
[v0.16.0](https://github.com/open-telemetry/opentelemetry-proto/releases/tag/v0.16.0).
|
||||
The LogRecord.Name field was removed. The CategoryName provided
|
||||
when calling CreateLogger previously populated this field. For now,
|
||||
CategoryName is no longer exported via OTLP. It will be reintroduced
|
||||
in the future as an attribute.
|
||||
|
||||
## 1.2.0-rc4
|
||||
|
||||
Released 2022-Mar-30
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation
|
|||
{
|
||||
internal static class ActivityExtensions
|
||||
{
|
||||
private static readonly ConcurrentBag<OtlpTrace.InstrumentationLibrarySpans> SpanListPool = new();
|
||||
private static readonly ConcurrentBag<OtlpTrace.ScopeSpans> SpanListPool = new();
|
||||
private static readonly Action<RepeatedField<OtlpTrace.Span>, int> RepeatedFieldOfSpanSetCountAction = CreateRepeatedFieldOfSpanSetCountAction();
|
||||
|
||||
internal static void AddBatch(
|
||||
|
|
@ -43,7 +43,7 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation
|
|||
OtlpResource.Resource processResource,
|
||||
in Batch<Activity> activityBatch)
|
||||
{
|
||||
Dictionary<string, OtlpTrace.InstrumentationLibrarySpans> spansByLibrary = new Dictionary<string, OtlpTrace.InstrumentationLibrarySpans>();
|
||||
Dictionary<string, OtlpTrace.ScopeSpans> spansByLibrary = new Dictionary<string, OtlpTrace.ScopeSpans>();
|
||||
OtlpTrace.ResourceSpans resourceSpans = new OtlpTrace.ResourceSpans
|
||||
{
|
||||
Resource = processResource,
|
||||
|
|
@ -67,7 +67,7 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation
|
|||
spans = GetSpanListFromPool(activitySourceName, activity.Source.Version);
|
||||
|
||||
spansByLibrary.Add(activitySourceName, spans);
|
||||
resourceSpans.InstrumentationLibrarySpans.Add(spans);
|
||||
resourceSpans.ScopeSpans.Add(spans);
|
||||
}
|
||||
|
||||
spans.Spans.Add(span);
|
||||
|
|
@ -83,21 +83,21 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation
|
|||
return;
|
||||
}
|
||||
|
||||
foreach (var librarySpans in resourceSpans.InstrumentationLibrarySpans)
|
||||
foreach (var scope in resourceSpans.ScopeSpans)
|
||||
{
|
||||
RepeatedFieldOfSpanSetCountAction(librarySpans.Spans, 0);
|
||||
SpanListPool.Add(librarySpans);
|
||||
RepeatedFieldOfSpanSetCountAction(scope.Spans, 0);
|
||||
SpanListPool.Add(scope);
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static OtlpTrace.InstrumentationLibrarySpans GetSpanListFromPool(string name, string version)
|
||||
internal static OtlpTrace.ScopeSpans GetSpanListFromPool(string name, string version)
|
||||
{
|
||||
if (!SpanListPool.TryTake(out var spans))
|
||||
{
|
||||
spans = new OtlpTrace.InstrumentationLibrarySpans
|
||||
spans = new OtlpTrace.ScopeSpans
|
||||
{
|
||||
InstrumentationLibrary = new OtlpCommon.InstrumentationLibrary
|
||||
Scope = new OtlpCommon.InstrumentationScope
|
||||
{
|
||||
Name = name, // Name is enforced to not be null, but it can be empty.
|
||||
Version = version ?? string.Empty, // NRE throw by proto
|
||||
|
|
@ -106,8 +106,8 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation
|
|||
}
|
||||
else
|
||||
{
|
||||
spans.InstrumentationLibrary.Name = name;
|
||||
spans.InstrumentationLibrary.Version = version ?? string.Empty;
|
||||
spans.Scope.Name = name;
|
||||
spans.Scope.Version = version ?? string.Empty;
|
||||
}
|
||||
|
||||
return spans;
|
||||
|
|
|
|||
|
|
@ -41,15 +41,15 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation
|
|||
};
|
||||
request.ResourceLogs.Add(resourceLogs);
|
||||
|
||||
var instrumentationLibraryLogs = new OtlpLogs.InstrumentationLibraryLogs();
|
||||
resourceLogs.InstrumentationLibraryLogs.Add(instrumentationLibraryLogs);
|
||||
var scopeLogs = new OtlpLogs.ScopeLogs();
|
||||
resourceLogs.ScopeLogs.Add(scopeLogs);
|
||||
|
||||
foreach (var logRecord in logRecordBatch)
|
||||
{
|
||||
var otlpLogRecord = logRecord.ToOtlpLog();
|
||||
if (otlpLogRecord != null)
|
||||
{
|
||||
instrumentationLibraryLogs.Logs.Add(otlpLogRecord);
|
||||
scopeLogs.LogRecords.Add(otlpLogRecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -64,13 +64,14 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation
|
|||
otlpLogRecord = new OtlpLogs.LogRecord
|
||||
{
|
||||
TimeUnixNano = (ulong)logRecord.Timestamp.ToUnixTimeNanoseconds(),
|
||||
Name = logRecord.CategoryName,
|
||||
|
||||
// TODO: Devise mapping of LogLevel to SeverityNumber
|
||||
// See: https://github.com/open-telemetry/opentelemetry-proto/blob/bacfe08d84e21fb2a779e302d12e8dfeb67e7b86/opentelemetry/proto/logs/v1/logs.proto#L100-L102
|
||||
SeverityText = logRecord.LogLevel.ToString(),
|
||||
};
|
||||
|
||||
// TODO: Add logRecord.CategoryName as an attribute
|
||||
|
||||
if (logRecord.FormattedMessage != null)
|
||||
{
|
||||
otlpLogRecord.Body = new OtlpCommon.AnyValue { StringValue = logRecord.FormattedMessage };
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation
|
|||
{
|
||||
internal static class MetricItemExtensions
|
||||
{
|
||||
private static readonly ConcurrentBag<OtlpMetrics.InstrumentationLibraryMetrics> MetricListPool = new();
|
||||
private static readonly ConcurrentBag<OtlpMetrics.ScopeMetrics> MetricListPool = new();
|
||||
private static readonly Action<RepeatedField<OtlpMetrics.Metric>, int> RepeatedFieldOfMetricSetCountAction = CreateRepeatedFieldOfMetricSetCountAction();
|
||||
|
||||
internal static void AddMetrics(
|
||||
|
|
@ -40,7 +40,7 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation
|
|||
OtlpResource.Resource processResource,
|
||||
in Batch<Metric> metrics)
|
||||
{
|
||||
var metricsByLibrary = new Dictionary<string, OtlpMetrics.InstrumentationLibraryMetrics>();
|
||||
var metricsByLibrary = new Dictionary<string, OtlpMetrics.ScopeMetrics>();
|
||||
var resourceMetrics = new OtlpMetrics.ResourceMetrics
|
||||
{
|
||||
Resource = processResource,
|
||||
|
|
@ -61,15 +61,15 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation
|
|||
}
|
||||
|
||||
var meterName = metric.MeterName;
|
||||
if (!metricsByLibrary.TryGetValue(meterName, out var instrumentationLibraryMetrics))
|
||||
if (!metricsByLibrary.TryGetValue(meterName, out var scopeMetrics))
|
||||
{
|
||||
instrumentationLibraryMetrics = GetMetricListFromPool(meterName, metric.MeterVersion);
|
||||
scopeMetrics = GetMetricListFromPool(meterName, metric.MeterVersion);
|
||||
|
||||
metricsByLibrary.Add(meterName, instrumentationLibraryMetrics);
|
||||
resourceMetrics.InstrumentationLibraryMetrics.Add(instrumentationLibraryMetrics);
|
||||
metricsByLibrary.Add(meterName, scopeMetrics);
|
||||
resourceMetrics.ScopeMetrics.Add(scopeMetrics);
|
||||
}
|
||||
|
||||
instrumentationLibraryMetrics.Metrics.Add(otlpMetric);
|
||||
scopeMetrics.Metrics.Add(otlpMetric);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -82,21 +82,21 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation
|
|||
return;
|
||||
}
|
||||
|
||||
foreach (var libraryMetrics in resourceMetrics.InstrumentationLibraryMetrics)
|
||||
foreach (var scope in resourceMetrics.ScopeMetrics)
|
||||
{
|
||||
RepeatedFieldOfMetricSetCountAction(libraryMetrics.Metrics, 0);
|
||||
MetricListPool.Add(libraryMetrics);
|
||||
RepeatedFieldOfMetricSetCountAction(scope.Metrics, 0);
|
||||
MetricListPool.Add(scope);
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static OtlpMetrics.InstrumentationLibraryMetrics GetMetricListFromPool(string name, string version)
|
||||
internal static OtlpMetrics.ScopeMetrics GetMetricListFromPool(string name, string version)
|
||||
{
|
||||
if (!MetricListPool.TryTake(out var metrics))
|
||||
{
|
||||
metrics = new OtlpMetrics.InstrumentationLibraryMetrics
|
||||
metrics = new OtlpMetrics.ScopeMetrics
|
||||
{
|
||||
InstrumentationLibrary = new OtlpCommon.InstrumentationLibrary
|
||||
Scope = new OtlpCommon.InstrumentationScope
|
||||
{
|
||||
Name = name, // Name is enforced to not be null, but it can be empty.
|
||||
Version = version ?? string.Empty, // NRE throw by proto
|
||||
|
|
@ -105,8 +105,8 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation
|
|||
}
|
||||
else
|
||||
{
|
||||
metrics.InstrumentationLibrary.Name = name;
|
||||
metrics.InstrumentationLibrary.Version = version ?? string.Empty;
|
||||
metrics.Scope.Name = name;
|
||||
metrics.Scope.Version = version ?? string.Empty;
|
||||
}
|
||||
|
||||
return metrics;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import "opentelemetry/proto/logs/v1/logs.proto";
|
|||
option java_multiple_files = true;
|
||||
option java_package = "io.opentelemetry.proto.collector.logs.v1";
|
||||
option java_outer_classname = "LogsServiceProto";
|
||||
option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/collector/logs/v1";
|
||||
option go_package = "go.opentelemetry.io/proto/otlp/collector/logs/v1";
|
||||
|
||||
// Service that can be used to push logs between one Application instrumented with
|
||||
// OpenTelemetry and an collector, or between an collector and a central collector (in this
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import "opentelemetry/proto/metrics/v1/metrics.proto";
|
|||
option java_multiple_files = true;
|
||||
option java_package = "io.opentelemetry.proto.collector.metrics.v1";
|
||||
option java_outer_classname = "MetricsServiceProto";
|
||||
option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/collector/metrics/v1";
|
||||
option go_package = "go.opentelemetry.io/proto/otlp/collector/metrics/v1";
|
||||
|
||||
// Service that can be used to push metrics between one Application
|
||||
// instrumented with OpenTelemetry and a collector, or between a collector and a
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import "opentelemetry/proto/trace/v1/trace.proto";
|
|||
option java_multiple_files = true;
|
||||
option java_package = "io.opentelemetry.proto.collector.trace.v1";
|
||||
option java_outer_classname = "TraceServiceProto";
|
||||
option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/collector/trace/v1";
|
||||
option go_package = "go.opentelemetry.io/proto/otlp/collector/trace/v1";
|
||||
|
||||
// Service that can be used to push spans between one Application instrumented with
|
||||
// OpenTelemetry and a collector, or between a collector and a central collector (in this
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ package opentelemetry.proto.common.v1;
|
|||
option java_multiple_files = true;
|
||||
option java_package = "io.opentelemetry.proto.common.v1";
|
||||
option java_outer_classname = "CommonProto";
|
||||
option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/common/v1";
|
||||
option go_package = "go.opentelemetry.io/proto/otlp/common/v1";
|
||||
|
||||
// AnyValue is used to represent any type of attribute value. AnyValue may contain a
|
||||
// primitive value such as a string or integer or it may contain an arbitrary nested
|
||||
|
|
@ -53,6 +53,8 @@ message ArrayValue {
|
|||
message KeyValueList {
|
||||
// A collection of key/value pairs of key-value pairs. The list may be empty (may
|
||||
// contain 0 elements).
|
||||
// The keys MUST be unique (it is not allowed to have more than one
|
||||
// value with the same key).
|
||||
repeated KeyValue values = 1;
|
||||
}
|
||||
|
||||
|
|
@ -63,19 +65,23 @@ message KeyValue {
|
|||
AnyValue value = 2;
|
||||
}
|
||||
|
||||
// StringKeyValue is a pair of key/value strings. This is the simpler (and faster) version
|
||||
// of KeyValue that only supports string values.
|
||||
message StringKeyValue {
|
||||
// InstrumentationLibrary is a message representing the instrumentation library information
|
||||
// such as the fully qualified name and version.
|
||||
// InstrumentationLibrary is wire-compatible with InstrumentationScope for binary
|
||||
// Protobuf format.
|
||||
// This message is deprecated and will be removed on June 15, 2022.
|
||||
message InstrumentationLibrary {
|
||||
option deprecated = true;
|
||||
|
||||
string key = 1;
|
||||
string value = 2;
|
||||
}
|
||||
|
||||
// InstrumentationLibrary is a message representing the instrumentation library information
|
||||
// such as the fully qualified name and version.
|
||||
message InstrumentationLibrary {
|
||||
// An empty instrumentation library name means the name is unknown.
|
||||
// An empty instrumentation library name means the name is unknown.
|
||||
string name = 1;
|
||||
string version = 2;
|
||||
}
|
||||
|
||||
// InstrumentationScope is a message representing the instrumentation scope information
|
||||
// such as the fully qualified name and version.
|
||||
message InstrumentationScope {
|
||||
// An empty instrumentation scope name means the name is unknown.
|
||||
string name = 1;
|
||||
string version = 2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import "opentelemetry/proto/resource/v1/resource.proto";
|
|||
option java_multiple_files = true;
|
||||
option java_package = "io.opentelemetry.proto.logs.v1";
|
||||
option java_outer_classname = "LogsProto";
|
||||
option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/logs/v1";
|
||||
option go_package = "go.opentelemetry.io/proto/otlp/logs/v1";
|
||||
|
||||
// LogsData represents the logs data that can be stored in a persistent storage,
|
||||
// OR can be embedded by other protocols that transfer OTLP logs data but do not
|
||||
|
|
@ -43,30 +43,77 @@ message LogsData {
|
|||
repeated ResourceLogs resource_logs = 1;
|
||||
}
|
||||
|
||||
// A collection of InstrumentationLibraryLogs from a Resource.
|
||||
// A collection of ScopeLogs from a Resource.
|
||||
message ResourceLogs {
|
||||
// The resource for the logs in this message.
|
||||
// If this field is not set then resource info is unknown.
|
||||
opentelemetry.proto.resource.v1.Resource resource = 1;
|
||||
|
||||
// A list of ScopeLogs that originate from a resource.
|
||||
repeated ScopeLogs scope_logs = 2;
|
||||
|
||||
// A list of InstrumentationLibraryLogs that originate from a resource.
|
||||
repeated InstrumentationLibraryLogs instrumentation_library_logs = 2;
|
||||
// This field is deprecated and will be removed after grace period expires on June 15, 2022.
|
||||
//
|
||||
// During the grace period the following rules SHOULD be followed:
|
||||
//
|
||||
// For Binary Protobufs
|
||||
// ====================
|
||||
// Binary Protobuf senders SHOULD NOT set instrumentation_library_logs. Instead
|
||||
// scope_logs SHOULD be set.
|
||||
//
|
||||
// Binary Protobuf receivers SHOULD check if instrumentation_library_logs is set
|
||||
// and scope_logs is not set then the value in instrumentation_library_logs
|
||||
// SHOULD be used instead by converting InstrumentationLibraryLogs into ScopeLogs.
|
||||
// If scope_logs is set then instrumentation_library_logs SHOULD be ignored.
|
||||
//
|
||||
// For JSON
|
||||
// ========
|
||||
// JSON senders that set instrumentation_library_logs field MAY also set
|
||||
// scope_logs to carry the same logs, essentially double-publishing the same data.
|
||||
// Such double-publishing MAY be controlled by a user-settable option.
|
||||
// If double-publishing is not used then the senders SHOULD set scope_logs and
|
||||
// SHOULD NOT set instrumentation_library_logs.
|
||||
//
|
||||
// JSON receivers SHOULD check if instrumentation_library_logs is set and
|
||||
// scope_logs is not set then the value in instrumentation_library_logs
|
||||
// SHOULD be used instead by converting InstrumentationLibraryLogs into ScopeLogs.
|
||||
// If scope_logs is set then instrumentation_library_logs field SHOULD be ignored.
|
||||
repeated InstrumentationLibraryLogs instrumentation_library_logs = 1000 [deprecated = true];
|
||||
|
||||
// This schema_url applies to the data in the "resource" field. It does not apply
|
||||
// to the data in the "instrumentation_library_logs" field which have their own
|
||||
// schema_url field.
|
||||
// to the data in the "scope_logs" field which have their own schema_url field.
|
||||
string schema_url = 3;
|
||||
}
|
||||
|
||||
// A collection of Logs produced by a Scope.
|
||||
message ScopeLogs {
|
||||
// The instrumentation scope information for the logs in this message.
|
||||
// Semantically when InstrumentationScope isn't set, it is equivalent with
|
||||
// an empty instrumentation scope name (unknown).
|
||||
opentelemetry.proto.common.v1.InstrumentationScope scope = 1;
|
||||
|
||||
// A list of log records.
|
||||
repeated LogRecord log_records = 2;
|
||||
|
||||
// This schema_url applies to all logs in the "logs" field.
|
||||
string schema_url = 3;
|
||||
}
|
||||
|
||||
// A collection of Logs produced by an InstrumentationLibrary.
|
||||
// InstrumentationLibraryLogs is wire-compatible with ScopeLogs for binary
|
||||
// Protobuf format.
|
||||
// This message is deprecated and will be removed on June 15, 2022.
|
||||
message InstrumentationLibraryLogs {
|
||||
option deprecated = true;
|
||||
|
||||
// The instrumentation library information for the logs in this message.
|
||||
// Semantically when InstrumentationLibrary isn't set, it is equivalent with
|
||||
// an empty instrumentation library name (unknown).
|
||||
opentelemetry.proto.common.v1.InstrumentationLibrary instrumentation_library = 1;
|
||||
|
||||
// A list of log records.
|
||||
repeated LogRecord logs = 2;
|
||||
// A list of logs that originate from an instrumentation library.
|
||||
repeated LogRecord log_records = 2;
|
||||
|
||||
// This schema_url applies to all logs in the "logs" field.
|
||||
string schema_url = 3;
|
||||
|
|
@ -111,11 +158,30 @@ enum LogRecordFlags {
|
|||
// A log record according to OpenTelemetry Log Data Model:
|
||||
// https://github.com/open-telemetry/oteps/blob/main/text/logs/0097-log-data-model.md
|
||||
message LogRecord {
|
||||
reserved 4;
|
||||
|
||||
// time_unix_nano is the time when the event occurred.
|
||||
// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
|
||||
// Value of 0 indicates unknown or missing timestamp.
|
||||
fixed64 time_unix_nano = 1;
|
||||
|
||||
// Time when the event was observed by the collection system.
|
||||
// For events that originate in OpenTelemetry (e.g. using OpenTelemetry Logging SDK)
|
||||
// this timestamp is typically set at the generation time and is equal to Timestamp.
|
||||
// For events originating externally and collected by OpenTelemetry (e.g. using
|
||||
// Collector) this is the time when OpenTelemetry's code observed the event measured
|
||||
// by the clock of the OpenTelemetry code. This field MUST be set once the event is
|
||||
// observed by OpenTelemetry.
|
||||
//
|
||||
// For converting OpenTelemetry log data to formats that support only one timestamp or
|
||||
// when receiving OpenTelemetry log data by recipients that support only one timestamp
|
||||
// internally the following logic is recommended:
|
||||
// - Use time_unix_nano if it is present, otherwise use observed_time_unix_nano.
|
||||
//
|
||||
// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
|
||||
// Value of 0 indicates unknown or missing timestamp.
|
||||
fixed64 observed_time_unix_nano = 11;
|
||||
|
||||
// Numerical value of the severity, normalized to values described in Log Data Model.
|
||||
// [Optional].
|
||||
SeverityNumber severity_number = 2;
|
||||
|
|
@ -124,17 +190,14 @@ message LogRecord {
|
|||
// it is known at the source. [Optional].
|
||||
string severity_text = 3;
|
||||
|
||||
// Short event identifier that does not contain varying parts. Name describes
|
||||
// what happened (e.g. "ProcessStarted"). Recommended to be no longer than 50
|
||||
// characters. Not guaranteed to be unique in any way. [Optional].
|
||||
string name = 4;
|
||||
|
||||
// A value containing the body of the log record. Can be for example a human-readable
|
||||
// string message (including multi-line) describing the event in a free form or it can
|
||||
// be a structured data composed of arrays and maps of other values. [Optional].
|
||||
opentelemetry.proto.common.v1.AnyValue body = 5;
|
||||
|
||||
// Additional attributes that describe the specific event occurrence. [Optional].
|
||||
// Attribute keys MUST be unique (it is not allowed to have more than one
|
||||
// attribute with the same key).
|
||||
repeated opentelemetry.proto.common.v1.KeyValue attributes = 6;
|
||||
uint32 dropped_attributes_count = 7;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,102 +0,0 @@
|
|||
// Copyright 2019, OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package opentelemetry.proto.metrics.experimental;
|
||||
|
||||
import "opentelemetry/proto/resource/v1/resource.proto";
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_package = "io.opentelemetry.proto.metrics.experimental";
|
||||
option java_outer_classname = "MetricConfigServiceProto";
|
||||
option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/metrics/experimental";
|
||||
|
||||
// MetricConfig is a service that enables updating metric schedules, trace
|
||||
// parameters, and other configurations on the SDK without having to restart the
|
||||
// instrumented application. The collector can also serve as the configuration
|
||||
// service, acting as a bridge between third-party configuration services and
|
||||
// the SDK, piping updated configs from a third-party source to an instrumented
|
||||
// application.
|
||||
service MetricConfig {
|
||||
rpc GetMetricConfig (MetricConfigRequest) returns (MetricConfigResponse);
|
||||
}
|
||||
|
||||
message MetricConfigRequest{
|
||||
|
||||
// Required. The resource for which configuration should be returned.
|
||||
opentelemetry.proto.resource.v1.Resource resource = 1;
|
||||
|
||||
// Optional. The value of MetricConfigResponse.fingerprint for the last
|
||||
// configuration that the caller received and successfully applied.
|
||||
bytes last_known_fingerprint = 2;
|
||||
}
|
||||
|
||||
message MetricConfigResponse {
|
||||
|
||||
// Optional. The fingerprint associated with this MetricConfigResponse. Each
|
||||
// change in configs yields a different fingerprint. The resource SHOULD copy
|
||||
// this value to MetricConfigRequest.last_known_fingerprint for the next
|
||||
// configuration request. If there are no changes between fingerprint and
|
||||
// MetricConfigRequest.last_known_fingerprint, then all other fields besides
|
||||
// fingerprint in the response are optional, or the same as the last update if
|
||||
// present.
|
||||
//
|
||||
// The exact mechanics of generating the fingerprint is up to the
|
||||
// implementation. However, a fingerprint must be deterministically determined
|
||||
// by the configurations -- the same configuration will generate the same
|
||||
// fingerprint on any instance of an implementation. Hence using a timestamp is
|
||||
// unacceptable, but a deterministic hash is fine.
|
||||
bytes fingerprint = 1;
|
||||
|
||||
// A Schedule is used to apply a particular scheduling configuration to
|
||||
// a metric. If a metric name matches a schedule's patterns, then the metric
|
||||
// adopts the configuration specified by the schedule.
|
||||
message Schedule {
|
||||
|
||||
// A light-weight pattern that can match 1 or more
|
||||
// metrics, for which this schedule will apply. The string is used to
|
||||
// match against metric names. It should not exceed 100k characters.
|
||||
message Pattern {
|
||||
oneof match {
|
||||
string equal_to = 1; // matches the metric name exactly
|
||||
string starts_with = 2; // prefix-matches the metric name
|
||||
}
|
||||
}
|
||||
|
||||
// Metrics with names that match a rule in the inclusion_patterns are
|
||||
// targeted by this schedule. Metrics that match the exclusion_patterns
|
||||
// are not targeted for this schedule, even if they match an inclusion
|
||||
// pattern.
|
||||
repeated Pattern exclusion_patterns = 1;
|
||||
repeated Pattern inclusion_patterns = 2;
|
||||
|
||||
// Describes the collection period for each metric in seconds.
|
||||
// A period of 0 means to not export.
|
||||
int32 period_sec = 3;
|
||||
}
|
||||
|
||||
// A single metric may match multiple schedules. In such cases, the schedule
|
||||
// that specifies the smallest period is applied.
|
||||
//
|
||||
// Note, for optimization purposes, it is recommended to use as few schedules
|
||||
// as possible to capture all required metric updates. Where you can be
|
||||
// conservative, do take full advantage of the inclusion/exclusion patterns to
|
||||
// capture as much of your targeted metrics.
|
||||
repeated Schedule schedules = 2;
|
||||
|
||||
// Optional. The client is suggested to wait this long (in seconds) before
|
||||
// pinging the configuration service again.
|
||||
int32 suggested_wait_time_sec = 3;
|
||||
}
|
||||
|
|
@ -22,7 +22,7 @@ import "opentelemetry/proto/resource/v1/resource.proto";
|
|||
option java_multiple_files = true;
|
||||
option java_package = "io.opentelemetry.proto.metrics.v1";
|
||||
option java_outer_classname = "MetricsProto";
|
||||
option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/metrics/v1";
|
||||
option go_package = "go.opentelemetry.io/proto/otlp/metrics/v1";
|
||||
|
||||
// MetricsData represents the metrics data that can be stored in a persistent
|
||||
// storage, OR can be embedded by other protocols that transfer OTLP metrics
|
||||
|
|
@ -43,23 +43,70 @@ message MetricsData {
|
|||
repeated ResourceMetrics resource_metrics = 1;
|
||||
}
|
||||
|
||||
// A collection of InstrumentationLibraryMetrics from a Resource.
|
||||
// A collection of ScopeMetrics from a Resource.
|
||||
message ResourceMetrics {
|
||||
// The resource for the metrics in this message.
|
||||
// If this field is not set then no resource info is known.
|
||||
opentelemetry.proto.resource.v1.Resource resource = 1;
|
||||
|
||||
// A list of metrics that originate from a resource.
|
||||
repeated InstrumentationLibraryMetrics instrumentation_library_metrics = 2;
|
||||
repeated ScopeMetrics scope_metrics = 2;
|
||||
|
||||
// A list of InstrumentationLibraryMetrics that originate from a resource.
|
||||
// This field is deprecated and will be removed after grace period expires on June 15, 2022.
|
||||
//
|
||||
// During the grace period the following rules SHOULD be followed:
|
||||
//
|
||||
// For Binary Protobufs
|
||||
// ====================
|
||||
// Binary Protobuf senders SHOULD NOT set instrumentation_library_metrics. Instead
|
||||
// scope_metrics SHOULD be set.
|
||||
//
|
||||
// Binary Protobuf receivers SHOULD check if instrumentation_library_metrics is set
|
||||
// and scope_metrics is not set then the value in instrumentation_library_metrics
|
||||
// SHOULD be used instead by converting InstrumentationLibraryMetrics into ScopeMetrics.
|
||||
// If scope_metrics is set then instrumentation_library_metrics SHOULD be ignored.
|
||||
//
|
||||
// For JSON
|
||||
// ========
|
||||
// JSON senders that set instrumentation_library_metrics field MAY also set
|
||||
// scope_metrics to carry the same metrics, essentially double-publishing the same data.
|
||||
// Such double-publishing MAY be controlled by a user-settable option.
|
||||
// If double-publishing is not used then the senders SHOULD set scope_metrics and
|
||||
// SHOULD NOT set instrumentation_library_metrics.
|
||||
//
|
||||
// JSON receivers SHOULD check if instrumentation_library_metrics is set and
|
||||
// scope_metrics is not set then the value in instrumentation_library_metrics
|
||||
// SHOULD be used instead by converting InstrumentationLibraryMetrics into ScopeMetrics.
|
||||
// If scope_metrics is set then instrumentation_library_metrics field SHOULD be ignored.
|
||||
repeated InstrumentationLibraryMetrics instrumentation_library_metrics = 1000 [deprecated = true];
|
||||
|
||||
// This schema_url applies to the data in the "resource" field. It does not apply
|
||||
// to the data in the "instrumentation_library_metrics" field which have their own
|
||||
// schema_url field.
|
||||
// to the data in the "scope_metrics" field which have their own schema_url field.
|
||||
string schema_url = 3;
|
||||
}
|
||||
|
||||
// A collection of Metrics produced by an Scope.
|
||||
message ScopeMetrics {
|
||||
// The instrumentation scope information for the metrics in this message.
|
||||
// Semantically when InstrumentationScope isn't set, it is equivalent with
|
||||
// an empty instrumentation scope name (unknown).
|
||||
opentelemetry.proto.common.v1.InstrumentationScope scope = 1;
|
||||
|
||||
// A list of metrics that originate from an instrumentation library.
|
||||
repeated Metric metrics = 2;
|
||||
|
||||
// This schema_url applies to all metrics in the "metrics" field.
|
||||
string schema_url = 3;
|
||||
}
|
||||
|
||||
// A collection of Metrics produced by an InstrumentationLibrary.
|
||||
// InstrumentationLibraryMetrics is wire-compatible with ScopeMetrics for binary
|
||||
// Protobuf format.
|
||||
// This message is deprecated and will be removed on June 15, 2022.
|
||||
message InstrumentationLibraryMetrics {
|
||||
option deprecated = true;
|
||||
|
||||
// The instrumentation library information for the metrics in this message.
|
||||
// Semantically when InstrumentationLibrary isn't set, it is equivalent with
|
||||
// an empty instrumentation library name (unknown).
|
||||
|
|
@ -158,6 +205,8 @@ message InstrumentationLibraryMetrics {
|
|||
// when the start time is truly unknown, setting StartTimeUnixNano is
|
||||
// strongly encouraged.
|
||||
message Metric {
|
||||
reserved 4, 6, 8;
|
||||
|
||||
// name of the metric, including its DNS name prefix. It must be unique.
|
||||
string name = 1;
|
||||
|
||||
|
|
@ -172,28 +221,8 @@ message Metric {
|
|||
// reported value type for the data points, as well as the relatationship to
|
||||
// the time interval over which they are reported.
|
||||
oneof data {
|
||||
// IntGauge and IntSum are deprecated and will be removed soon.
|
||||
// 1. Old senders and receivers that are not aware of this change will
|
||||
// continue using the `int_gauge` and `int_sum` fields.
|
||||
// 2. New senders, which are aware of this change MUST send only `gauge`
|
||||
// and `sum` fields.
|
||||
// 3. New receivers, which are aware of this change MUST convert these into
|
||||
// `gauge` and `sum` by using the provided as_int field in the oneof values.
|
||||
// This field will be removed in ~3 months, on July 1, 2021.
|
||||
IntGauge int_gauge = 4 [deprecated = true];
|
||||
Gauge gauge = 5;
|
||||
// This field will be removed in ~3 months, on July 1, 2021.
|
||||
IntSum int_sum = 6 [deprecated = true];
|
||||
Sum sum = 7;
|
||||
|
||||
// IntHistogram is deprecated and will be removed soon.
|
||||
// 1. Old senders and receivers that are not aware of this change will
|
||||
// continue using the `int_histogram` field.
|
||||
// 2. New senders, which are aware of this change MUST send only `histogram`.
|
||||
// 3. New receivers, which are aware of this change MUST convert this into
|
||||
// `histogram` by simply converting all int64 values into float.
|
||||
// This field will be removed in ~3 months, on July 1, 2021.
|
||||
IntHistogram int_histogram = 8 [deprecated = true];
|
||||
Histogram histogram = 9;
|
||||
ExponentialHistogram exponential_histogram = 10;
|
||||
Summary summary = 11;
|
||||
|
|
@ -348,20 +377,14 @@ enum DataPointFlags {
|
|||
// NumberDataPoint is a single data point in a timeseries that describes the
|
||||
// time-varying scalar value of a metric.
|
||||
message NumberDataPoint {
|
||||
reserved 1;
|
||||
|
||||
// The set of key/value pairs that uniquely identify the timeseries from
|
||||
// where this point belongs. The list may be empty (may contain 0 elements).
|
||||
// Attribute keys MUST be unique (it is not allowed to have more than one
|
||||
// attribute with the same key).
|
||||
repeated opentelemetry.proto.common.v1.KeyValue attributes = 7;
|
||||
|
||||
// Labels is deprecated and will be removed soon.
|
||||
// 1. Old senders and receivers that are not aware of this change will
|
||||
// continue using the `labels` field.
|
||||
// 2. New senders, which are aware of this change MUST send only `attributes`.
|
||||
// 3. New receivers, which are aware of this change MUST convert this into
|
||||
// `labels` by simply converting all int64 values into float.
|
||||
//
|
||||
// This field will be removed in ~3 months, on July 1, 2021.
|
||||
repeated opentelemetry.proto.common.v1.StringKeyValue labels = 1 [deprecated = true];
|
||||
|
||||
// StartTimeUnixNano is optional but strongly encouraged, see the
|
||||
// the detailed comments above Metric.
|
||||
//
|
||||
|
|
@ -402,20 +425,14 @@ message NumberDataPoint {
|
|||
// "explicit_bounds" and "bucket_counts" must be omitted and only "count" and
|
||||
// "sum" are known.
|
||||
message HistogramDataPoint {
|
||||
reserved 1;
|
||||
|
||||
// The set of key/value pairs that uniquely identify the timeseries from
|
||||
// where this point belongs. The list may be empty (may contain 0 elements).
|
||||
// Attribute keys MUST be unique (it is not allowed to have more than one
|
||||
// attribute with the same key).
|
||||
repeated opentelemetry.proto.common.v1.KeyValue attributes = 9;
|
||||
|
||||
// Labels is deprecated and will be removed soon.
|
||||
// 1. Old senders and receivers that are not aware of this change will
|
||||
// continue using the `labels` field.
|
||||
// 2. New senders, which are aware of this change MUST send only `attributes`.
|
||||
// 3. New receivers, which are aware of this change MUST convert this into
|
||||
// `labels` by simply converting all int64 values into float.
|
||||
//
|
||||
// This field will be removed in ~3 months, on July 1, 2021.
|
||||
repeated opentelemetry.proto.common.v1.StringKeyValue labels = 1 [deprecated = true];
|
||||
|
||||
// StartTimeUnixNano is optional but strongly encouraged, see the
|
||||
// the detailed comments above Metric.
|
||||
//
|
||||
|
|
@ -442,7 +459,7 @@ message HistogramDataPoint {
|
|||
// Negative events *can* be recorded, but sum should not be filled out when
|
||||
// doing so. This is specifically to enforce compatibility w/ OpenMetrics,
|
||||
// see: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#histogram
|
||||
double sum = 5;
|
||||
optional double sum = 5;
|
||||
|
||||
// bucket_counts is an optional field contains the count values of histogram
|
||||
// for each bucket.
|
||||
|
|
@ -485,6 +502,8 @@ message HistogramDataPoint {
|
|||
message ExponentialHistogramDataPoint {
|
||||
// The set of key/value pairs that uniquely identify the timeseries from
|
||||
// where this point belongs. The list may be empty (may contain 0 elements).
|
||||
// Attribute keys MUST be unique (it is not allowed to have more than one
|
||||
// attribute with the same key).
|
||||
repeated opentelemetry.proto.common.v1.KeyValue attributes = 1;
|
||||
|
||||
// StartTimeUnixNano is optional but strongly encouraged, see the
|
||||
|
|
@ -580,20 +599,14 @@ message ExponentialHistogramDataPoint {
|
|||
// SummaryDataPoint is a single data point in a timeseries that describes the
|
||||
// time-varying values of a Summary metric.
|
||||
message SummaryDataPoint {
|
||||
reserved 1;
|
||||
|
||||
// The set of key/value pairs that uniquely identify the timeseries from
|
||||
// where this point belongs. The list may be empty (may contain 0 elements).
|
||||
// Attribute keys MUST be unique (it is not allowed to have more than one
|
||||
// attribute with the same key).
|
||||
repeated opentelemetry.proto.common.v1.KeyValue attributes = 7;
|
||||
|
||||
// Labels is deprecated and will be removed soon.
|
||||
// 1. Old senders and receivers that are not aware of this change will
|
||||
// continue using the `labels` field.
|
||||
// 2. New senders, which are aware of this change MUST send only `attributes`.
|
||||
// 3. New receivers, which are aware of this change MUST convert this into
|
||||
// `labels` by simply converting all int64 values into float.
|
||||
//
|
||||
// This field will be removed in ~3 months, on July 1, 2021.
|
||||
repeated opentelemetry.proto.common.v1.StringKeyValue labels = 1 [deprecated = true];
|
||||
|
||||
// StartTimeUnixNano is optional but strongly encouraged, see the
|
||||
// the detailed comments above Metric.
|
||||
//
|
||||
|
|
@ -653,22 +666,13 @@ message SummaryDataPoint {
|
|||
// was recorded, for example the span and trace ID of the active span when the
|
||||
// exemplar was recorded.
|
||||
message Exemplar {
|
||||
reserved 1;
|
||||
|
||||
// The set of key/value pairs that were filtered out by the aggregator, but
|
||||
// recorded alongside the original measurement. Only key/value pairs that were
|
||||
// filtered out by the aggregator should be included
|
||||
repeated opentelemetry.proto.common.v1.KeyValue filtered_attributes = 7;
|
||||
|
||||
// Labels is deprecated and will be removed soon.
|
||||
// 1. Old senders and receivers that are not aware of this change will
|
||||
// continue using the `filtered_labels` field.
|
||||
// 2. New senders, which are aware of this change MUST send only
|
||||
// `filtered_attributes`.
|
||||
// 3. New receivers, which are aware of this change MUST convert this into
|
||||
// `filtered_labels` by simply converting all int64 values into float.
|
||||
//
|
||||
// This field will be removed in ~3 months, on July 1, 2021.
|
||||
repeated opentelemetry.proto.common.v1.StringKeyValue filtered_labels = 1 [deprecated = true];
|
||||
|
||||
// time_unix_nano is the exact time when this exemplar was recorded
|
||||
//
|
||||
// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
|
||||
|
|
@ -693,156 +697,3 @@ message Exemplar {
|
|||
// or if the trace is not sampled.
|
||||
bytes trace_id = 5;
|
||||
}
|
||||
|
||||
//
|
||||
// Move deprecated messages below this line
|
||||
//
|
||||
|
||||
// IntDataPoint is deprecated. Use integer value in NumberDataPoint.
|
||||
message IntDataPoint {
|
||||
option deprecated = true;
|
||||
|
||||
// The set of labels that uniquely identify this timeseries.
|
||||
repeated opentelemetry.proto.common.v1.StringKeyValue labels = 1;
|
||||
|
||||
// StartTimeUnixNano is optional but strongly encouraged, see the
|
||||
// the detailed comments above Metric.
|
||||
//
|
||||
// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
|
||||
// 1970.
|
||||
fixed64 start_time_unix_nano = 2;
|
||||
|
||||
// TimeUnixNano is required, see the detailed comments above Metric.
|
||||
//
|
||||
// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
|
||||
// 1970.
|
||||
fixed64 time_unix_nano = 3;
|
||||
|
||||
// value itself.
|
||||
sfixed64 value = 4;
|
||||
|
||||
// (Optional) List of exemplars collected from
|
||||
// measurements that were used to form the data point
|
||||
repeated IntExemplar exemplars = 5;
|
||||
}
|
||||
|
||||
// IntGauge is deprecated. Use Gauge with an integer value in NumberDataPoint.
|
||||
message IntGauge {
|
||||
option deprecated = true;
|
||||
|
||||
repeated IntDataPoint data_points = 1;
|
||||
}
|
||||
|
||||
// IntSum is deprecated. Use Sum with an integer value in NumberDataPoint.
|
||||
message IntSum {
|
||||
option deprecated = true;
|
||||
|
||||
repeated IntDataPoint data_points = 1;
|
||||
|
||||
// aggregation_temporality describes if the aggregator reports delta changes
|
||||
// since last report time, or cumulative changes since a fixed start time.
|
||||
AggregationTemporality aggregation_temporality = 2;
|
||||
|
||||
// If "true" means that the sum is monotonic.
|
||||
bool is_monotonic = 3;
|
||||
}
|
||||
|
||||
// IntHistogramDataPoint is deprecated; use HistogramDataPoint.
|
||||
message IntHistogramDataPoint {
|
||||
option deprecated = true;
|
||||
|
||||
// The set of labels that uniquely identify this timeseries.
|
||||
repeated opentelemetry.proto.common.v1.StringKeyValue labels = 1;
|
||||
|
||||
// StartTimeUnixNano is optional but strongly encouraged, see the
|
||||
// the detailed comments above Metric.
|
||||
//
|
||||
// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
|
||||
// 1970.
|
||||
fixed64 start_time_unix_nano = 2;
|
||||
|
||||
// TimeUnixNano is required, see the detailed comments above Metric.
|
||||
//
|
||||
// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
|
||||
// 1970.
|
||||
fixed64 time_unix_nano = 3;
|
||||
|
||||
// count is the number of values in the population. Must be non-negative. This
|
||||
// value must be equal to the sum of the "count" fields in buckets if a
|
||||
// histogram is provided.
|
||||
fixed64 count = 4;
|
||||
|
||||
// sum of the values in the population. If count is zero then this field
|
||||
// must be zero. This value must be equal to the sum of the "sum" fields in
|
||||
// buckets if a histogram is provided.
|
||||
sfixed64 sum = 5;
|
||||
|
||||
// bucket_counts is an optional field contains the count values of histogram
|
||||
// for each bucket.
|
||||
//
|
||||
// The sum of the bucket_counts must equal the value in the count field.
|
||||
//
|
||||
// The number of elements in bucket_counts array must be by one greater than
|
||||
// the number of elements in explicit_bounds array.
|
||||
repeated fixed64 bucket_counts = 6;
|
||||
|
||||
// explicit_bounds specifies buckets with explicitly defined bounds for values.
|
||||
//
|
||||
// The boundaries for bucket at index i are:
|
||||
//
|
||||
// (-infinity, explicit_bounds[i]] for i == 0
|
||||
// (explicit_bounds[i-1], explicit_bounds[i]] for 0 < i < size(explicit_bounds)
|
||||
// (explicit_bounds[i-1], +infinity) for i == size(explicit_bounds)
|
||||
//
|
||||
// The values in the explicit_bounds array must be strictly increasing.
|
||||
//
|
||||
// Histogram buckets are inclusive of their upper boundary, except the last
|
||||
// bucket where the boundary is at infinity. This format is intentionally
|
||||
// compatible with the OpenMetrics histogram definition.
|
||||
repeated double explicit_bounds = 7;
|
||||
|
||||
// (Optional) List of exemplars collected from
|
||||
// measurements that were used to form the data point
|
||||
repeated IntExemplar exemplars = 8;
|
||||
}
|
||||
|
||||
// IntHistogram is deprecated, replaced by Histogram points using double-
|
||||
// valued exemplars.
|
||||
message IntHistogram {
|
||||
option deprecated = true;
|
||||
|
||||
repeated IntHistogramDataPoint data_points = 1;
|
||||
|
||||
// aggregation_temporality describes if the aggregator reports delta changes
|
||||
// since last report time, or cumulative changes since a fixed start time.
|
||||
AggregationTemporality aggregation_temporality = 2;
|
||||
}
|
||||
|
||||
// IntExemplar is deprecated. Use Exemplar with as_int for value
|
||||
message IntExemplar {
|
||||
option deprecated = true;
|
||||
|
||||
// The set of labels that were filtered out by the aggregator, but recorded
|
||||
// alongside the original measurement. Only labels that were filtered out
|
||||
// by the aggregator should be included
|
||||
repeated opentelemetry.proto.common.v1.StringKeyValue filtered_labels = 1;
|
||||
|
||||
// time_unix_nano is the exact time when this exemplar was recorded
|
||||
//
|
||||
// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January
|
||||
// 1970.
|
||||
fixed64 time_unix_nano = 2;
|
||||
|
||||
// Numerical int value of the measurement that was recorded.
|
||||
sfixed64 value = 3;
|
||||
|
||||
// (Optional) Span ID of the exemplar trace.
|
||||
// span_id may be missing if the measurement is not recorded inside a trace
|
||||
// or if the trace is not sampled.
|
||||
bytes span_id = 4;
|
||||
|
||||
// (Optional) Trace ID of the exemplar trace.
|
||||
// trace_id may be missing if the measurement is not recorded inside a trace
|
||||
// or if the trace is not sampled.
|
||||
bytes trace_id = 5;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,11 +21,13 @@ import "opentelemetry/proto/common/v1/common.proto";
|
|||
option java_multiple_files = true;
|
||||
option java_package = "io.opentelemetry.proto.resource.v1";
|
||||
option java_outer_classname = "ResourceProto";
|
||||
option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/resource/v1";
|
||||
option go_package = "go.opentelemetry.io/proto/otlp/resource/v1";
|
||||
|
||||
// Resource information.
|
||||
message Resource {
|
||||
// Set of labels that describe the resource.
|
||||
// Set of attributes that describe the resource.
|
||||
// Attribute keys MUST be unique (it is not allowed to have more than one
|
||||
// attribute with the same key).
|
||||
repeated opentelemetry.proto.common.v1.KeyValue attributes = 1;
|
||||
|
||||
// dropped_attributes_count is the number of dropped attributes. If the value is 0, then
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import "opentelemetry/proto/resource/v1/resource.proto";
|
|||
option java_multiple_files = true;
|
||||
option java_package = "io.opentelemetry.proto.trace.v1";
|
||||
option java_outer_classname = "TraceProto";
|
||||
option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/trace/v1";
|
||||
option go_package = "go.opentelemetry.io/proto/otlp/trace/v1";
|
||||
|
||||
// TracesData represents the traces data that can be stored in a persistent storage,
|
||||
// OR can be embedded by other protocols that transfer OTLP traces data but do
|
||||
|
|
@ -43,23 +43,70 @@ message TracesData {
|
|||
repeated ResourceSpans resource_spans = 1;
|
||||
}
|
||||
|
||||
// A collection of InstrumentationLibrarySpans from a Resource.
|
||||
// A collection of ScopeSpans from a Resource.
|
||||
message ResourceSpans {
|
||||
// The resource for the spans in this message.
|
||||
// If this field is not set then no resource info is known.
|
||||
opentelemetry.proto.resource.v1.Resource resource = 1;
|
||||
|
||||
// A list of ScopeSpans that originate from a resource.
|
||||
repeated ScopeSpans scope_spans = 2;
|
||||
|
||||
// A list of InstrumentationLibrarySpans that originate from a resource.
|
||||
repeated InstrumentationLibrarySpans instrumentation_library_spans = 2;
|
||||
// This field is deprecated and will be removed after grace period expires on June 15, 2022.
|
||||
//
|
||||
// During the grace period the following rules SHOULD be followed:
|
||||
//
|
||||
// For Binary Protobufs
|
||||
// ====================
|
||||
// Binary Protobuf senders SHOULD NOT set instrumentation_library_spans. Instead
|
||||
// scope_spans SHOULD be set.
|
||||
//
|
||||
// Binary Protobuf receivers SHOULD check if instrumentation_library_spans is set
|
||||
// and scope_spans is not set then the value in instrumentation_library_spans
|
||||
// SHOULD be used instead by converting InstrumentationLibrarySpans into ScopeSpans.
|
||||
// If scope_spans is set then instrumentation_library_spans SHOULD be ignored.
|
||||
//
|
||||
// For JSON
|
||||
// ========
|
||||
// JSON senders that set instrumentation_library_spans field MAY also set
|
||||
// scope_spans to carry the same spans, essentially double-publishing the same data.
|
||||
// Such double-publishing MAY be controlled by a user-settable option.
|
||||
// If double-publishing is not used then the senders SHOULD set scope_spans and
|
||||
// SHOULD NOT set instrumentation_library_spans.
|
||||
//
|
||||
// JSON receivers SHOULD check if instrumentation_library_spans is set and
|
||||
// scope_spans is not set then the value in instrumentation_library_spans
|
||||
// SHOULD be used instead by converting InstrumentationLibrarySpans into ScopeSpans.
|
||||
// If scope_spans is set then instrumentation_library_spans field SHOULD be ignored.
|
||||
repeated InstrumentationLibrarySpans instrumentation_library_spans = 1000 [deprecated = true];
|
||||
|
||||
// This schema_url applies to the data in the "resource" field. It does not apply
|
||||
// to the data in the "instrumentation_library_spans" field which have their own
|
||||
// schema_url field.
|
||||
// to the data in the "scope_spans" field which have their own schema_url field.
|
||||
string schema_url = 3;
|
||||
}
|
||||
|
||||
// A collection of Spans produced by an InstrumentationScope.
|
||||
message ScopeSpans {
|
||||
// The instrumentation scope information for the spans in this message.
|
||||
// Semantically when InstrumentationScope isn't set, it is equivalent with
|
||||
// an empty instrumentation scope name (unknown).
|
||||
opentelemetry.proto.common.v1.InstrumentationScope scope = 1;
|
||||
|
||||
// A list of Spans that originate from an instrumentation scope.
|
||||
repeated Span spans = 2;
|
||||
|
||||
// This schema_url applies to all spans and span events in the "spans" field.
|
||||
string schema_url = 3;
|
||||
}
|
||||
|
||||
// A collection of Spans produced by an InstrumentationLibrary.
|
||||
// InstrumentationLibrarySpans is wire-compatible with ScopeSpans for binary
|
||||
// Protobuf format.
|
||||
// This message is deprecated and will be removed on June 15, 2022.
|
||||
message InstrumentationLibrarySpans {
|
||||
option deprecated = true;
|
||||
|
||||
// The instrumentation library information for the spans in this message.
|
||||
// Semantically when InstrumentationLibrary isn't set, it is equivalent with
|
||||
// an empty instrumentation library name (unknown).
|
||||
|
|
@ -185,6 +232,8 @@ message Span {
|
|||
//
|
||||
// The OpenTelemetry API specification further restricts the allowed value types:
|
||||
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/common.md#attributes
|
||||
// Attribute keys MUST be unique (it is not allowed to have more than one
|
||||
// attribute with the same key).
|
||||
repeated opentelemetry.proto.common.v1.KeyValue attributes = 9;
|
||||
|
||||
// dropped_attributes_count is the number of attributes that were discarded. Attributes
|
||||
|
|
@ -203,6 +252,8 @@ message Span {
|
|||
string name = 2;
|
||||
|
||||
// attributes is a collection of attribute key/value pairs on the event.
|
||||
// Attribute keys MUST be unique (it is not allowed to have more than one
|
||||
// attribute with the same key).
|
||||
repeated opentelemetry.proto.common.v1.KeyValue attributes = 3;
|
||||
|
||||
// dropped_attributes_count is the number of dropped attributes. If the value is 0,
|
||||
|
|
@ -233,6 +284,8 @@ message Span {
|
|||
string trace_state = 3;
|
||||
|
||||
// attributes is a collection of attribute key/value pairs on the link.
|
||||
// Attribute keys MUST be unique (it is not allowed to have more than one
|
||||
// attribute with the same key).
|
||||
repeated opentelemetry.proto.common.v1.KeyValue attributes = 4;
|
||||
|
||||
// dropped_attributes_count is the number of dropped attributes. If the value is 0,
|
||||
|
|
@ -256,72 +309,7 @@ message Span {
|
|||
// The Status type defines a logical error model that is suitable for different
|
||||
// programming environments, including REST APIs and RPC APIs.
|
||||
message Status {
|
||||
// IMPORTANT: Backward compatibility notes:
|
||||
//
|
||||
// To ensure any pair of senders and receivers continues to correctly signal and
|
||||
// interpret erroneous situations, the senders and receivers MUST follow these rules:
|
||||
//
|
||||
// 1. Old senders and receivers that are not aware of `code` field will continue using
|
||||
// the `deprecated_code` field to signal and interpret erroneous situation.
|
||||
//
|
||||
// 2. New senders, which are aware of the `code` field MUST set both the
|
||||
// `deprecated_code` and `code` fields according to the following rules:
|
||||
//
|
||||
// if code==STATUS_CODE_UNSET then `deprecated_code` MUST be
|
||||
// set to DEPRECATED_STATUS_CODE_OK.
|
||||
//
|
||||
// if code==STATUS_CODE_OK then `deprecated_code` MUST be
|
||||
// set to DEPRECATED_STATUS_CODE_OK.
|
||||
//
|
||||
// if code==STATUS_CODE_ERROR then `deprecated_code` MUST be
|
||||
// set to DEPRECATED_STATUS_CODE_UNKNOWN_ERROR.
|
||||
//
|
||||
// These rules allow old receivers to correctly interpret data received from new senders.
|
||||
//
|
||||
// 3. New receivers MUST look at both the `code` and `deprecated_code` fields in order
|
||||
// to interpret the overall status:
|
||||
//
|
||||
// If code==STATUS_CODE_UNSET then the value of `deprecated_code` is the
|
||||
// carrier of the overall status according to these rules:
|
||||
//
|
||||
// if deprecated_code==DEPRECATED_STATUS_CODE_OK then the receiver MUST interpret
|
||||
// the overall status to be STATUS_CODE_UNSET.
|
||||
//
|
||||
// if deprecated_code!=DEPRECATED_STATUS_CODE_OK then the receiver MUST interpret
|
||||
// the overall status to be STATUS_CODE_ERROR.
|
||||
//
|
||||
// If code!=STATUS_CODE_UNSET then the value of `deprecated_code` MUST be
|
||||
// ignored, the `code` field is the sole carrier of the status.
|
||||
//
|
||||
// These rules allow new receivers to correctly interpret data received from old senders.
|
||||
|
||||
enum DeprecatedStatusCode {
|
||||
DEPRECATED_STATUS_CODE_OK = 0;
|
||||
DEPRECATED_STATUS_CODE_CANCELLED = 1;
|
||||
DEPRECATED_STATUS_CODE_UNKNOWN_ERROR = 2;
|
||||
DEPRECATED_STATUS_CODE_INVALID_ARGUMENT = 3;
|
||||
DEPRECATED_STATUS_CODE_DEADLINE_EXCEEDED = 4;
|
||||
DEPRECATED_STATUS_CODE_NOT_FOUND = 5;
|
||||
DEPRECATED_STATUS_CODE_ALREADY_EXISTS = 6;
|
||||
DEPRECATED_STATUS_CODE_PERMISSION_DENIED = 7;
|
||||
DEPRECATED_STATUS_CODE_RESOURCE_EXHAUSTED = 8;
|
||||
DEPRECATED_STATUS_CODE_FAILED_PRECONDITION = 9;
|
||||
DEPRECATED_STATUS_CODE_ABORTED = 10;
|
||||
DEPRECATED_STATUS_CODE_OUT_OF_RANGE = 11;
|
||||
DEPRECATED_STATUS_CODE_UNIMPLEMENTED = 12;
|
||||
DEPRECATED_STATUS_CODE_INTERNAL_ERROR = 13;
|
||||
DEPRECATED_STATUS_CODE_UNAVAILABLE = 14;
|
||||
DEPRECATED_STATUS_CODE_DATA_LOSS = 15;
|
||||
DEPRECATED_STATUS_CODE_UNAUTHENTICATED = 16;
|
||||
};
|
||||
|
||||
// The deprecated status code. This is an optional field.
|
||||
//
|
||||
// This field is deprecated and is replaced by the `code` field below. See backward
|
||||
// compatibility notes below. According to our stability guarantees this field
|
||||
// will be removed in 12 months, on Oct 22, 2021. All usage of old senders and
|
||||
// receivers that do not understand the `code` field MUST be phased out by then.
|
||||
DeprecatedStatusCode deprecated_code = 1 [deprecated=true];
|
||||
reserved 1;
|
||||
|
||||
// A developer-facing human readable error message.
|
||||
string message = 2;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ package opentelemetry.proto.trace.v1;
|
|||
option java_multiple_files = true;
|
||||
option java_package = "io.opentelemetry.proto.trace.v1";
|
||||
option java_outer_classname = "TraceConfigProto";
|
||||
option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/collector/trace/v1";
|
||||
option go_package = "go.opentelemetry.io/proto/otlp/collector/trace/v1";
|
||||
|
||||
// Global configuration of the trace service. All fields must be specified, or
|
||||
// the default (zero) values will be used for each type.
|
||||
|
|
|
|||
|
|
@ -178,11 +178,11 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests
|
|||
Assert.Contains(otlpResource.Attributes, (kvp) => kvp.Key == ResourceSemanticConventions.AttributeServiceName && kvp.Value.ToString().Contains("unknown_service:"));
|
||||
}
|
||||
|
||||
Assert.Single(resourceMetric.InstrumentationLibraryMetrics);
|
||||
var instrumentationLibraryMetrics = resourceMetric.InstrumentationLibraryMetrics.First();
|
||||
Assert.Single(resourceMetric.ScopeMetrics);
|
||||
var instrumentationLibraryMetrics = resourceMetric.ScopeMetrics.First();
|
||||
Assert.Equal(string.Empty, instrumentationLibraryMetrics.SchemaUrl);
|
||||
Assert.Equal(meter.Name, instrumentationLibraryMetrics.InstrumentationLibrary.Name);
|
||||
Assert.Equal("0.0.1", instrumentationLibraryMetrics.InstrumentationLibrary.Version);
|
||||
Assert.Equal(meter.Name, instrumentationLibraryMetrics.Scope.Name);
|
||||
Assert.Equal("0.0.1", instrumentationLibraryMetrics.Scope.Version);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -216,8 +216,8 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests
|
|||
request.AddMetrics(ResourceBuilder.CreateEmpty().Build().ToOtlpResource(), batch);
|
||||
|
||||
var resourceMetric = request.ResourceMetrics.Single();
|
||||
var instrumentationLibraryMetrics = resourceMetric.InstrumentationLibraryMetrics.Single();
|
||||
var actual = instrumentationLibraryMetrics.Metrics.Single();
|
||||
var scopeMetrics = resourceMetric.ScopeMetrics.Single();
|
||||
var actual = scopeMetrics.Metrics.Single();
|
||||
|
||||
Assert.Equal(name, actual.Name);
|
||||
Assert.Equal(description ?? string.Empty, actual.Description);
|
||||
|
|
@ -250,13 +250,6 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests
|
|||
Assert.Empty(dataPoint.Attributes);
|
||||
|
||||
Assert.Empty(dataPoint.Exemplars);
|
||||
|
||||
#pragma warning disable CS0612 // Type or member is obsolete
|
||||
Assert.Null(actual.IntGauge);
|
||||
Assert.Null(actual.IntSum);
|
||||
Assert.Null(actual.IntHistogram);
|
||||
Assert.Empty(dataPoint.Labels);
|
||||
#pragma warning restore CS0612 // Type or member is obsolete
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -298,8 +291,8 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests
|
|||
request.AddMetrics(ResourceBuilder.CreateEmpty().Build().ToOtlpResource(), batch);
|
||||
|
||||
var resourceMetric = request.ResourceMetrics.Single();
|
||||
var instrumentationLibraryMetrics = resourceMetric.InstrumentationLibraryMetrics.Single();
|
||||
var actual = instrumentationLibraryMetrics.Metrics.Single();
|
||||
var scopeMetrics = resourceMetric.ScopeMetrics.Single();
|
||||
var actual = scopeMetrics.Metrics.Single();
|
||||
|
||||
Assert.Equal(name, actual.Name);
|
||||
Assert.Equal(description ?? string.Empty, actual.Description);
|
||||
|
|
@ -346,13 +339,6 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests
|
|||
}
|
||||
|
||||
Assert.Empty(dataPoint.Exemplars);
|
||||
|
||||
#pragma warning disable CS0612 // Type or member is obsolete
|
||||
Assert.Null(actual.IntGauge);
|
||||
Assert.Null(actual.IntSum);
|
||||
Assert.Null(actual.IntHistogram);
|
||||
Assert.Empty(dataPoint.Labels);
|
||||
#pragma warning restore CS0612 // Type or member is obsolete
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -394,8 +380,8 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests
|
|||
request.AddMetrics(ResourceBuilder.CreateEmpty().Build().ToOtlpResource(), batch);
|
||||
|
||||
var resourceMetric = request.ResourceMetrics.Single();
|
||||
var instrumentationLibraryMetrics = resourceMetric.InstrumentationLibraryMetrics.Single();
|
||||
var actual = instrumentationLibraryMetrics.Metrics.Single();
|
||||
var scopeMetrics = resourceMetric.ScopeMetrics.Single();
|
||||
var actual = scopeMetrics.Metrics.Single();
|
||||
|
||||
Assert.Equal(name, actual.Name);
|
||||
Assert.Equal(description ?? string.Empty, actual.Description);
|
||||
|
|
@ -453,13 +439,6 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests
|
|||
}
|
||||
|
||||
Assert.Empty(dataPoint.Exemplars);
|
||||
|
||||
#pragma warning disable CS0612 // Type or member is obsolete
|
||||
Assert.Null(actual.IntGauge);
|
||||
Assert.Null(actual.IntSum);
|
||||
Assert.Null(actual.IntHistogram);
|
||||
Assert.Empty(dataPoint.Labels);
|
||||
#pragma warning restore CS0612 // Type or member is obsolete
|
||||
}
|
||||
|
||||
private static IEnumerable<KeyValuePair<string, object>> ToAttributes(object[] keysValues)
|
||||
|
|
|
|||
|
|
@ -190,25 +190,25 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests
|
|||
Assert.Contains(otlpResource.Attributes, (kvp) => kvp.Key == ResourceSemanticConventions.AttributeServiceName && kvp.Value.ToString().Contains("unknown_service:"));
|
||||
}
|
||||
|
||||
foreach (var instrumentationLibrarySpans in request.ResourceSpans.First().InstrumentationLibrarySpans)
|
||||
foreach (var scope in request.ResourceSpans.First().ScopeSpans)
|
||||
{
|
||||
Assert.Equal(numOfSpans / 2, instrumentationLibrarySpans.Spans.Count);
|
||||
Assert.NotNull(instrumentationLibrarySpans.InstrumentationLibrary);
|
||||
Assert.Equal(numOfSpans / 2, scope.Spans.Count);
|
||||
Assert.NotNull(scope.Scope);
|
||||
|
||||
var expectedSpanNames = new List<string>();
|
||||
var start = instrumentationLibrarySpans.InstrumentationLibrary.Name == "even" ? 0 : 1;
|
||||
var start = scope.Scope.Name == "even" ? 0 : 1;
|
||||
for (var i = start; i < numOfSpans; i += 2)
|
||||
{
|
||||
expectedSpanNames.Add($"span-{i}");
|
||||
}
|
||||
|
||||
var otlpSpans = instrumentationLibrarySpans.Spans;
|
||||
var otlpSpans = scope.Spans;
|
||||
Assert.Equal(expectedSpanNames.Count, otlpSpans.Count);
|
||||
|
||||
var kv0 = new OtlpCommon.KeyValue { Key = "k0", Value = new OtlpCommon.AnyValue { StringValue = "v0" } };
|
||||
var kv1 = new OtlpCommon.KeyValue { Key = "k1", Value = new OtlpCommon.AnyValue { StringValue = "v1" } };
|
||||
|
||||
var expectedTag = instrumentationLibrarySpans.InstrumentationLibrary.Name == "even"
|
||||
var expectedTag = scope.Scope.Name == "even"
|
||||
? kv0
|
||||
: kv1;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue