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

Fix missing service info #1444

Merged
merged 3 commits into from
Dec 12, 2024
Merged

Conversation

grcevski
Copy link
Contributor

This PR fixes two bugs in the k8s service discovery:

  1. We had an early return in the loop that lists services, instead of a continue on a headless service.
  2. While eyeballing the code when looking for the bug, we noticed a slight timing hole with the cache, which was unlikely the culprit but it's good to fix.

Closes #933
Closes #1426

I'll backport this to 1.9

Copy link

codecov bot commented Dec 11, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 80.94%. Comparing base (a6d91fd) to head (c3a939e).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
pkg/kubecache/meta/informers.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1444      +/-   ##
==========================================
+ Coverage   76.90%   80.94%   +4.04%     
==========================================
  Files         149      149              
  Lines       15250    15252       +2     
==========================================
+ Hits        11728    12346     +618     
+ Misses       2906     2298     -608     
+ Partials      616      608       -8     
Flag Coverage Δ
integration-test 59.78% <0.00%> (-0.08%) ⬇️
k8s-integration-test 60.32% <80.00%> (?)
oats-test 33.91% <0.00%> (-0.01%) ⬇️
unittests 51.94% <80.00%> (-0.02%) ⬇️

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

@rafaelroquetto rafaelroquetto left a comment

Choose a reason for hiding this comment

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

Good stuff!

Copy link
Contributor

@mariomac mariomac left a comment

Choose a reason for hiding this comment

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

Good catch!

Comment on lines 347 to 349
if serviceInfo, ok := s.otelServiceInfoByIP[ip]; ok {
return serviceInfo.Name, serviceInfo.Namespace
}
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: This operation is read-only. Why do you wrap into the mutex Write lock?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you are right, we don't need that one under the lock, the read after was important to be inside the write lock.

@grcevski grcevski merged commit 064fb93 into grafana:main Dec 12, 2024
13 checks passed
@grcevski grcevski deleted the fix_missing_service_info branch December 12, 2024 14:13
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.

K8s: server_address not properly replaced in Beyla 1.9 IPs are displayed as Downstream services
3 participants