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

Add host ID reporting to application metrics #1042

Merged
merged 18 commits into from
Jul 22, 2024
Merged

Conversation

mariomac
Copy link
Contributor

This patch:

  1. Fetches host ID from the major cloud providers APIs.
  2. If (1) fails, tries to get the Kubernetes Node machineID
  3. If (2) fails, tries to get the /etc/machine-id
  4. if (3) fails, fallbacks to the host name

It also adds the target_info metric report to the Prometheus exporter, as there is required as standard way of reporting the host ID. This metric will be active when the prometheus exporter is active for any of the application metrics subgroup, and can't be disabled.

@mariomac mariomac requested a review from rafaelroquetto July 19, 2024 14:37
@mariomac mariomac marked this pull request as ready for review July 19, 2024 14:37
@mariomac mariomac requested review from grcevski and marctc as code owners July 19, 2024 14:37
@codecov-commenter
Copy link

codecov-commenter commented Jul 19, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 37 lines in your changes missing coverage. Please review.

Project coverage is 81.36%. Comparing base (c8e6a58) to head (34551ef).
Report is 104 commits behind head on main.

Files with missing lines Patch % Lines
pkg/internal/pipe/global/host_id.go 52.05% 34 Missing and 1 partial ⚠️
pkg/internal/kube/informer_provider.go 66.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1042      +/-   ##
==========================================
- Coverage   81.46%   81.36%   -0.10%     
==========================================
  Files         138      139       +1     
  Lines       10988    11073      +85     
==========================================
+ Hits         8951     9010      +59     
- Misses       1521     1549      +28     
+ Partials      516      514       -2     
Flag Coverage Δ
integration-test 56.08% <54.95%> (-0.01%) ⬇️
k8s-integration-test 58.94% <58.55%> (-0.04%) ⬇️
oats-test 37.24% <39.63%> (+0.01%) ⬆️
unittests 51.09% <57.65%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@grcevski grcevski left a comment

Choose a reason for hiding this comment

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

LGTM! Really awesome work!

@mariomac mariomac merged commit 99e4b40 into grafana:main Jul 22, 2024
6 checks passed
@mariomac mariomac deleted the host-id branch July 22, 2024 08:06
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 this pull request may close these issues.

3 participants