-
Notifications
You must be signed in to change notification settings - Fork 312
Addresses #1043: add a serviceName attribute to the @Trace annotation #2413
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
Conversation
trace(1) { | ||
span { | ||
serviceName "testServiceName" | ||
resourceName "SayTracedHello.sayHello" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be "SayTracedHello.sayHelloWithServiceName"
because the resource name is derived from the method name unless specified, this would make the tests pass.
Hi @msm this looks good, and a useful feature so thanks for the contribution! The muzzle failure is complaining that the instrumentation isn't backward compatible with previously released versions of So, if this is something you need, we can do this for you, and hopefully use some of the commits from your branch, but it wouldn't be safe to merge this branch. |
There may be other ways to implement this - is there a reason you want certain service names on certain annotated spans? Or would it be enough to override the service name for all spans in the trace via |
Hi @richardstartin Thanks for the quick (and positive) response! Let me start by saying, I'm totally fine with you throwing this entire branch away if its not useful - won't hurt my feelings! One other thought, in case it would be more straightforward, would be adding a separate My other initial thought would be to check for the presence of the |
My use case is similar to the issue the OP was discussing in #1043 - I have a bunch of calls I am making (using a legacy WSDL-based webservice & JAX-WS) that take up quite a bit of wall clock time. I'm trying to pull that out on the span flame graphs from being attribute to my application's service, into a separate "virtual service" name, like In this case, having a true integration to intercept and instrument JAX-WS is probably a cleaner solution overall, however it looks to be quite a bit more work to do that. |
In the short term, you're right, but in the long term this increases the size of our API and makes it harder to use.
It's a good point but we try not to do things like that because we like to only load instrumentations if we know they are safe to load given runtime information about the application's classpath. There are places where reflection is unavoidable and we do use it, but muzzle (which aims to ensure safety) can't follow reflective references. We've also been discussing reworking this particular instrumentation to avoid doing any reflection at all to make it more efficient (so generating the advice from the values found in the annotation, with no need to look up the |
This is something we may implement soon since there is some demand for tracing SOAP. |
That sounds useful! There are a few other scenarios where JAX-WS instrumentation support isn't an option however, where I think it would be useful to "pull out" and wrap calls to third-party or otherwise external services. I didn't realize how what looked like a minor change that brings things in line with other datadog SDKs would entail a more involved process to release in a backwards compatible manner, although I understand that now. Since workarounds do exist for my objective, I don't think this specific request of adding |
Hii @richardstartin thats great news about #2473! Very cool! I think my feelings on this are pretty similar to how they were in my last comment - I do not feel you should spend a lot of time on implementing this, but if there is a time where you have to make additional backwards incompatible changes in the future and the marginal cost of adding this too is low, I think it would be a net win for the platform. |
@msm first off I'd like to thank you for your contribution To support many of our newer features, Datadog is moving away from manipulating the service tag for traces coming from a service, which includes the proposed changes in this PR. As such, I'm going to close it out If this comes up again, please open up a new issue for further discussion |
Hi there,
This PR is to address/resolve #1043. I will be the first to apologize as I have not been able to spend the time yet to setup all of the different jvms, environment, etc., in order to build and run the tests for this.
I am hoping that given this is a relatively minimal and straightforward change (essentially mirroring what is already being done for
resourceName
) this at least increases the chances of #1043 getting fixed :)One question I have here is whether it is kosher to use
span.setServiceName(..)
versus using the pattern I've seen elsewhere ofactiveSpan().setTag(DDTags.SERVICE_NAME, ..);
. I didn't look too closely at the pros/cons of using the direct method vs setting the tag value, but I'm happy to change this PR to set the tag value instead if that is preferred.Thanks in advance for your consideration!