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

feat: add rootSpanNameOverride option #826

Merged
merged 6 commits into from
Aug 2, 2018
Merged

feat: add rootSpanNameOverride option #826

merged 6 commits into from
Aug 2, 2018

Conversation

kjin
Copy link
Contributor

@kjin kjin commented Jul 31, 2018

This PR introduces rootSpanNameOverride, which allows us to override span names differently than in #821.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 31, 2018
@ofrobots
Copy link
Contributor

Why are we still supporting the header for an override?

@kjin
Copy link
Contributor Author

kjin commented Jul 31, 2018

@ofrobots Whoops, removed.

src/config.ts Outdated
* will be invoked with the request path as an argument, and its return value
* will be used as the span name.
*/
incomingRequestSpanNameOverride?: string|((path: string) => string);

This comment was marked as spam.

@@ -334,6 +336,29 @@ describe('Web framework tracing', () => {
`span name ${serverSpan.name} includes query parameters`);
});
});

it('uses the span name override header when assoc. option is on',

This comment was marked as spam.

.incomingRequestSpanNameOverride;
testTraceModule.get().getConfig().incomingRequestSpanNameOverride =
(path: string) => `${path}-goodbye`;
const spanNameOverrideKey =

This comment was marked as spam.

@kjin kjin changed the title feat: add incomingRequestSpanNameOverride option feat: add rootSpanNameOverride option Aug 1, 2018
@kjin
Copy link
Contributor Author

kjin commented Aug 1, 2018

@ofrobots I changed it so that root spans are affected, not HTTP incoming requests. The code is now in the Tracer implementation.

const spanName = config.rootSpanNameOverride;
config.rootSpanNameOverride = () => spanName;
} else if (typeof config.rootSpanNameOverride !== 'function') {
config.rootSpanNameOverride = (name: string) => name;

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

}
});

it('should convert a non-string, non-function to the default arg', () => {

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants