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

Name service based on servlet context #320

Merged
merged 2 commits into from
May 15, 2018

Conversation

tylerbenson
Copy link
Contributor

@tylerbenson tylerbenson commented May 11, 2018

This only applies if a service name hasn’t been set or is empty.

This is particularly useful for environments that deploy multiple war files to the same app server.

This is a potentially breaking change if someone hasn't configured a service name.

@tylerbenson tylerbenson added comp: core Tracer core inst: others All other instrumentations labels May 11, 2018
@tylerbenson tylerbenson added this to the 0.8.0 milestone May 11, 2018
@tylerbenson tylerbenson added the tag: breaking change Breaking changes label May 11, 2018
@tylerbenson tylerbenson force-pushed the tyler/servlet-context-naming branch from ca26224 to 26c794c Compare May 11, 2018 03:36
This only applies if a service name hasn’t been set or is empty.

This is particularly useful for environments that deploy multiple war files to the same app server.
@tylerbenson tylerbenson force-pushed the tyler/servlet-context-naming branch from 26c794c to 46878d2 Compare May 11, 2018 03:59
@tylerbenson tylerbenson force-pushed the tyler/servlet-context-naming branch from d80c40f to dc814ae Compare May 11, 2018 05:19
@tylerbenson
Copy link
Contributor Author

tylerbenson commented May 11, 2018

@realark I discovered that a lot of our tags weren't having the expected effect because they were set on the span builder, which didn't trigger any decorators. Now that decorators apply to the builder, a lot of things changed.

Please review the changes and make sure the tests align with your expectations of how the instrumentation should work. We might need to change some instrumentation...

Copy link
Contributor

@realark realark left a comment

Choose a reason for hiding this comment

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

Nice catch on the span builder decorator issue! I don't have a strong opinion about what the tag values should be specificially, but consistency is good.

Let's get @palazzem's approval on the servlet service-naming then I'm good to merge.

Copy link
Contributor

@palazzem palazzem left a comment

Choose a reason for hiding this comment

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

Using the context as a service name default is fine. IT ensures if you deploy multiple applications in the same (i.e.) Tomcat, you automatically have the split across all your apps.

I'm mostly worried about the change to the way we set tags. If you can address my question then I can see if it's ready for approval or not. Flagging as a request changes only to avoid a merge until it's clear to me the impact it has.

@@ -95,18 +95,19 @@ class TomcatServlet3Test extends AgentTestRunner {
assertTraces(writer, 1) {
trace(0, 1) {
span(0) {
serviceName "unnamed-java-app"
serviceName "my-context"
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@@ -49,10 +49,11 @@ class SpringBootBasedTest extends AgentTestRunner {
span.context().tags["span.kind"] == "server"
span.context().tags["span.type"] == "web"
span.context().tags["component"] == "java-web-servlet"
span.context().tags["servlet.context"] == ""
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we really send this tag even if it's empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Normally I’d say no, but in this case I think it might be useful to distinguish from something that may not have been set.

@@ -369,15 +368,7 @@ public DDSpanBuilder withTag(final String tag, final Number number) {

@Override
public DDSpanBuilder withTag(final String tag, final String string) {
if (tag.equals(DDTags.SERVICE_NAME)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't applied anymore? or is it applied somewhere else? the way we set special Datadog tags is to ensure a change in internal attributes such as the spanType. Also, do we have tests for this functionality?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. All of these are handled consistently via decorators now.

Copy link
Contributor

@palazzem palazzem left a comment

Choose a reason for hiding this comment

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

Good to go!

@tylerbenson tylerbenson merged commit c011eb0 into master May 15, 2018
@tylerbenson tylerbenson deleted the tyler/servlet-context-naming branch May 15, 2018 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: core Tracer core inst: others All other instrumentations tag: breaking change Breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants