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: jaeger-agent sampling endpoint returns backwards incompatible JSON #3892

Closed
wants to merge 3 commits into from

Conversation

vprithvi
Copy link
Contributor

@vprithvi vprithvi commented Aug 31, 2022

Signed-off-by: Prithvi Raj p.r@uber.com

…`[]`

- Returning an empty slice for `perOperationStrategies` instead of the default nil slice allows
  json.Marshal to marshal it to `[]` instead of `null`
- Fixes jaegertracing#3891

Signed-off-by: Prithvi Raj <p.r@uber.com>
@vprithvi vprithvi requested a review from a team as a code owner August 31, 2022 22:21
@vprithvi vprithvi changed the title fix: jaeger-agent sampling endpoint perOperationStrategies returns [] fix: jaeger-agent sampling endpoint returns backwards incompatible JSON Aug 31, 2022
Signed-off-by: Prithvi Raj <p.r@uber.com>
@codecov
Copy link

codecov bot commented Aug 31, 2022

Codecov Report

Base: 97.64% // Head: 97.63% // Decreases project coverage by -0.01% ⚠️

Coverage data is based on head (891291f) compared to base (514e27a).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3892      +/-   ##
==========================================
- Coverage   97.64%   97.63%   -0.02%     
==========================================
  Files         293      293              
  Lines       17073    17075       +2     
==========================================
  Hits        16671    16671              
- Misses        317      319       +2     
  Partials       85       85              
Impacted Files Coverage Δ
...el/converter/thrift/jaeger/sampling_from_domain.go 100.00% <100.00%> (ø)
pkg/config/tlscfg/cert_watcher.go 92.55% <0.00%> (-2.13%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -72,6 +72,9 @@ func convertPerOperationFromDomain(s *api_v2.PerOperationSamplingStrategies) *sa
for i, k := range s.PerOperationStrategies {
r.PerOperationStrategies[i] = convertOperationFromDomain(k)
}
} else {
// Initialize to an empty array so that using json.Marshal results in [] instead of null.
r.PerOperationStrategies = make([]*sampling.OperationSamplingStrategy, 0)
}
Copy link
Member

@yurishkuro yurishkuro Sep 1, 2022

Choose a reason for hiding this comment

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

I think you can simply remove the if statement and only keep its content

        perOp := s.GetPerOperationStrategies()
        // Default to empty array so that json.Marshal returns [] instead of null (Issue #3891).
        r.PerOperationStrategies = make([]*sampling.OperationSamplingStrategy, len(perOp))
        for i, k := range perOp {
            r.PerOperationStrategies[i] = convertOperationFromDomain(k)
        }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

D'oh! ty!

Signed-off-by: Prithvi Raj <p.r@uber.com>
@vprithvi
Copy link
Contributor Author

vprithvi commented Sep 1, 2022

@yurishkuro ty! The builds seem to be failing when publishing to docker with the following, how to proceed?

+ docker login -u jaegertracingbot docker.io --password-stdin
Error: Cannot perform an interactive login from a non TTY device
Error: Process completed with exit code 1.

@yurishkuro yurishkuro enabled auto-merge (squash) September 1, 2022 14:11
@yurishkuro
Copy link
Member

ah, it's because you created PR from your main branch, it will continue failing. Needs to be on a named branch.

@vprithvi
Copy link
Contributor Author

vprithvi commented Sep 1, 2022

ah, it's because you created PR from your main branch, it will continue failing. Needs to be on a named branch.

I see, I created #3897 with the same contents;

@vprithvi vprithvi closed this Sep 1, 2022
auto-merge was automatically disabled September 1, 2022 14:21

Pull request was closed

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.

[Bug]: Jaeger Agent's http /sampling endpoint returns JSON which breaks older jaeger clients
3 participants