-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Unable to set resource service.name while scraping kubernetes pods #7831
Comments
You should be able to accomplish this using relabeling if you want. For example, to use the - action: replace
source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_name]
target_label: job I believe this is working as intended in this case. Feel free to offer suggestions if you think there is a better way to do this. |
@dashpole When I add the lines you recommended, the collector does not output any metrics. The new configuration looks like: apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata:
name: otel
spec:
mode: daemonset
config: |
receivers:
prometheus:
config:
scrape_configs:
- job_name: kubernetes-pods
scrape_interval: 10s
kubernetes_sd_configs:
- role: pod
relabel_configs:
- action: keep
regex: true
source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
- action: replace
regex: (.+)
source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scheme]
target_label: __scheme__
- action: replace
regex: (.+)
source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]
target_label: __metrics_path__
- action: replace
regex: (.+)
source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_port]
target_label: __metrics_port__
- action: replace
source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_name]
target_label: job
exporters:
logging:
logLevel: debug
service:
pipelines:
metrics:
receivers: [prometheus]
processors: []
exporters: [logging] However, when I replace - action: replace
source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_name]
target_label: test It seems like |
Ah, right. We need to fix that (#5663). We should definitely ensure it is possible to customize the service name. |
The issue has now been fixed. You can relabel the @dashpole I believe this can be closed as well! |
Prometheus receiver defaults to the scrape_configs job_name as the metric service.name.
Steps to reproduce
What did you expect to see?
What version did you use?
Version: 0.41.0
What config did you use?
Config: see above
Environment
OS: Linux (EKS)
The text was updated successfully, but these errors were encountered: