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

Version not included in promtail user-agent #4686

Closed
klausenbusk opened this issue Nov 7, 2021 · 1 comment · Fixed by #4716
Closed

Version not included in promtail user-agent #4686

klausenbusk opened this issue Nov 7, 2021 · 1 comment · Fixed by #4716

Comments

@klausenbusk
Copy link
Contributor

Describe the bug
The promtail user-agent doesn't include the version.

To Reproduce
Steps to reproduce the behavior:

  1. Start the promtail Docker image (docker.io/grafana/promtail:2.4.0) with a client config pointing to some server
  2. Wait for promtail to push logs

Expected behavior
The user-agent should be promtail/2.4.0

Environment:

  • Infrastructure: bare-metal
  • Deployment tool: Docker

Screenshots, Promtail config, or terminal output
Nginx log:

x.x.x.x monitoring.domain.tld - [07/Nov/2021:16:25:44 +0000] "POST /loki/api/v1/push HTTP/1.1" 302 0 "-" "promtail/" "-" 0.002

Version:

root@eeb8923229d1:/# promtail --version
promtail, version 2.4.0 (branch: HEAD, revision: 3987933cd)
  build user:       root@fc19e7dd4bc0
  build date:       2021-11-05T20:46:40Z
  go version:       go1.17.2
  platform:         linux/amd64
@cyriltovena
Copy link
Contributor

Yeah it seems that the code for the agent will be run before the version initialization here.

https://github.com/grafana/loki/blob/main/pkg/util/build/build.go#L23

cyriltovena added a commit to cyriltovena/loki that referenced this issue Nov 9, 2021
This was because promtail client was still user the old version.Version which is initialized at run-time via init.

But if we use it also at init time there's no guarantee that the version will be set.

So intead I'm using the original version variable stamped in the binary and not at runtime.

Fixes grafana#4686

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
dannykopping pushed a commit that referenced this issue Nov 9, 2021
This was because promtail client was still user the old version.Version which is initialized at run-time via init.

But if we use it also at init time there's no guarantee that the version will be set.

So intead I'm using the original version variable stamped in the binary and not at runtime.

Fixes #4686

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants