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

Scoped tags for tracing::Span #409

Closed
apolukhin opened this issue Oct 25, 2023 · 2 comments
Closed

Scoped tags for tracing::Span #409

apolukhin opened this issue Oct 25, 2023 · 2 comments
Labels
good first issue Good small issue for newcomers help wanted We would appreciate PR yatalks a good task for yatalks contest

Comments

@apolukhin
Copy link
Member

Implement a tracing::ScopeTag for tracing::Span. The tracing::ScopeTag should add a tag to the current span for the lifetime of the tracing::ScopeTag.

Add tests for the feature.

Internal ticket: 5164

@apolukhin apolukhin added good first issue Good small issue for newcomers help wanted We would appreciate PR labels Oct 25, 2023
@segoon segoon added the yatalks a good task for yatalks contest label Dec 3, 2023
@Anton3
Copy link
Member

Anton3 commented Dec 4, 2023

tracing::TagScope

@nfrmtk
Copy link
Contributor

nfrmtk commented Dec 18, 2023

Hello @apolukhin . I would like to work on this issue.

Also I have a question about dealing with key collision. Consider following code:

Span s{"myspan"};
{
  ScopeTag low = s.AddScopeTag("key", "value");
  {
    ScopeTag high = s.AddScopeTag("key", "value2");
    LOG(DEBUG) << "something";
  }
  LOG(DEBUG) << "something";
}

I see 3 ways of designing this:

  1. The code snippet is valid, output is:
    first log: "key=value2"
    second log: "key=value"
  2. Get an error trying to add second ScopeTag. Colliding keys are not allowed.
  3. Ignore an attempt to add colliding key, output is:
    first log: "key=value"
    second log: "key=value"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good small issue for newcomers help wanted We would appreciate PR yatalks a good task for yatalks contest
Projects
None yet
Development

No branches or pull requests

4 participants