Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose prometheusexporter port in collector pod #1689

Closed
pavolloffay opened this issue Apr 28, 2023 · 3 comments · Fixed by #1953
Closed

Expose prometheusexporter port in collector pod #1689

pavolloffay opened this issue Apr 28, 2023 · 3 comments · Fixed by #1953
Labels
area:collector Issues for deploying collector help wanted Extra attention is needed

Comments

@pavolloffay
Copy link
Member

Use case: I want to use https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/prometheusexporter to export pipeline's metrics to prometheus by using the podmonitor.
The podmonitor has config to set the port as string https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#endpoint.

When prometheusexporter is enabled the port is not exposed as container port on the collector

    exporters:
      prometheus:
        endpoint: 0.0.0.0:8889
    name: otc-container
    ports:
    - containerPort: 8888
      name: metrics
      protocol: TCP
    - containerPort: 4317
      name: otlp-grpc
      protocol: TCP
    - containerPort: 4318
      name: otlp-http
      protocol: TCP
    - containerPort: 55681
      name: otlp-http-legac
      protocol: TCP
@pavolloffay pavolloffay added help wanted Extra attention is needed area:collector Issues for deploying collector labels Apr 28, 2023
@pavolloffay
Copy link
Member Author

pavolloffay commented Apr 28, 2023

Basically the prometheus exporter cannot be used with the operator because the exporter port is not exposed in the collector container and the pod monitor requires it.

The workaround is to expose port directly in the CR

apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
  name: otel-collector
spec:
  namespaceSelector:
    matchNames:
    - observability
  selector:
    matchLabels:
      app.kubernetes.io/name: otel-collector
  podMetricsEndpoints:
  - port: metrics
  - port: promexporter


  mode: deployment
  ports:
    - name: promexporter
      port: 8889
      protocol: TCP

@yuriolisa
Copy link
Contributor

Can I work on this one?

@iblancasa
Copy link
Contributor

@yuriolisa go ahead :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:collector Issues for deploying collector help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants