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

Prometheus file-based service discovery failed #4985

Closed
ckanner opened this issue Aug 31, 2020 · 1 comment
Closed

Prometheus file-based service discovery failed #4985

ckanner opened this issue Aug 31, 2020 · 1 comment
Labels
comp:prometheus Prometheus related issues

Comments

@ckanner
Copy link

ckanner commented Aug 31, 2020

I use prometheus as a metrics receiver, and use file-based service discovery. But it scrape failed. The error message is
2020-08-31T17:06:34.178+0800 INFO scrape/scrape.go:972 {"component_kind": "receiver", "component_type": "prometheus", "component_name": "prometheus", "level": "debug", "scrape_pool": "dummy", "target": "http://192.168.100.162:8079/metrics", "msg": "Append failed", "err": "unable to find a target group with job=logic.cmdb_service"}

The reason may be a job label added to the json file.

The collector config file is

receivers:
  prometheus:
    config:
      scrape_configs:
        - job_name: "dummy"
          scrape_interval: 10s
          file_sd_configs:
            - refresh_interval: 1m
              files:
                - "/data/conf/targets.json"
          metric_relabel_configs:
            - source_labels: [__name__]
              regex: "(service_request_duration_seconds_total|service_requests_total)"
              action: keep

exporters:
  logging:
    loglevel: debug

processors:
  batch:
    send_batch_size: 10000
    timeout: 1000ms
  queued_retry:

service:
  pipelines:
    metrics:
      receivers:
        - prometheus
      processors:
        - batch
        - queued_retry
      exporters:
        - logging

The targets.json is

[
  {
    "labels": {
      "job": "logic.cmdb_service"
    },
    "targets": [
      "192.168.100.152:8079"
    ]
  }
]

I want to use the job key to rewrite the scrape job name.

How can I resolve it?

@bogdandrutu bogdandrutu transferred this issue from open-telemetry/opentelemetry-collector Aug 30, 2021
@alolita alolita added the comp:prometheus Prometheus related issues label Sep 2, 2021
@gouthamve
Copy link
Member

@dashpole this can be closed after #8780

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:prometheus Prometheus related issues
Projects
None yet
4 participants