Skip to content

Documentation #29

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

Merged
merged 8 commits into from
Jul 10, 2017
Merged

Documentation #29

merged 8 commits into from
Jul 10, 2017

Conversation

gpolaert
Copy link
Contributor

@gpolaert gpolaert commented Jul 3, 2017

No description provided.


The method above is now instrumented. As you can see, the tracer is retrieved from a global registry, called `GlobalTracer`.

The last thing you have to do is providing a configured tracer. This can be easily done by using the `TracerFactory`.
Copy link

@LotharSee LotharSee Jul 3, 2017

Choose a reason for hiding this comment

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

Are we still automatically configuring the tracer when running the Agent?
If yes, we should certainly state it (and even explain it as the default/simple what it should be done/move this manual configuration of the Tracer is an advanced section).

Once, the DDTrace is loaded, you can start to instrument your code using the Opentracing SDK or the `@Trace` annotation.
`@Trace` is actually a Datadog specific, but we plan to submit it to Opentracing foundation.
@Trace(operationName = "operation-name")
void methodSDK() {

Choose a reason for hiding this comment

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

As part of the example, let's should how, from inside methodSDK, you can access the span generated from the annotation, set its resource, set tags, etc...

```
The annotations are resolved at the runtime by the autotracing agent. If you want to use the annotations,

Choose a reason for hiding this comment

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

s/so have to provide the agent/you must run the Java Agent


To attach the agent to the JVM, you simply have to declare the provided `jar` file in your

Choose a reason for hiding this comment

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

This explanation of the Agent shouldn't live here, it should go with the first section "Use the autotracing agent for well-known framework". Here, you just link to it.


Datadog instruments many frameworks and libraries by default: SpringBoot, JDBC, Mongo, JMS, Tomcat, etc.
Check the dedicated project and agent: [dd-java-agent](../dd-java-agent)

Choose a reason for hiding this comment

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

It is good to have here the bare minimum to run the javaagent without having the user jumping to the other page (a bit like what you did at the end of the file).

### How the Datadog Tracer (DDTrace) is loaded in the project?
### <a name="api"></a>Custom instrumentations using Opentracing API

If you want to add custom instrumenting to your code, you have to use the Opentracing API.

Choose a reason for hiding this comment

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

I suggest a different approach.

  • To add instrumentation to your own code, you can use the OpenTracing API.
  • Then add a complete example: setting service, resource, tags, ...
  • Document here the API (so that they don't have to jump to the OT doc). At the same time, we can properly document our special fields (service, resource).
  • Link to the OT documentation at the end for further documentation.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest also including the gradle/maven string to add to your project to add as a compile time dependency.

Copy link
Contributor Author

@gpolaert gpolaert Jul 4, 2017

Choose a reason for hiding this comment

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

Should we add a new page for documented the API.

If we add the API, could it be verbose?

Copy link
Contributor

@tylerbenson tylerbenson left a comment

Choose a reason for hiding this comment

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

I think we need to replace mentions of "autotracing". After discussing with @LotharSee, I feel it's probably best for now to not rename that project, but leave it as is. Are you ok leaving that project name alone?


The Datadog Java Tracer is an OpenTracing-compatible tracer. It provides all resources needed to instrument your code.
The Datadog Tracer is an Opentracing compatible tracer. It provides all resources needed to instrument your code
Copy link
Contributor

Choose a reason for hiding this comment

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

When mentioning Opentracing the first time, I suggest either adding a link to either https://github.com/opentracing/opentracing-java or http://opentracing.io/.


The Datadog Java Tracer is an OpenTracing-compatible tracer. It provides all resources needed to instrument your code.
The Datadog Tracer is an Opentracing compatible tracer. It provides all resources needed to instrument your code
and report each operations, each traces directly to a Datadog APM platform.
Copy link
Contributor

Choose a reason for hiding this comment

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

"each operations, each traces" -> "each operation and each trace"

@@ -31,25 +32,80 @@ As just described, the tracer produces a trace composed of 4 spans, each represe
2. Span2 is the Span1's first child, representing the amount of time to understand the query, and perform the query
on the DB.
3. Span3, a Span1' grandchild, represents the DB time used to retrieve the data
4. Span4 is a child of Span2 and followed Span3. It represents a business process for instance.
4. Span4 is a child of Span2 and followed Span3. It represents a business/legacy operation.

This is a very simple example of how works [Opentracing](http://opentracing.io/).
Copy link
Contributor

Choose a reason for hiding this comment

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

"example of how Opentracing works"


### <a name="framework"></a>Use the autotracing agent for well-known framework

Datadog instruments many frameworks and libraries by default: SpringBoot, JDBC, Mongo, JMS, Tomcat, etc.
Copy link
Contributor

Choose a reason for hiding this comment

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

"Datadog uses instrumentation contributed by the community to instrument many frameworks..."

### How the Datadog Tracer (DDTrace) is loaded in the project?
### <a name="api"></a>Custom instrumentations using Opentracing API

If you want to add custom instrumenting to your code, you have to use the Opentracing API.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest also including the gradle/maven string to add to your project to add as a compile time dependency.

<version>${opentracing.version}</version>
</dependency>

<!-- Datadog Tracer (only useful if you do not use the Datadog autotracing agent) -->
Copy link
Contributor

Choose a reason for hiding this comment

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

"only useful" -> "only needed"

@tylerbenson tylerbenson force-pushed the gpolaert/documentation branch from b488134 to 58c9cba Compare July 3, 2017 17:46
@tylerbenson
Copy link
Contributor

As with the other branch, I just force pushed to this branch to make sure the new maven settings are populated everywhere. Please let me know if you have troubles with this force push.

@gpolaert
Copy link
Contributor Author

gpolaert commented Jul 4, 2017

@LotharSee @tylerbenson updated!



### How to instrument well-known framework?
## How to instrument your application?

Choose a reason for hiding this comment

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

Before this advanced section, we should provide a "Quick start guide" where we put the strict minimum to have it running (just the java agent) + say to have the Agent running. With the config defaults, that should just work.

Similar examples for other languages: https://app.datadoghq.com/apm/install


1. [Configure the Datadog Tracer](#config)

Choose a reason for hiding this comment

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

That should be 2. instead of 1.: first you instrument your app, then you may need to tweak the config (but most of the time you won't right away).


1. [Configure the Datadog Tracer](#config)
2. Choose one of the 3 ways to instrument an application:

Choose a reason for hiding this comment

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

Imho, we should not oppose these 3 ways (not "choose one"), but instead offer them all together. ie. we should word it as successive steps:

  • Run the auto tracing agent
  • Extend it with your own instrumentation (then in this section we document the Tracer/Span/annotation API).


//Do some thing here ...
Thread.sleep(1_000);

// Close the span, the trace will automatically reported to the writer configured
span.close();
span.finish();
}

}

Choose a reason for hiding this comment

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

We could probably add a set of more / advanced examples in a docs directory, then link to it from there. (there, we would be able to use the entire OpenTracing API with some real examples, to which people can refer).

}

}
```

The method above is now instrumented. As you can see, the tracer is retrieved from a global registry, called `GlobalTracer`.

Choose a reason for hiding this comment

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

This is more advanced, more especially if people run the Trace Agent it is not needed and might confuse them.
We could put that with other advanced examples.

see traces directly to your Datadog account.
The factory looks for a `dd-trace.yaml` file in the classpath.

Finally, do not forget to add the corresponding dependencies to your project.

Choose a reason for hiding this comment

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

Maybe we should start with that?

@tylerbenson
Copy link
Contributor

I agree with @LotharSee's suggestions. I'll approve, but I suggest you adopt his suggestions.

@gpolaert
Copy link
Contributor Author

gpolaert commented Jul 7, 2017

Sure, I'm still continuing on that PR

This was referenced May 7, 2025
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