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

[FEAT] edit w3c tracing context configurations on account and enable tracing into service exports #638

Merged
merged 2 commits into from
Feb 29, 2024

Conversation

aricart
Copy link
Member

@aricart aricart commented Feb 27, 2024

Fix #636

Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

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

Some changes needed, but also you need to add the allow trace for the stream import (with similar checks that will fail allow-trace on service import). See JWT pr for details: nats-io/jwt#216

} else {
p.claim.Trace = &jwt.MsgTrace{}
p.claim.Trace.Destination = jwt.Subject(p.traceContextSubject)
r.AddOK("changed trace context subject to %d", p.claim.Trace.Sampling)
Copy link
Member

Choose a reason for hiding this comment

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

You are supposed to show the change of the subject, but you use %d and show the sampling value.

}
// we already validated that the subject is there either existing or new
p.claim.Trace.Sampling = int(p.traceContextSampling.Int64())
r.AddOK("changed trace context sampling to %d", p.claim.Trace.Sampling)
Copy link
Member

Choose a reason for hiding this comment

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

You could add to %d%% to show it as a percentage, but it is ok this way too.

Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

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

Some issues and tests missing. Also, do we need to add an "edit import" file? If not, does it mean that currently you can't modify a stream import, you would need to do what? delete and recreate?

@@ -542,7 +552,10 @@ func (p *AddImportParams) createImport() *jwt.Import {
if p.service {
im.Type = jwt.Service
im.Share = p.share
} else if p.allowTrace {
im.AllowTrace = true
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure it would not be im.AllowTrace = p.allowTrace instead of true?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, the other functions are managing the flags, the import creation happens in createImport() which then sets it to be as it needs to be.

Copy link
Member

Choose a reason for hiding this comment

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

Oh sorry... I saw the else of the if p.service and I thought you were just processing stream properties here and always setting to true without seeing that the else if p.allowTrace. My bad.

cmd/addimport.go Show resolved Hide resolved
cmd/addimport.go Show resolved Hide resolved
cmd/addimport_test.go Show resolved Hide resolved
Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -542,7 +552,10 @@ func (p *AddImportParams) createImport() *jwt.Import {
if p.service {
im.Type = jwt.Service
im.Share = p.share
} else if p.allowTrace {
im.AllowTrace = true
Copy link
Member

Choose a reason for hiding this comment

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

Oh sorry... I saw the else of the if p.service and I thought you were just processing stream properties here and always setting to true without seeing that the else if p.allowTrace. My bad.

cmd/addimport.go Show resolved Hide resolved
cmd/addimport.go Show resolved Hide resolved
cmd/addimport_test.go Show resolved Hide resolved
@aricart aricart merged commit 5c51c37 into main Feb 29, 2024
8 checks passed
@aricart aricart deleted the tracing branch February 29, 2024 14:32
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.

add compatibility with tracing
2 participants