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

Attach Agent ID to remote-write requests #5999

Merged
merged 18 commits into from
Jan 2, 2024
Merged

Attach Agent ID to remote-write requests #5999

merged 18 commits into from
Jan 2, 2024

Conversation

captncraig
Copy link
Contributor

@captncraig captncraig commented Dec 18, 2023

Refactorings to agent seed handling

  • In flow mode, agent_seed.json should be stored in the data path now so it is more likely to persist across restarts in more environments.
  • Created dedicated internal/agentseed package that can be used anywhere.
  • There is no error case in the Get api. If we cannot read or write the file, worst case is we generate a new uid and use it only for the lifetime of this process.

UID to outbound headers

  • Adds a X-Agent-ID header to outbound reequests from
    • prometheus.remote_write
    • loki.write
    • pyroscope.write
    • Static mode metrics and logs remote writes.

This header will be sent in the http headers only to remote writes you have configured.

@captncraig captncraig requested a review from a team as a code owner December 18, 2023 18:21
@captncraig captncraig requested a review from jcreixell December 18, 2023 18:23
internal/agentseed/agentseed.go Outdated Show resolved Hide resolved
internal/agentseed/agentseed.go Outdated Show resolved Hide resolved
@@ -0,0 +1,135 @@
package agentseed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to make this work for otelcol.exporter.* components?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unclear at present. I'd assume there's some mechanism for including metadata, even though it may not be over http. Needs more research.

@captncraig captncraig changed the title Attach UID to remote-write requests Attach Agent ID to remote-write requests Jan 2, 2024
@captncraig captncraig enabled auto-merge (squash) January 2, 2024 18:34
@captncraig captncraig merged commit b1dd499 into main Jan 2, 2024
10 checks passed
@captncraig captncraig deleted the cmp_uuid branch January 2, 2024 18:38
hainenber pushed a commit to hainenber/agent that referenced this pull request Jan 6, 2024
* pull out agentseed package for reading and storing uuid. Also put it in data dir for flow.

* add uid header to prometheus.remote_write and loki.write

* init func

* cleaner api with fewer edge cases

* add to pyroscope

* compile

* add to static remote write

* add to static mode loki write

* remove return from write. we never need it.

* move loki write out of convert function

* move out of prometheus convert function

* static prom, get out of defaults function

* static logs: take out of defaults function

* constant for header. Work done in init with sync.once. Hardening

* added some tests

* maybe fix tests

* testmain?

* changelog
BarunKGP pushed a commit to BarunKGP/grafana-agent that referenced this pull request Feb 20, 2024
* pull out agentseed package for reading and storing uuid. Also put it in data dir for flow.

* add uid header to prometheus.remote_write and loki.write

* init func

* cleaner api with fewer edge cases

* add to pyroscope

* compile

* add to static remote write

* add to static mode loki write

* remove return from write. we never need it.

* move loki write out of convert function

* move out of prometheus convert function

* static prom, get out of defaults function

* static logs: take out of defaults function

* constant for header. Work done in init with sync.once. Hardening

* added some tests

* maybe fix tests

* testmain?

* changelog
@github-actions github-actions bot added the frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed. label Feb 21, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants