opentelemetry-helm-charts icon indicating copy to clipboard operation
opentelemetry-helm-charts copied to clipboard

Exporting opentelemetry metrics to prometheus

Open oxeye-schmil opened this issue 2 years ago • 2 comments

Hi,

I'm trying to configure the my collector with a pipeline for metrics with an otlp receiver and prometheus exporter. I couldn't find a good example, so I did the following config: exporters: prometheus: endpoint: "0.0.0.0:8889" namespace: "default" receivers: otlp: protocols: grpc: endpoint: 0.0.0.0:4317 service: pipelines: metrics: exporters: - prometheus processors: receivers: - otlp

Is there way to also add a ServiceMonitor so that prometheus will automatically retrieve the metrics from the pipeline? Also, can someone post a an example for configuring prometheus exporter ?

Schmil

oxeye-schmil avatar Aug 19 '22 14:08 oxeye-schmil

@oxeye-schmil The collector chart has .Values.serviceMonitor that when enabled will create a service monitor to scrape the collector's metrics endpoint, and any other endpoints you specify.

For prometheusexporter examples checkout it's readme: https://github.com/open-telemetry/opentelemetry-helm-charts/issues/310

TylerHelmuth avatar Aug 20 '22 13:08 TylerHelmuth

I probably need to add the prometheus exporter port to the list of ports as following, right?

  metrics-exporter:
    enabled: true
    containerPort: 8889
    servicePort: 8889
    protocol: TCP

and add it to the serviceMonitor metricsEndpoints configuration as following

serviceMonitor:
  # The service monitor by default scrapes the metrics port.
  # The metrics port needs to be enabled as well.
  enabled: true
  metricsEndpoints:
  - port: metrics
    # interval: 15s
  - port: metrics-exporter

oxeye-schmil avatar Aug 21 '22 11:08 oxeye-schmil