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_scrape source's query doesn't add the [] to mapping list #22049

Open
valleedelisle opened this issue Dec 18, 2024 · 4 comments · May be fixed by #22085
Open

prometheus_scrape source's query doesn't add the [] to mapping list #22049

valleedelisle opened this issue Dec 18, 2024 · 4 comments · May be fixed by #22085
Labels
source: prometheus_scrape Anything `prometheus_scrape` source related type: bug A code related bug.

Comments

@valleedelisle
Copy link

A note for the community

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Problem

Result:

2024-12-18T03:55:00.342027Z DEBUG source{component_kind="source" component_id=src-metrics-prod-proxy component_type=prometheus_scrape}:http: vector::internal_events::http_client: Sending HTTP request. uri=https://myprometheus/federate?match=%7Bjob%3D%something%22%7D method=GET version=HTTP/1.1 headers={"accept": "text/plain", "user-agent": "Vector/0.43.1 (x86_64-unknown-linux-musl e30bf1f 2024-12-10 16:14:47.175528383)", "accept-encoding": "identity"} body=[empty]

Configuration

Sample config:


      src-metrics-prod-proxy:
        endpoints:
        - "https://myprometheus/federate"
        honor_labels: true
        scrape_interval_secs: 60
        scrape_timeout_secs: 45
        query:
          match:
            - '{job="something"}'
        tls:
          verify_certificate: false
          verify_hostname: false
        type: prometheus_scrape

Version

vector 0.43.1 (x86_64-unknown-linux-musl e30bf1f 2024-12-10 16:14:47.175528383)

Debug Output

No response

Example Data

No response

Additional Context

No response

References

No response

@valleedelisle valleedelisle added the type: bug A code related bug. label Dec 18, 2024
@jszwedko
Copy link
Member

HI @valleedelisle !

I think I'm missing the issue here. Could you describe the expected behavior?

@jszwedko jszwedko added the source: prometheus_scrape Anything `prometheus_scrape` source related label Dec 18, 2024
@valleedelisle
Copy link
Author

Sorry, I should have clarified this.

Prometheus is expecting a url like this:
https://myprometheus/federate?match[]=%7Bjob%3D%something%22%7D

As opposed to this:
https://myprometheus/federate?match=%7Bjob%3D%something%22%7D

@jszwedko
Copy link
Member

Ah I see. It's curious that this issue hasn't been reported before. That match feature has been there for quite a while 🤔

@sainad2222 sainad2222 linked a pull request Dec 27, 2024 that will close this issue
10 tasks
@sainad2222
Copy link

I tried by modifying your source config to include [] after match, something like this and it's working after that

Sample config:


      src-metrics-prod-proxy:
        endpoints:
        - "https://myprometheus/federate"
        honor_labels: true
        scrape_interval_secs: 60
        scrape_timeout_secs: 45
        query:
          match[]:
            - '{job="something"}'
        tls:
          verify_certificate: false
          verify_hostname: false
        type: prometheus_scrape

But if we want to make it easier, I created a PR to replace match key with match[] at source while building url

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
source: prometheus_scrape Anything `prometheus_scrape` source related type: bug A code related bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants