OpenTelemetryTracer

Overview

Config yaml format becomes like below. And the resource specific spec is defined in in the proto format shown in the Resource Definition.

apiVersion: app/v1
kind: OpenTelemetryTracer
metadata:
  name: "default"
  namespace: "default"
spec: {}

Resource Definition

OpenTelemetryTracer is defined in the proto/app/v1/o11y/oteltracer.proto

  1syntax = "proto3";
  2package app.v1;
  3
  4import "buf/validate/validate.proto";
  5import "kernel/network.proto";
  6import "kernel/resource.proto";
  7
  8option go_package = "github.com/aileron-gateway/aileron-gateway/apis/app/v1";
  9
 10// OpenTelemetryTracer resource definition.
 11// apiVersion="app/v1", kind="OpenTelemetryTracer".
 12message OpenTelemetryTracer {
 13    string                  APIVersion = 1 [json_name = "apiVersion"];
 14    string                  Kind       = 2 [json_name = "kind"];
 15    kernel.Metadata         Metadata   = 3 [json_name = "metadata"];
 16    OpenTelemetryTracerSpec Spec       = 4 [json_name = "spec"];
 17}
 18
 19// OpenTelemetryTracerSpec is the specifications for the OpenTelemetryTracer object.
 20message OpenTelemetryTracerSpec {
 21    // [OPTIONAL]
 22    // ServiceName is the value for "service.name" semantic conventions.
 23    // If not set or empty, a default value is used.
 24    // Default is ["gateway"].
 25    string ServiceName = 1 [json_name = "serviceName"];
 26
 27    // [OPTIONAL]
 28    // LibraryName is the value for "otel.library.name" in span tags.
 29    // If empty or not set, go package name is used.
 30    string LibraryName = 2 [json_name = "libraryName"];
 31
 32    // [OPTIONAL]
 33    // PropagationTypes are the types of trace context propagators.
 34    // If not set, default values are used.
 35    // Default list is [W3CTraceContext, W3CBaggage].
 36    repeated PropagationType PropagationTypes = 3 [json_name = "propagationTypes"];
 37
 38    // [OPTIONAL]
 39    // TraceIDRatioBased samples a given fraction of traces.
 40    // Fractions >= 1 will always sample.
 41    // Fractions < 0 are treated as zero.
 42    // Default is [1.0], or sample all.
 43    float TraceIDRatioBased = 4 [json_name = "traceIDRatioBased"];
 44
 45    // [OPTIONAL]
 46    // TracerProviderBatch is the batch configuration for span processors.
 47    // Default configuration is used if not set.
 48    TracerProviderBatchSpec TracerProviderBatch = 5 [json_name = "tracerProviderBatch"];
 49
 50    // [OPTIONAL]
 51    // TracerProviderLimit is the limit configuration for span processors.
 52    // Default configuration is used if not set.
 53    TracerProviderLimitSpec TracerProviderLimit = 6 [json_name = "tracerProviderLimit"];
 54
 55    // [OPTIONAL]
 56    // Headers are the http header names that are added to the span attributes.
 57    // Default is not set.
 58    repeated string Headers = 7 [json_name = "headers"];
 59
 60    oneof Exporters {
 61        HTTPTraceExporterSpec   HTTPExporterSpec   = 10 [json_name = "httpExporter"];
 62        GRPCTraceExporterSpec   GRPCExporterSpec   = 11 [json_name = "grpcExporter"];
 63        StdoutTraceExporterSpec StdoutExporterSpec = 12 [json_name = "stdoutExporter"];
 64        ZipkinTraceExporterSpec ZipkinExporterSpec = 13 [json_name = "zipkinExporter"];
 65    }
 66}
 67
 68enum PropagationType {
 69    W3CTraceContext = 0;  // W3C Trace Context format
 70    W3CBaggage      = 1;  // W3C Baggage format
 71    B3              = 2;  // B3 format
 72    Jaeger          = 3;  // Jaeger format
 73    XRay            = 4;  // AWS X-Ray format
 74    OpenCensus      = 5;  // OpenCensus Binary format
 75    OpenTracing     = 6;  // OpenTracing format
 76}
 77
 78message TracerProviderBatchSpec {
 79    // [OPTIONAL]
 80    // MaxQueueSize the maximum queue size allowed for a BatchSpanProcessor.
 81    // Default is [2048].
 82    int32 MaxQueueSize = 1 [json_name = "maxQueueSize"];
 83
 84    // [OPTIONAL]
 85    // BatchTimeout is the maximum delay in seconds allowed for a BatchSpanProcessor
 86    // before it will export any held span (whether the queue is full or not).
 87    // Default is [5] seconds.
 88    int32 BatchTimeout = 2 [json_name = "batchTimeout"];
 89
 90    // [OPTIONAL]
 91    // ExportTimeout is the amount of time a BatchSpanProcessor waits for an exporter
 92    // to export before abandoning the export.
 93    // Default is [30] seconds.
 94    int32 ExportTimeout = 3 [json_name = "exportTimeout"];
 95
 96    // [OPTIONAL]
 97    // MaxExportBatchSize is the maximum export batch size allowed for a BatchSpanProcessor.
 98    // Default is [512].
 99    int32 MaxExportBatchSize = 4 [json_name = "maxExportBatchSize"];
100
101    // [OPTIONAL]
102    // Blocking, if true, wait for enqueue operations to succeed
103    // instead of dropping data when the queue is full.
104    // Default is [false].
105    bool Blocking = 5 [json_name = "blocking"];
106}
107
108message TracerProviderLimitSpec {
109    // [OPTIONAL]
110    // AttributeValueLengthLimit is the maximum allowed attribute value length.
111    // This limit only applies to string and string slice attribute values.
112    // Any string longer than this value will be truncated to this length.
113    // Setting this to a negative value means no limit is applied.
114    // Zero is the same with default value.
115    // Default is [-1].
116    int32 AttributeValueLengthLimit = 1 [json_name = "attributeValueLengthLimit"];
117
118    // [OPTIONAL]
119    // AttributeCountLimit is the maximum allowed span attribute count.
120    // Any attribute added to a span once this limit is reached will be dropped.
121    // Setting this to a negative value means no limit is applied.
122    // Zero is the same with default value.
123    // Default is [-1].
124    int32 AttributeCountLimit = 2 [json_name = "attributeCountLimit"];
125
126    // [OPTIONAL]
127    // EventCountLimit is the maximum allowed span event count.
128    // Any event added to a span once this limit is reached means it will be added but the oldest event will be dropped.
129    // Setting this to a negative value means no limit is applied.
130    // Zero is the same with default value.
131    // Default is [-1].
132    int32 EventCountLimit = 3 [json_name = "eventCountLimit"];
133
134    // [OPTIONAL]
135    // LinkCountLimit is the maximum allowed span link count.
136    // Any link added to a span once this limit is reached means it will be added but the oldest link will be dropped.
137    // Setting this to a negative value means no limit is applied.
138    // Zero is the same with default value.
139    // Default is [-1].
140    int32 LinkCountLimit = 4 [json_name = "linkCountLimit"];
141
142    // [OPTIONAL]
143    // AttributePerEventCountLimit is the maximum number of attributes allowed per span event.
144    // Any attribute added after this limit reached will be dropped.
145    // Setting this to a negative value means no limit is applied.
146    // Zero is the same with default value.
147    // Default is [-1].
148    int32 AttributePerEventCountLimit = 5 [json_name = "attributePerEventCountLimit"];
149
150    // [OPTIONAL]
151    // AttributePerLinkCountLimit is the maximum number of attributes allowed per span link.
152    // Any attribute added after this limit reached will be dropped.
153    // Setting this to a negative value means no limit is applied.
154    // Zero is the same with default value.
155    // Default is [-1].
156    int32 AttributePerLinkCountLimit = 6 [json_name = "attributePerLinkCountLimit"];
157}
158
159message HTTPTraceExporterSpec {
160    // [OPTIONAL]
161    // EndpointURL is the target endpoint URL (scheme, host, port, path)
162    // the Exporter will connect to.
163    // If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_TRACES_ENDPOINT environment variable is set,
164    // and this option is not passed, that variable value will be used.
165    // If both environment variables are set, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT will take precedence.
166    // If an environment variable is set, and this option is passed, this option will take precedence.
167    // if an environment variable is not set, and this option is not passed, "localhost:4318" will be used.
168    // Default is not set.
169    string EndpointURL = 1 [json_name = "endpointURL"];
170
171    // [OPTIONAL]
172    // Headers is the additional HTTP headers sent with payloads.
173    // Default is not set.
174    map<string, string> Headers = 2 [json_name = "headers"];
175
176    // [OPTIONAL]
177    // Compress is the flag to compress data when sending to collectors.
178    // Default is [false.]
179    bool Compress = 3 [json_name = "compress"];
180
181    // [OPTIONAL]
182    // Insecure is the flag use HTTP instead of HTTPS.
183    // Default is [false].
184    bool Insecure = 4 [json_name = "insecure"];
185
186    // [OPTIONAL]
187    // TLSConfig is the TLS configuration to use when connecting backend using HTTPS.
188    // Default is not set.
189    kernel.TLSConfig TLSConfig = 5 [json_name = "tlsConfig"];
190
191    // [OPTIONAL]
192    // Timeout is the timeout seconds of the driver's the max waiting time for
193    // the backend to process each spans batch.
194    // If zero or negative, or not set, the default will be 10 seconds.
195    // Default is not set.
196    int32 Timeout = 6 [json_name = "timeout"];
197
198    // [OPTIONAL]
199    // OTLPRetry is the retry policy for transient retryable errors that may be returned
200    // by the target endpoint when exporting a batch of spans.
201    // If not set, the default retry policy will be used.
202    // It will retry the export 5 seconds after receiving a retryable error and
203    // increase exponentially after each error for no more than a total time of 1 minute.
204    // Default is not set.
205    OTLPTraceRetrySpec OTLPRetry = 7 [json_name = "otlpRetry"];
206}
207
208message GRPCTraceExporterSpec {
209    // [OPTIONAL]
210    // EndpointURL is the target endpoint URL (scheme, host, port, path)
211    // the Exporter will connect to.
212    // If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_TRACES_ENDPOINT environment variable is set,
213    // and this option is not passed, that variable value will be used.
214    // If both environment variables are set, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT will take precedence.
215    // If an environment variable is set, and this option is passed, this option will take precedence.
216    // if an environment variable is not set, and this option is not passed, "localhost:4317" will be used.
217    // Default is not set.
218    string EndpointURL = 1 [json_name = "endpointURL"];
219
220    // [OPTIONAL]
221    // Headers is the additional HTTP headers sent with payloads.
222    // Default is not set.
223    map<string, string> Headers = 2 [json_name = "headers"];
224
225    // [OPTIONAL]
226    // Compress is the flag to compress data when sending to collectors.
227    // Default is [false.]
228    bool Compress = 3 [json_name = "compress"];
229
230    // [OPTIONAL]
231    // Insecure is the flag use HTTP instead of HTTPS.
232    // Default is [false].
233    bool Insecure = 4 [json_name = "insecure"];
234
235    // [OPTIONAL]
236    // TLSConfig is the TLS configuration to use
237    // when connecting backend using HTTPS.
238    // Default is not set.
239    kernel.TLSConfig TLSConfig = 5 [json_name = "tlsConfig"];
240
241    // [OPTIONAL]
242    // Timeout is the timeout seconds of the driver's the max waiting time for
243    // the backend to process each spans batch.
244    // If zero or negative, or not set, the default will be 10 seconds.
245    // Default is not set.
246    int32 Timeout = 6 [json_name = "timeout"];
247
248    // [OPTIONAL]
249    // OTLPRetry is the retry policy for transient retryable errors that may be returned
250    // by the target endpoint when exporting a batch of spans.
251    // If the target endpoint responds with not only a retryable error,
252    // but explicitly returns a backoff time in the response.
253    // That time will take precedence over these settings.
254    // These settings do not define any network retry strategy.
255    // That is entirely handled by the gRPC ClientConn.
256    // If not set, the default retry policy will be used.
257    // It will retry the export 5 seconds after receiving a retryable error and
258    // increase exponentially after each error for no more than a total time of 1 minute.
259    // Default is not set.
260    OTLPTraceRetrySpec OTLPRetry = 7 [json_name = "otlpRetry"];
261
262    // [OPTIONAL]
263    // ReconnectionPeriod is the minimum amount of time in seconds
264    // between connection attempts to the target endpoint.
265    // If zero or negative, or not set, this option has no effect.
266    // Default is not set.
267    int32 ReconnectionPeriod = 8 [json_name = "reconnectionPeriod"];
268
269    // [OPTIONAL]
270    // ServiceConfig is the gRPC service config string.
271    // See https://github.com/grpc/grpc/blob/master/doc/service_config.md
272    // Default is not set.
273    string ServiceConfig = 9 [json_name = "serviceConfig"];
274}
275
276message StdoutTraceExporterSpec {
277    // [OPTIONAL]
278    // PrettyPrint is the flag to prettifies the emitted output.
279    // Default is [false].
280    bool PrettyPrint = 1 [json_name = "prettyPrint"];
281
282    // [OPTIONAL]
283    // WithoutTimestamps is the flag to make the export stream not include timestamps.
284    // Default is [false].
285    bool WithoutTimestamps = 2 [json_name = "withoutTimestamps"];
286}
287
288message ZipkinTraceExporterSpec {
289    // [OPTIONAL]
290    // Headers configures the exporter to use the configured HTTP request headers.
291    // Default is not set.
292    map<string, string> Headers = 1 [json_name = "headers"];
293
294    // [OPTIONAL]
295    // EndpointURL is the url of a collector.
296    // Environmental variable OTEL_EXPORTER_ZIPKIN_ENDPOINT overrides this value.
297    // If not set or empty, following default value is used.
298    // "http://localhost:9411/api/v2/spans".
299    // Default is not set.
300    string EndpointURL = 2 [json_name = "endpointURL"];
301}
302
303message OTLPTraceRetrySpec {
304    // [OPTIONAL]
305    // Enabled indicates whether to not retry sending batches in case of export failure.
306    // Default is [false].
307    bool Enabled = 1 [json_name = "enabled"];
308
309    // [OPTIONAL]
310    // InitialInterval is the time to wait after the first failure before retrying.
311    // Value is in seconds.
312    // If zero or not set, default value is used.
313    // Default is not set.
314    int32 InitialInterval = 2 [json_name = "initialInterval", (buf.validate.field).int32 = {gte : 0, lte : 600}];
315
316    // [OPTIONAL]
317    // MaxInterval is the upper bound on backoff interval.
318    // Once this value is reached the delay between consecutive retries will always be `MaxInterval`.
319    // Value is in seconds.
320    // If zero or not set, default value is used.
321    // Default is not set.
322    int32 MaxInterval = 3 [json_name = "maxInterval", (buf.validate.field).int32 = {gte : 0, lte : 600}];
323
324    // [OPTIONAL]
325    // MaxElapsedTime is the maximum amount of time (including retries) spent trying to send a request/batch.
326    // Once this value is reached, the data is discarded.
327    // Value is in seconds.
328    // If zero or not set, default value is used.
329    // Default is not set.
330    int32 MaxElapsedTime = 4 [json_name = "maxElapsedTime", (buf.validate.field).int32 = {gte : 0, lte : 1800}];
331}
332
333message K8sAttributesSpec {
334    string ClusterName           = 1 [json_name = "clusterName"];
335    string ContainerName         = 2 [json_name = "containerName"];
336    string ContainerRestartCount = 3 [json_name = "containerRestartCount"];
337    string CronJobName           = 4 [json_name = "cronJobName"];
338    string CronJobUID            = 5 [json_name = "cronJobUID"];
339    string DaemonSetName         = 6 [json_name = "daemonSetName"];
340    string DaemonSetUID          = 7 [json_name = "daemonSetUID"];
341    string DeploymentName        = 8 [json_name = "deploymentName"];
342    string DeploymentUID         = 9 [json_name = "deploymentUID"];
343    string JobName               = 10 [json_name = "jobName"];
344    string JobUID                = 11 [json_name = "jobUID"];
345    string NamespaceName         = 12 [json_name = "namespaceName"];
346    string NodeName              = 13 [json_name = "nodeName"];
347    string NodeUID               = 14 [json_name = "nodeUID"];
348    string PodName               = 15 [json_name = "podName"];
349    string PodUID                = 16 [json_name = "podUID"];
350    string ReplicaSetName        = 17 [json_name = "replicaSetName"];
351    string ReplicaSetUID         = 18 [json_name = "replicaSetUID"];
352    string StatefulSetName       = 19 [json_name = "statefulSetName"];
353    string StatefulSetUID        = 20 [json_name = "statefulSetUID"];
354}
355
356message ContainerAttributesSpec {
357    string ID        = 1 [json_name = "id"];
358    string ImageName = 2 [json_name = "imageName"];
359    string ImageTag  = 3 [json_name = "imageTag"];
360    string Name      = 4 [json_name = "name"];
361    string Runtime   = 5 [json_name = "runtime"];
362}
363
364message HostAttributesSpec {
365    string ID           = 1 [json_name = "id"];
366    string ImageID      = 2 [json_name = "imageID"];
367    string ImageName    = 3 [json_name = "imageName"];
368    string ImageVersion = 4 [json_name = "imageVersion"];
369    string Name         = 5 [json_name = "name"];
370    string Type         = 6 [json_name = "type"];
371}

最終更新 June 7, 2025: add japanese (f2a41f1)