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

[receiver/prometheus] set user-agent header #21910

Closed
seankhliao opened this issue May 14, 2023 · 3 comments
Closed

[receiver/prometheus] set user-agent header #21910

seankhliao opened this issue May 14, 2023 · 3 comments
Assignees
Labels
bug Something isn't working closed as inactive receiver/prometheus Prometheus receiver Stale

Comments

@seankhliao
Copy link
Contributor

Component(s)

receiver/prometheus

What happened?

Description

The prometheus receiver only sets a partial user-agent header compared to prometheus

collector receiver:

GET /metrics HTTP/1.1
Host: 127.0.0.1:8080
Accept: application/openmetrics-text;version=1.0.0,application/openmetrics-text;version=0.0.1;q=0.75,text/plain;version=0.0.4;q=0.5,*/*;q=0.1
Accept-Encoding: gzip
User-Agent: Prometheus/
X-Prometheus-Scrape-Timeout-Seconds: 5

prometheus:

GET /metrics HTTP/1.1
Host: 127.0.0.1:8080
Accept: application/openmetrics-text;version=1.0.0,application/openmetrics-text;version=0.0.1;q=0.75,text/plain;version=0.0.4;q=0.5,*/*;q=0.1
Accept-Encoding: gzip
User-Agent: Prometheus/2.44.0
X-Prometheus-Scrape-Timeout-Seconds: 5

Steps to Reproduce

run program that logs incoming requests:

package main

import (
	"fmt"
	"net/http"
	"net/http/httputil"

	"github.com/prometheus/client_golang/prometheus/promhttp"
)

func main() {
	prom := promhttp.Handler()

	http.ListenAndServe(":8080", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		b, _ := httputil.DumpRequest(r, false)
		fmt.Println(string(b))
		prom.ServeHTTP(w, r)
	}))
}

run collector with prometheus receiver (see below for config).

Expected Result

something like

User-Agent: OpenTelemetry-Collector/0.77.0

Actual Result

User-Agent: Prometheus/

Collector version

0.77.0

Environment information

Environment

OS: Linux hwaryun 6.3.1-arch1-1 #1 SMP PREEMPT_DYNAMIC Mon, 01 May 2023 17:42:39 +0000 x86_64 GNU/Linux

OpenTelemetry Collector configuration

receivers:
  prometheus:
    config:
      global:
        scrape_interval: 5s
      scrape_configs:
        - job_name: foo
          static_configs:
            - targets:
              - 127.0.0.1:8080

exporters:
  logging:
  
service:
  pipelines:
    metrics:
      receivers:
        - prometheus
      exporters:
        - logging

Log output

No response

Additional context

No response

@seankhliao seankhliao added bug Something isn't working needs triage New item requiring triage labels May 14, 2023
@github-actions
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@github-actions github-actions bot added the receiver/prometheus Prometheus receiver label May 14, 2023
@JaredTan95 JaredTan95 removed the needs triage New item requiring triage label May 15, 2023
@github-actions
Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@github-actions github-actions bot added the Stale label Jul 14, 2023
@github-actions
Copy link
Contributor

This issue has been closed as inactive because it has been stale for 120 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working closed as inactive receiver/prometheus Prometheus receiver Stale
Projects
None yet
Development

No branches or pull requests

2 participants