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

[Feature] configuration option: only trace when x-cloud-trace-context is set #879

Closed
6utt3rfly opened this issue Oct 9, 2018 · 3 comments
Assignees
Labels
api: cloudtrace Issues related to the googleapis/cloud-trace-nodejs API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@6utt3rfly
Copy link
Contributor

6utt3rfly commented Oct 9, 2018

When working in cross-service tracing contexts, I would like to define policies and filters at the ingress service and not have to also set the same url filters on each of the microservices. It would be nice if I could set all but the public trace server to require the header to be set, and then I could rate limit and filter just on the public microservice.

Since the x-cloud-trace-context is used for tracing spans, would a filter based on the header being set or not be easy to add?

https://github.com/googleapis/cloud-trace-nodejs/blob/f8b74e6ec0af23adb531ff48aa18ad1d89703834/doc/trace-api.md#cross-service-trace-contexts

@6utt3rfly 6utt3rfly changed the title [Feature] configuration option: only tracing when x-cloud-trace-context is set [Feature] configuration option: only trace when x-cloud-trace-context is set Oct 9, 2018
@ofrobots
Copy link
Contributor

Hi @6utt3rfly! Thanks for opening the issue. Today, we don't use the existence of the header as a mechanism to control tracing because headers are provided by the client which is untrusted on publicly exposed services. For private micro-services your suggestion makes sense and I'd be +1 on a config option user can explicitly enable.

Do you want to send a PR for this 😀?

@ofrobots ofrobots added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Oct 10, 2018
@kjin kjin self-assigned this Oct 15, 2018
@kjin kjin closed this as completed in #900 Nov 2, 2018
@kjin
Copy link
Contributor

kjin commented Nov 2, 2018

Hi @6utt3rfly -- we've fixed this in 3.3.0. You can now pass the following options for non-public services to force sampling decisions to only be made on the first service:

{
  samplingRate: 0,
  contextHeaderBehavior: 'require'
}

Please let us know if there are additional issues that need to be addressed!

@6utt3rfly
Copy link
Contributor Author

That is great @kjin ! I was going to try creating a PR this past weekend but I'm glad you beat me to it :-) I'll try to implement it this week and let you know if I have any problems. Thank you!

@google-cloud-label-sync google-cloud-label-sync bot added the api: cloudtrace Issues related to the googleapis/cloud-trace-nodejs API. label Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: cloudtrace Issues related to the googleapis/cloud-trace-nodejs API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

3 participants