Skip to content

Start implementation of new tracer API#631

Merged
mar-kolya merged 2 commits into
masterfrom
mar-kolya/new-api-work
Dec 21, 2018
Merged

Start implementation of new tracer API#631
mar-kolya merged 2 commits into
masterfrom
mar-kolya/new-api-work

Conversation

@mar-kolya

@mar-kolya mar-kolya commented Dec 19, 2018

Copy link
Copy Markdown
Contributor

There are still quite a few TODOs and work left in general, but this seems to be a reasonable 'stopping point' to start reviewing these changes.

@mar-kolya mar-kolya requested a review from realark December 19, 2018 04:20
@mar-kolya mar-kolya force-pushed the mar-kolya/new-api-work branch from 3c3c5df to 0626101 Compare December 19, 2018 14:44
@mar-kolya mar-kolya added the tag: do not merge Do not merge changes label Dec 19, 2018
@mar-kolya mar-kolya force-pushed the mar-kolya/new-api-work branch 5 times, most recently from 17f12fa to c3660bc Compare December 19, 2018 20:19
@mar-kolya mar-kolya removed the tag: do not merge Do not merge changes label Dec 19, 2018
@mar-kolya

Copy link
Copy Markdown
Contributor Author

@realark this should be ready for review now

@tylerbenson tylerbenson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Lots of comments...

Comment thread dd-trace-ext/src/main/java/datadog/trace/tracer/ext/Scope.java Outdated
Comment thread dd-trace/src/main/java/datadog/trace/tracer/ContinuationImpl.java Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Originally when we called it just Interceptor, it was inside the class it was intercepting. With it being stand-alone, it doesn't have that context in the name.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We also now have single Interceptor class instead of multiple, so I kind of feel it makes sense to pull it out.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd like to group things better into packages. This could probably be grouped with Clock into a single package.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was actually considering that along with some other 'repackaging' - i.e. I was thinking making an internal package to 'hide' all implementational stuff. And yeah, time related stuff can go into its own package. The only thing that prevents doing that currently is the fact that error reporting stuff is 'package private' and it would be invisible if we move that - so I was hoping to postpone this repackaging until we have logging/error reporting better ironed out. Objections?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's fine. I hate that java doesn't allow sub-packages to access parent package private stuff.

Comment thread dd-trace/src/main/java/datadog/trace/tracer/Trace.java Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we consider a builder pattern for Tracer instead of providing all these constructors?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We probably should have builder. There is more work needed on the tracer since we also need some reasonable way to gather up and provide all interceptors to it. Maybe this can be hashed out at later stages?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why does clock need to maintain a reference to the source tracer? Is this only so Timestamp can reportError?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, right now that is the only reason.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we might need to have some sort of rate limiting on these kind of log messages as a misbehaving integration could easily cause a machine to fill up it's disk.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was planning to do a second iteration over this whole error/warning reporting part, so yeah having ratelimiting is a good idea, but maybe it can be left for another PR?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is interesting... what does this do?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The general idea in EqualsVerifier is to make sure that class adheres to 'standard' equals/hashCode contract. We have to disable some stuff - in this case we do not declare Clock final so we disable checks related to potential Clocks child classes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cool. Didn't know you could add comments to the when/then blocks.

@realark realark left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(Still reading through this. Thoughts so far)

Comment thread dd-trace/dd-trace.gradle Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

This is great. agent-bootstrap will be a great way to share internal tools to instrumentation and the core tracer. I added the project to list of potential renames (since it's more of a general util at this point and not agent-specific.

Comment thread dd-trace/src/main/java/datadog/trace/tracer/Continuation.java Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm okay with using finalizers, but given this caveat we should wrap them try - catch(Throwable) to ensure we don't miss errors.

Comment thread dd-trace/src/main/java/datadog/trace/tracer/SpanImpl.java Outdated
@mar-kolya mar-kolya force-pushed the mar-kolya/new-api-work branch 2 times, most recently from 0447f90 to c09418d Compare December 20, 2018 23:51
Comment thread dd-trace/src/main/java/datadog/trace/tracer/TraceImpl.java Outdated
Comment thread dd-trace/src/main/java/datadog/trace/tracer/TraceImpl.java Outdated
Comment thread dd-trace/src/main/java/datadog/trace/tracer/TraceImpl.java Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

With our new concept of invalid traces, can we remove the trace count incrementer and leave that up to the writer?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I've tried that. And then @tylerbenson had pointed out that we still need to count traces that have been discarded by sampler.

Comment thread dd-trace/src/test/groovy/datadog/trace/tracer/TestUtils.java Outdated

@realark realark left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good! Left a few small suggestions.

@mar-kolya mar-kolya force-pushed the mar-kolya/new-api-work branch from c09418d to 11fce64 Compare December 21, 2018 15:07
This mainly implements Span, Trace and Continuation logic.
@mar-kolya mar-kolya force-pushed the mar-kolya/new-api-work branch from 11fce64 to 3fb98ea Compare December 21, 2018 15:18
@mar-kolya mar-kolya merged commit 32d8313 into master Dec 21, 2018
@mar-kolya mar-kolya deleted the mar-kolya/new-api-work branch December 21, 2018 16:46
@tylerbenson tylerbenson added this to the 0.21.1 milestone Jan 22, 2019
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