8000 Fetch cluster name from nodes labels by mariomac · Pull Request #1815 · grafana/beyla · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fetch cluster name from nodes labels #1815

New issue < 8000 button aria-label="Close dialog" data-close-dialog="" type="button" data-view-component="true" class="Link--muted btn-link position-absolute p-4 right-0">

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

Merged
merged 4 commits into from
Apr 11, 2025
Merged

Conversation

mariomac
Copy link
Contributor

Fixes #1322

The OTEL contrib library seems broken/outdated, as it is relying on some non-existing maps to get the cluster metadata (related issue: open-telemetry/opentelemetry-collector-contrib#31300).

In the meanwhile, I realized that EKS already adds the cluster name as a Node label, so I added another simpler cluster name retrieving mechanism, based on Node labels, which will allow quickly expanding the functionality to any other cloud provider already using other labels for setting the cluster name.

@mariomac mariomac added the bug label Apr 10, 2025
@mariomac mariomac requested a review from a team as a code owner April 10, 2025 15:25
Copy link
codecov bot commented Apr 10, 2025

Codecov Report

Attention: Patch coverage is 63.26531% with 18 lines in your changes missing coverage. Please review.

Project coverage is 67.72%. Comparing base (1e86904) to head (d8f750d).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
pkg/internal/kube/informer_provider.go 54.54% 10 Missing and 5 partials ⚠️
pkg/internal/netolly/transform/k8s/kubernetes.go 57.14% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1815      +/-   ##
==========================================
+ Coverage   67.37%   67.72%   +0.35%     
==========================================
  Files         222      224       +2     
  Lines       22702    22826     +124     
==========================================
+ Hits        15295    15459     +164     
+ Misses       6636     6589      -47     
- Partials      771      778       +7     
Flag Coverage Δ
integration-test 55.14% <0.00%> (+0.02%) ⬆️
k8s-integration-test 53.49% <63.26%> (+0.39%) ⬆️
oats-test 34.27% <0.00%> (+0.05%) ⬆️
unittests 43.48% <0.00%> (-0.16%) ⬇️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor
@grcevski grcevski left a comment
8000

Choose a reason for hiding this comment

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

LGTM! Super cool! One remark on potentially supporting ECS if it's possible and not too hard.

// don't need to rely on provider-specific APIs.
// TODO: update with labels from other providers, or newer labels as long as specs are updated
var clusterNameNodeLabels = []string{
"alpha.eksctl.io/cluster-name",
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think this might work for AWS ECS on EC2? I guess in that case people will likely be using sidecars and it's less likely to be an issue. I'm not sure where you found these :), but there might be something for ECS too.

Copy link
Contributor Author
@mariomac mariomac Apr 11, 2025

Choose a reason for hiding this comment

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

I don't think it will work in ECS as this relies in the Kubernetes API. But actually this cluster name resolution is currently only performed on network metrics, inside Kubernetes clusters ( k8s.cluster.name attribute), so it has never worked on ECS.

I think we should expand cluster name resolution to app metrics and non-kubernetes environments. Will create an issue for it.

@mariomac mariomac merged commit 228affa into grafana:main Apr 11, 2025
13 checks passed
@mariomac mariomac deleted the fix-cluster-name branch April 11, 2025 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Beyla can't find Cluster name in an AWS EKS clusters
2 participants
0