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

[prometheusreceiver] allow to pull Prometheus jobs from /job endpoint of the OpenTelemetryOperator-TargetAllocator #7944

Closed
secustor opened this issue Feb 16, 2022 · 2 comments
Assignees
Labels
comp:prometheus Prometheus related issues comp: receiver Receiver

Comments

@secustor
Copy link
Member

secustor commented Feb 16, 2022

Is your feature request related to a problem? Please describe.
The TargetAllocator is component of a Collector deployment which allows to shard Prometheus targets on multiple Collector instances.

To allow the Collector to dynamically discover new jobs the /jobs endpoint of the TargetAllocator should be used.

Describe the solution you'd like

receivers:
    prometheus:
      target_allocator:
        endpoint:  http://my-targetallocator-service
        interval: 30s
        collector_id: ${COLLECTOR_ID}
# imported struct from the Prometheus code base. Can be used optionally to configure the jobs as seen in the docs 
# https://prometheus.io/docs/prometheus/latest/configuration/configuration/#http_sd_config
        http_sd_config: 
          basic_auth:
            username: prometheus
            password: changeme

With this configuration prometheusreceiver will scrape the /job endpoint every 30s to discover jobs.

These jobs will be then used to generate a scrape configuration with a HTTP_SD job per returned job.
Therefore if /job returns following JSON:

{
  "job1": {
    "_link": "/jobs/job1/targets"
  },
  "job2": {
    "_link": "/jobs/job2/targets"
  }
}

This scrape config will be generated and then applied:

scrape_configs:
- job_name: job1
  http_sd_configs:
  - url: "http://my-targetallocator-service/jobs/job1/targets?collector_id=aCollector"
    basic_auth:
        username: prometheus
        password: changeme
- job_name: job2
  http_sd_configs:
  - url: "http://my-targetallocator-service/jobs/job2/targets?collector_id=aCollector"
    basic_auth:
        username: prometheus
        password: changeme

Describe alternatives you've considered
Some alternatives have been considered, these can be found in this issue: open-telemetry/opentelemetry-operator#713

@Aneurysm9 Aneurysm9 added comp: receiver Receiver comp:prometheus Prometheus related issues labels Feb 16, 2022
@Aneurysm9
Copy link
Member

@secustor do you plan to work on this or should I look for someone with bandwidth to take it on?

@secustor
Copy link
Member Author

Yes, I plan to implement this myself

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

No branches or pull requests

2 participants