Skip to content

contrib/google.golang.org/grpc: Fallback to dynamic service names if no global is found#2048

Merged
ajgajg1134 merged 8 commits into
release-v1.52.xfrom
andrew.glaude/dynamicGRPCNames
Jun 15, 2023
Merged

contrib/google.golang.org/grpc: Fallback to dynamic service names if no global is found#2048
ajgajg1134 merged 8 commits into
release-v1.52.xfrom
andrew.glaude/dynamicGRPCNames

Conversation

@ajgajg1134

@ajgajg1134 ajgajg1134 commented Jun 14, 2023

Copy link
Copy Markdown
Contributor

What does this PR do?

To protect users who may be accidentally creating their GRPC server before calling tracer.Start() this PR falls back to dynamically fetching the service name for every span (as before), but if a service name is found it is cached (for a slight performance benefit).

GRPC is the only contrib here that is important as it previously did NOT cache the service name, unlike many of the other contribs where the caching was already occurring (meaning that those contribs would have had this same issue in the past, but because the behavior is changing here for grpc it can cause breakages for customers who did not know they needed to start the tracer first)

Motivation

We found several applications that are creating their GRPC server before calling tracer.Start(). These applications would suddenly have a new service name due to the new caching of service name as part of the namingschema changes. While it is highly recommended to call tracer.Start() before initializing any traced libraries, to try and avoid impacting users of the library we should try to detect this situation and fallback to the old behavior while logging a warning so that users know they should update their code.

Closes #2050

Describe how to test/QA your changes

Unit tested

Reviewer's Checklist

  • Changed code has unit tests for its functionality.
  • If this interacts with the agent in a new way, a system test has been added.

@pr-commenter

pr-commenter Bot commented Jun 14, 2023

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2023-06-15 19:41:35

Comparing candidate commit 28a7922 in PR branch andrew.glaude/dynamicGRPCNames with baseline commit ceb547a in branch release-v1.52.x.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 24 metrics, 0 unstable metrics.

Comment thread contrib/google.golang.org/grpc/grpc_test.go Outdated
Comment thread contrib/google.golang.org/grpc/option.go
Comment thread contrib/google.golang.org/grpc/option.go Outdated

@pkalmakis pkalmakis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

Comment thread contrib/google.golang.org/grpc/grpc_test.go Outdated
@ajgajg1134
ajgajg1134 marked this pull request as ready for review June 15, 2023 16:21
@ajgajg1134
ajgajg1134 requested a review from a team June 15, 2023 16:21

@katiehockman katiehockman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you clarify what makes gRPC special in this case? (i.e. can you explain in the PR description why gRPC is the only library that needs to have this special fallback)

Comment thread contrib/google.golang.org/grpc/grpc_test.go Outdated
Comment thread contrib/google.golang.org/grpc/option.go Outdated
Comment thread contrib/google.golang.org/grpc/option.go Outdated
Comment thread contrib/google.golang.org/grpc/option.go
@ajgajg1134
ajgajg1134 merged commit 03d93f7 into release-v1.52.x Jun 15, 2023
@ajgajg1134
ajgajg1134 deleted the andrew.glaude/dynamicGRPCNames branch June 15, 2023 19:50
ajgajg1134 added a commit that referenced this pull request Jun 15, 2023
…no global is found (#2048)

Co-authored-by: Peter Kalmakis <[email protected]>
Co-authored-by: Katie Hockman <[email protected]>
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.

3 participants