Skip to content

[TargetAllocator] Support exporting self-telemetry metrics via OTLP #5047

@pirgeo

Description

@pirgeo

Component(s)

target allocator

Is your feature request related to a problem? Please describe.

The TA uses the OTel SDK to collect self-monitoring metrics. These metrics are then exposed via a Prometheus endpoint. I would like to export them via OTLP rather than scraping them from the Prometheus endpoint.

Describe the solution you'd like

It would be valuable to allow the TargetAllocator to push its self-monitoring metrics via OTLP (grpc or http/protobuf) to a configurable endpoint, similar to how the OpenTelemetry Collector already supports this through service::telemetry::metrics::exporters. The TA could be configured in the same way, for example:

apiVersion: opentelemetry.io/v1beta1
kind: OpenTelemetryCollector
metadata:
  name: my-otel
spec:
  targetAllocator:
    telemetry:
      metrics:
        otlp:
          endpoint: https://example.com/api/v2/otlp    # base URL for HTTP; host:port for gRPC
          protocol: http                               # http | grpc (default: grpc)
          temporality: delta                           # delta | cumulative | lowmemory
          exportInterval: 30s                          # default 60s
          timeout: 15s                                 # default 10s
          insecure: false                              # disable TLS (gRPC only, local dev)
          headers:
            Authorization: "Bearer <token>"

or

apiVersion: opentelemetry.io/v1alpha1
kind: TargetAllocator
metadata:
  name: my-ta
spec:
  targetAllocator:
    telemetry:
      metrics:
        otlp:
          endpoint: https://example.com/api/v2/otlp    # base URL for HTTP; host:port for gRPC
          # ... and so on ... 

Describe alternatives you've considered

Using otlpmetrichttp.New(ctx) or otlpmetricgrpc.New(ctx) in the TA binary and injecting the configuration via env vars, e.g. OTEL_EXPORTER_OTLP_METRICS_ENDPOINT. That would be a minimal change with no changes to CRDs, but also no validation or discoverability.

Additional context

I have already played around with this idea and would be happy to contribute the code. The meat of this is pretty simple - just wire up the existing OTLP exporters in the TA binary. The "hard work" is wiring through the config parameters all the way to the binary. Therefore, most of the code is around updating CRDs and related resources.

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions