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

Collector with prometheus exporter create service monitor automatically #2058

Closed
yunchi0921 opened this issue Aug 25, 2023 · 1 comment
Closed

Comments

@yunchi0921
Copy link

apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata:
  name: otel-collector
  namespace: default
  labels:
    app: opentelemetry
    component: otel-collector
spec:
  mode: deployment
  ports:
    - name: promexporter
      port: 8889
      protocol: TCP

  observability:
    metrics:
      enableMetrics: true
    
  config: |
    receivers:
      otlp:
        protocols:
          grpc:
          http:
    exporters:
      prometheus:
        endpoint: "0.0.0.0:8889"
    service:
      pipelines:
        metrics:
          receivers: [otlp]
          processors: []
          exporters: [prometheus]

I want to use OpenTelemetry SDK to send metrics to our existing Prometheus server. Above Yaml file is the collector that I created in my Kubernetes cluster. There are two endpoints ( Collector metrics port 8888 & Custom metric 8889) that should bPrometheus should scrape on my understanding, I need a ServiceMontor to select service otel-collector-collector and otel-collector-collector-monitoring to discover /Metrics that I want to collect. Is there any configuration that can be set on collector CR? Or do I need to set ServiceMonitor manually?

otel-collector-collector              ClusterIP   172.20.31.163   <none>        8889/TCP,4317/TCP,4318/TCP   116m
otel-collector-collector-headless     ClusterIP   None            <none>        8889/TCP,4317/TCP,4318/TCP   116m
otel-collector-collector-monitoring   ClusterIP   172.20.66.2     <none>        8888/TCP                     116m
@pavolloffay
Copy link
Member

In the next release automatic creation of ServiceMonitors for p8s exporter will be released #1983.

Right now (0.83.0) it is not automated and you will have to create service monitors by hand. cc) @iblancasa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants