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

syntax = "proto3";
package app.v1;

import "buf/validate/validate.proto";
import "kernel/resource.proto";
import "kernel/network.proto";

option go_package = "github.com/aileron-gateway/aileron-gateway/apis/app/v1";

// OpenTelemetryMeter resource definition.
// apiVersion="app/v1", kind="OpenTelemetryMeter".
message OpenTelemetryMeter {
    string                 APIVersion = 1 [json_name = "apiVersion"];
    string                 Kind       = 2 [json_name = "kind"];
    kernel.Metadata        Metadata   = 3 [json_name = "metadata"];
    OpenTelemetryMeterSpec Spec       = 4 [json_name = "spec"];
}

// OpenTelemetryMeterSpec is the specifications of the OpenTelemetryMeter object.
message OpenTelemetryMeterSpec {
    // [OPTIONAL]
    // ServiceName is the value for "service.name" semantic conventions.
    // If not set or empty, a default value is used.
    // Default is ["gateway"].
    string ServiceName = 1 [json_name = "serviceName"];

    // [OPTIONAL]
    // LibraryName is the OpenTelemetry meter name.
    // If not set or empty, go package name is used.
    string LibraryName = 2 [json_name = "libraryName"];

    // [OPTIONAL]
    // PeriodicReader is the configuration of a collector that collects and
    // exports metric data to the exporter at a defined interval.
    // Default configuration is used if not set.
    PeriodicReaderSpec PeriodicReader = 5 [json_name = "periodicReader"];

    oneof Exporters {
        HTTPMetricsExporterSpec   HTTPExporterSpec   = 10 [json_name = "httpExporter"];
        GRPCMetricsExporterSpec   GRPCExporterSpec   = 11 [json_name = "grpcExporter"];
        StdoutMetricsExporterSpec StdoutExporterSpec = 12 [json_name = "stdoutExporter"];
    }
}

message HTTPMetricsExporterSpec {
    // [OPTIONAL]
    // EndpointURL is the target endpoint URL (scheme, host, port, path)
    // the Exporter will connect to.
    // If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT environment variable is set,
    // and this option is not passed, that variable value will be used.
    // If both environment variables are set, OTEL_EXPORTER_OTLP_METRICS_ENDPOINT will take precedence.
    // If an environment variable is set, and this option is passed, this option will take precedence.
    // if an environment variable is not set, and this option is not passed, "localhost:4318" will be used.
    // Default is not set.
    string EndpointURL = 1 [json_name = "endpointURL"];

    // [OPTIONAL]
    // Headers is the additional HTTP headers sent with payloads.
    // Default is not set.
    map<string, string> Headers = 2 [json_name = "headers"];

    // [OPTIONAL]
    // Compress is the flag to compress data when sending to collectors.
    // Default is [false].
    bool Compress = 3 [json_name = "compress"];

    // [OPTIONAL]
    // Insecure is the flag use HTTP instead of HTTPS.
    // Default is [false].
    bool Insecure = 4 [json_name = "insecure"];

    // [OPTIONAL]
    // TLSConfig is the TLS configuration to use when connecting backend using HTTPS.
    // Default is not set.
    kernel.TLSConfig TLSConfig = 5 [json_name = "tlsConfig"];

    // [OPTIONAL]
    // Timeout is the timeout seconds of the driver's the max waiting time for
    // the backend to process each spans batch.
    // If zero or negative, or not set, the default will be 10 seconds.
    // Default is not set.
    int32 Timeout = 6 [json_name = "timeout"];

    // [OPTIONAL]
    // OTLPRetry is the retry policy for transient retry-able errors that may be returned
    // by the target endpoint when exporting a batch of spans.
    // If not set, the default retry policy will be used.
    // It will retry the export 5 seconds after receiving a retry-able error and
    // increase exponentially after each error for no more than a total time of 1 minute.
    // Default is not set.
    OTLPMetricsRetrySpec OTLPRetry = 7 [json_name = "otlpRetry"];
}

message GRPCMetricsExporterSpec {
    // [OPTIONAL]
    // EndpointURL is the target endpoint URL (scheme, host, port, path)
    // the Exporter will connect to.
    // If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT environment variable is set,
    // and this option is not passed, that variable value will be used.
    // If both environment variables are set, OTEL_EXPORTER_OTLP_METRICS_ENDPOINT will take precedence.
    // If an environment variable is set, and this option is passed, this option will take precedence.
    // if an environment variable is not set, and this option is not passed, "localhost:4317" will be used.
    // Default is not set.
    string EndpointURL = 1 [json_name = "endpointURL"];

    // [OPTIONAL]
    // Headers is the additional HTTP headers sent with payloads.
    // Default is not set.
    map<string, string> Headers = 2 [json_name = "headers"];

    // [OPTIONAL]
    // Compress is the flag to compress data when sending to collectors.
    // Default is [false].
    bool Compress = 3 [json_name = "compress"];

    // [OPTIONAL]
    // Insecure is the flag use HTTP instead of HTTPS.
    // Default is [false].
    bool Insecure = 4 [json_name = "insecure"];

    // [OPTIONAL]
    // TLSConfig is the TLS configuration to use
    // when connecting backend using HTTPS.
    // Default is not set.
    kernel.TLSConfig TLSConfig = 5 [json_name = "tlsConfig"];

    // [OPTIONAL]
    // Timeout is the timeout seconds of the driver's the max waiting time for
    // the backend to process each spans batch.
    // If zero or negative, or not set, the default will be 10 seconds.
    // Default is not set.
    int32 Timeout = 6 [json_name = "timeout"];

    // [OPTIONAL]
    // OTLPRetry is the retry policy for transient retryable errors that may be returned
    // by the target endpoint when exporting a batch of spans.
    // If the target endpoint responds with not only a retryable error,
    // but explicitly returns a backoff time in the response.
    // That time will take precedence over these settings.
    // These settings do not define any network retry strategy.
    // That is entirely handled by the gRPC ClientConn.
    // If not set, the default retry policy will be used.
    // It will retry the export 5 seconds after receiving a retryable error and
    // increase exponentially after each error for no more than a total time of 1 minute.
    // Default is not set.
    OTLPMetricsRetrySpec OTLPRetry = 7 [json_name = "otlpRetry"];

    // [OPTIONAL]
    // ReconnectionPeriod is the minimum amount of time in seconds
    // between connection attempts to the target endpoint.
    // If zero or negative, or not set, this option has no effect.
    // Default is not set.
    int32 ReconnectionPeriod = 8 [json_name = "reconnectionPeriod"];

    // [OPTIONAL]
    // ServiceConfig is the gRPC service config string.
    // See https://github.com/grpc/grpc/blob/master/doc/service_config.md
    // Default is not set.
    string ServiceConfig = 9 [json_name = "serviceConfig"];
}

message StdoutMetricsExporterSpec {
    // [OPTIONAL]
    // PrettyPrint is the flag to prettifies the emitted output.
    // Default is [false].
    bool PrettyPrint = 1 [json_name = "prettyPrint"];

    // [OPTIONAL]
    // WithoutTimestamps is the flag to make the export stream not include timestamps.
    // Default is [false].
    bool WithoutTimestamps = 2 [json_name = "timestamps"];
}

message OTLPMetricsRetrySpec {
    // [OPTIONAL]
    // Enabled indicates whether to not retry sending batches in case of export failure.
    // Default is [false].
    bool Enabled = 1 [json_name = "enabled"];

    // [OPTIONAL]
    // InitialInterval is the time to wait after the first failure before retrying.
    // Value is in seconds.
    // If zero or not set, default value is used.
    // Default is not set.
    int32 InitialInterval = 2 [json_name = "initialInterval", (buf.validate.field).int32 = {gte : 0, lte : 600}];

    // [OPTIONAL]
    // MaxInterval is the upper bound on backoff interval.
    // Once this value is reached the delay between consecutive retries will always be `MaxInterval`.
    // Value is in seconds.
    // If zero or not set, default value is used.
    // Default is not set.
    int32 MaxInterval = 3 [json_name = "maxInterval", (buf.validate.field).int32 = {gte : 0, lte : 600}];

    // [OPTIONAL]
    // MaxElapsedTime is the maximum amount of time (including retries) spent trying to send a request/batch.
    // Once this value is reached, the data is discarded.
    // Value is in seconds.
    // If zero or not set, default value is used.
    // Default is not set.
    int32 MaxElapsedTime = 4 [json_name = "maxElapsedTime", (buf.validate.field).int32 = {gte : 0, lte : 1800}];
}

message PeriodicReaderSpec {
    // [OPTIONAL]
    // Interval is the time interval at which the PeriodicReader exports data.
    // This value determines the frequency with which data is sent out.
    // Value is in seconds.
    // If zero or not set, default value is used.
    // Default is 5 seconds.
    int32 Interval = 1 [json_name = "interval", (buf.validate.field).int32 = {gte : 0, lte : 600}];

    // [OPTIONAL]
    // Timeout is the duration that the PeriodicReader waits until the export completes.
    // Value is in seconds.
    // If zero or not set, default value is used.
    // Default is 30 seconds.
    int32 Timeout = 2 [json_name = "timeout", (buf.validate.field).int32 = {gte : 0, lte : 300}];
}

Last modified June 2, 2025: update docs (df954a4)