Skip to content
This repository was archived by the owner on Jan 21, 2026. It is now read-only.

feat: add rootSpanNameOverride option#826

Merged
kjin merged 6 commits intogoogleapis:masterfrom
kjin:sno2
Aug 2, 2018
Merged

feat: add rootSpanNameOverride option#826
kjin merged 6 commits intogoogleapis:masterfrom
kjin:sno2

Conversation

@kjin
Copy link
Copy Markdown
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
Copy Markdown
Contributor

Why are we still supporting the header for an override?

@kjin
Copy link
Copy Markdown
Contributor Author

kjin commented Jul 31, 2018

@ofrobots Whoops, removed.

Comment thread 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.

Comment thread test/test-trace-web-frameworks.ts Outdated
});
});

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

This comment was marked as spam.

Comment thread test/test-trace-web-frameworks.ts Outdated
.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
Copy Markdown
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.

Comment thread src/index.ts
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.

Comment thread test/test-config.ts Outdated
}
});

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

This comment was marked as spam.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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