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

SpanBuilder interface for #5 #8

Merged
merged 1 commit into from
Sep 9, 2016
Merged

SpanBuilder interface for #5 #8

merged 1 commit into from
Sep 9, 2016

Conversation

cwe1ss
Copy link
Member

@cwe1ss cwe1ss commented Aug 31, 2016

As an example for #5, this would introduce a ISpanBuilder interface and remove the existing StartSpanOptions and the existing SpanBuilder implementation.

This is exactly how the Java version is implemented.

I favor having the interface over an actual implementation to let trace implementations optimize the behavior without having users to update their OpenTracing package.

@cwe1ss
Copy link
Member Author

cwe1ss commented Sep 4, 2016

I will merge this on Tuesday If there are no complaints by then.

@dawallin
Copy link
Contributor

dawallin commented Sep 5, 2016

As I commented in #5 I prefer the StartSpanOptions, and having the builder as an optional extension for a fluent API style. But if you think the SpanBuilder is better I won't object.

If we go for the SpanBuilder then this PR looks perfectly fine.

@cwe1ss
Copy link
Member Author

cwe1ss commented Sep 9, 2016

Ok, I'll merge it!

Btw, it would be possible to go the other way and offer non-breaking extension methods like this one in the future:

public static ISpan StartSpan(this ITracer tracer, string operationName, SpanReference reference)
{
    return tracer.BuildSpan(operationName).AddReference(reference).Start();
}

// Usage
tracer.StartSpan("get_account", SpanReference.ChildOf(parent));

// But it would even be more characters than the current solution
// so there's probably not much point... :-)
tracer.BuildSpan("get_account).AsChildOf(parent).Start();

@cwe1ss cwe1ss merged commit cf49e29 into opentracing:master Sep 9, 2016
@cwe1ss cwe1ss modified the milestone: 0.9.0 Sep 13, 2016
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.

2 participants