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

Fix #177: Add APIs for Supplier<String> operation names #262

Closed
wants to merge 2 commits into from

Conversation

carterkozak
Copy link
Contributor

Before this PR

Hacks scattered across consumers to avoid expensive string work when the name will not be used, e.g. https://github.com/palantir/tritium/blob/880c6da14f7d89644fce935a5fe0fb8e080b4586/tritium-tracing/src/main/java/com/palantir/tritium/tracing/TracingInvocationEventHandler.java#L97-L103

After this PR

CloseableTracer.startSpan(() -> "Foo: " + bar)
Tracer.fastStartSpan(() -> "Foo: " + bar)
==COMMIT_MSG==
Add Supplier operation name APIs for lazy operation name evaluation
==COMMIT_MSG==

@carterkozak carterkozak requested a review from a team as a code owner September 11, 2019 00:00
@changelog-app
Copy link

changelog-app bot commented Sep 11, 2019

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Add Supplier operation name APIs for lazy operation name evaluation

Check the box to generate changelog(s)

  • Generate changelog entry

@markelliot
Copy link
Contributor

Instead of continuing to deepen hacks it would be preferable to replace these unfortunate string concatenations with a presentation of the service name where a call takes place in our trace viewing application. That change would easily allow removal of the string munging since it would be obvious from the service boundaries where RPC calls are being made, and thus which side of the interface a particular call lives.

@carterkozak
Copy link
Contributor Author

I agree that would help in some scenarios, however it wouldn't solve the problem where we concatenate the verb and path in TraceEnrichingFilter or Tritium interface names.
You can imagine some of our services are large, and service boundaries aren't sufficient to provide tracing signal, so there tend to be several layers of traced services between endpoint, business logic, and persistence layers.

@markelliot
Copy link
Contributor

markelliot commented Sep 11, 2019 via email

@carterkozak
Copy link
Contributor Author

carterkozak commented Sep 11, 2019 via email

/**
* Opens a new {@link SpanType#LOCAL LOCAL} span for this thread's call trace, labeled with the provided operation.
*/
public static CloseableTracer startSpan(Supplier<String> operation) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm worried that clients might choose to use this instead of the normal one for plain string concatenations which are not that expensive, thereby potentially slowing down hot paths.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Today hot paths are slow depending on the length of the http path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants