OpenTelemetryMeter

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: OpenTelemetryMeter
metadata:
  name: "default"
  namespace: "default"
spec: {}

Resource Definition

OpenTelemetryMeter is defined in the proto/app/v1/o11y/otelmeter.proto

  1syntax = "proto3";
  2package app.v1;
  3
  4import "buf/validate/validate.proto";
  5import "kernel/resource.proto";
  6import "kernel/network.proto";
  7
  8option go_package = "github.com/aileron-gateway/aileron-gateway/apis/app/v1";
  9
 10// OpenTelemetryMeter resource definition.
 11// apiVersion="app/v1", kind="OpenTelemetryMeter".
 12message OpenTelemetryMeter {
 13    string                 APIVersion = 1 [json_name = "apiVersion"];
 14    string                 Kind       = 2 [json_name = "kind"];
 15    kernel.Metadata        Metadata   = 3 [json_name = "metadata"];
 16    OpenTelemetryMeterSpec Spec       = 4 [json_name = "spec"];
 17}
 18
 19// OpenTelemetryMeterSpec is the specifications of the OpenTelemetryMeter object.
 20message OpenTelemetryMeterSpec {
 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 OpenTelemetry meter name.
 29    // If not set or empty, go package name is used.
 30    string LibraryName = 2 [json_name = "libraryName"];
 31
 32    // [OPTIONAL]
 33    // PeriodicReader is the configuration of a collector that collects and
 34    // exports metric data to the exporter at a defined interval.
 35    // Default configuration is used if not set.
 36    PeriodicReaderSpec PeriodicReader = 5 [json_name = "periodicReader"];
 37
 38    oneof Exporters {
 39        HTTPMetricsExporterSpec   HTTPExporterSpec   = 10 [json_name = "httpExporter"];
 40        GRPCMetricsExporterSpec   GRPCExporterSpec   = 11 [json_name = "grpcExporter"];
 41        StdoutMetricsExporterSpec StdoutExporterSpec = 12 [json_name = "stdoutExporter"];
 42    }
 43}
 44
 45message HTTPMetricsExporterSpec {
 46    // [OPTIONAL]
 47    // EndpointURL is the target endpoint URL (scheme, host, port, path)
 48    // the Exporter will connect to.
 49    // If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT environment variable is set,
 50    // and this option is not passed, that variable value will be used.
 51    // If both environment variables are set, OTEL_EXPORTER_OTLP_METRICS_ENDPOINT will take precedence.
 52    // If an environment variable is set, and this option is passed, this option will take precedence.
 53    // if an environment variable is not set, and this option is not passed, "localhost:4318" will be used.
 54    // Default is not set.
 55    string EndpointURL = 1 [json_name = "endpointURL"];
 56
 57    // [OPTIONAL]
 58    // Headers is the additional HTTP headers sent with payloads.
 59    // Default is not set.
 60    map<string, string> Headers = 2 [json_name = "headers"];
 61
 62    // [OPTIONAL]
 63    // Compress is the flag to compress data when sending to collectors.
 64    // Default is [false].
 65    bool Compress = 3 [json_name = "compress"];
 66
 67    // [OPTIONAL]
 68    // Insecure is the flag use HTTP instead of HTTPS.
 69    // Default is [false].
 70    bool Insecure = 4 [json_name = "insecure"];
 71
 72    // [OPTIONAL]
 73    // TLSConfig is the TLS configuration to use when connecting backend using HTTPS.
 74    // Default is not set.
 75    kernel.TLSConfig TLSConfig = 5 [json_name = "tlsConfig"];
 76
 77    // [OPTIONAL]
 78    // Timeout is the timeout seconds of the driver's the max waiting time for
 79    // the backend to process each spans batch.
 80    // If zero or negative, or not set, the default will be 10 seconds.
 81    // Default is not set.
 82    int32 Timeout = 6 [json_name = "timeout"];
 83
 84    // [OPTIONAL]
 85    // OTLPRetry is the retry policy for transient retry-able errors that may be returned
 86    // by the target endpoint when exporting a batch of spans.
 87    // If not set, the default retry policy will be used.
 88    // It will retry the export 5 seconds after receiving a retry-able error and
 89    // increase exponentially after each error for no more than a total time of 1 minute.
 90    // Default is not set.
 91    OTLPMetricsRetrySpec OTLPRetry = 7 [json_name = "otlpRetry"];
 92}
 93
 94message GRPCMetricsExporterSpec {
 95    // [OPTIONAL]
 96    // EndpointURL is the target endpoint URL (scheme, host, port, path)
 97    // the Exporter will connect to.
 98    // If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT environment variable is set,
 99    // and this option is not passed, that variable value will be used.
100    // If both environment variables are set, OTEL_EXPORTER_OTLP_METRICS_ENDPOINT will take precedence.
101    // If an environment variable is set, and this option is passed, this option will take precedence.
102    // if an environment variable is not set, and this option is not passed, "localhost:4317" will be used.
103    // Default is not set.
104    string EndpointURL = 1 [json_name = "endpointURL"];
105
106    // [OPTIONAL]
107    // Headers is the additional HTTP headers sent with payloads.
108    // Default is not set.
109    map<string, string> Headers = 2 [json_name = "headers"];
110
111    // [OPTIONAL]
112    // Compress is the flag to compress data when sending to collectors.
113    // Default is [false].
114    bool Compress = 3 [json_name = "compress"];
115
116    // [OPTIONAL]
117    // Insecure is the flag use HTTP instead of HTTPS.
118    // Default is [false].
119    bool Insecure = 4 [json_name = "insecure"];
120
121    // [OPTIONAL]
122    // TLSConfig is the TLS configuration to use
123    // when connecting backend using HTTPS.
124    // Default is not set.
125    kernel.TLSConfig TLSConfig = 5 [json_name = "tlsConfig"];
126
127    // [OPTIONAL]
128    // Timeout is the timeout seconds of the driver's the max waiting time for
129    // the backend to process each spans batch.
130    // If zero or negative, or not set, the default will be 10 seconds.
131    // Default is not set.
132    int32 Timeout = 6 [json_name = "timeout"];
133
134    // [OPTIONAL]
135    // OTLPRetry is the retry policy for transient retryable errors that may be returned
136    // by the target endpoint when exporting a batch of spans.
137    // If the target endpoint responds with not only a retryable error,
138    // but explicitly returns a backoff time in the response.
139    // That time will take precedence over these settings.
140    // These settings do not define any network retry strategy.
141    // That is entirely handled by the gRPC ClientConn.
142    // If not set, the default retry policy will be used.
143    // It will retry the export 5 seconds after receiving a retryable error and
144    // increase exponentially after each error for no more than a total time of 1 minute.
145    // Default is not set.
146    OTLPMetricsRetrySpec OTLPRetry = 7 [json_name = "otlpRetry"];
147
148    // [OPTIONAL]
149    // ReconnectionPeriod is the minimum amount of time in seconds
150    // between connection attempts to the target endpoint.
151    // If zero or negative, or not set, this option has no effect.
152    // Default is not set.
153    int32 ReconnectionPeriod = 8 [json_name = "reconnectionPeriod"];
154
155    // [OPTIONAL]
156    // ServiceConfig is the gRPC service config string.
157    // See https://github.com/grpc/grpc/blob/master/doc/service_config.md
158    // Default is not set.
159    string ServiceConfig = 9 [json_name = "serviceConfig"];
160}
161
162message StdoutMetricsExporterSpec {
163    // [OPTIONAL]
164    // PrettyPrint is the flag to prettifies the emitted output.
165    // Default is [false].
166    bool PrettyPrint = 1 [json_name = "prettyPrint"];
167
168    // [OPTIONAL]
169    // WithoutTimestamps is the flag to make the export stream not include timestamps.
170    // Default is [false].
171    bool WithoutTimestamps = 2 [json_name = "timestamps"];
172}
173
174message OTLPMetricsRetrySpec {
175    // [OPTIONAL]
176    // Enabled indicates whether to not retry sending batches in case of export failure.
177    // Default is [false].
178    bool Enabled = 1 [json_name = "enabled"];
179
180    // [OPTIONAL]
181    // InitialInterval is the time to wait after the first failure before retrying.
182    // Value is in seconds.
183    // If zero or not set, default value is used.
184    // Default is not set.
185    int32 InitialInterval = 2 [json_name = "initialInterval", (buf.validate.field).int32 = {gte : 0, lte : 600}];
186
187    // [OPTIONAL]
188    // MaxInterval is the upper bound on backoff interval.
189    // Once this value is reached the delay between consecutive retries will always be `MaxInterval`.
190    // Value is in seconds.
191    // If zero or not set, default value is used.
192    // Default is not set.
193    int32 MaxInterval = 3 [json_name = "maxInterval", (buf.validate.field).int32 = {gte : 0, lte : 600}];
194
195    // [OPTIONAL]
196    // MaxElapsedTime is the maximum amount of time (including retries) spent trying to send a request/batch.
197    // Once this value is reached, the data is discarded.
198    // Value is in seconds.
199    // If zero or not set, default value is used.
200    // Default is not set.
201    int32 MaxElapsedTime = 4 [json_name = "maxElapsedTime", (buf.validate.field).int32 = {gte : 0, lte : 1800}];
202}
203
204message PeriodicReaderSpec {
205    // [OPTIONAL]
206    // Interval is the time interval at which the PeriodicReader exports data.
207    // This value determines the frequency with which data is sent out.
208    // Value is in seconds.
209    // If zero or not set, default value is used.
210    // Default is 5 seconds.
211    int32 Interval = 1 [json_name = "interval", (buf.validate.field).int32 = {gte : 0, lte : 600}];
212
213    // [OPTIONAL]
214    // Timeout is the duration that the PeriodicReader waits until the export completes.
215    // Value is in seconds.
216    // If zero or not set, default value is used.
217    // Default is 30 seconds.
218    int32 Timeout = 2 [json_name = "timeout", (buf.validate.field).int32 = {gte : 0, lte : 300}];
219}

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