Skip to content

Commit e944b27

Browse files
committed
doc updates
1 parent e61a3c7 commit e944b27

File tree

1 file changed

+62
-38
lines changed

1 file changed

+62
-38
lines changed

README.md

Lines changed: 62 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
# Dynatrace OneAgent SDK for Java
44

5-
This SDK allows Dynatrace customers to instrument java applications. This is useful to enhance the visibility for proprietary frameworks or custom frameworks not directly supported by Dynatrace OneAgent out-of-the-box.
5+
This SDK allows Dynatrace customers to instrument java applications. This is useful to enhance the visibility for proprietary frameworks or
6+
custom frameworks not directly supported by Dynatrace OneAgent out-of-the-box.
67

78
This is the official Java implementation of the [Dynatrace OneAgent SDK](https://github.com/Dynatrace/OneAgent-SDK).
89

@@ -17,12 +18,12 @@ This is the official Java implementation of the [Dynatrace OneAgent SDK](https:/
1718
* [OneAgentSDK object](#oneagentsdkobject)
1819
* [Tracers](#tracers)
1920
* [Features](#features)
20-
* [Trace incoming and outgoing remote calls](#remoting)
21-
* [In process linking](#inprocess)
22-
* [Add custom request attributes](#scav)
23-
* [Trace web requests](#webrequests)
24-
* [Trace incoming web requests](#inwebrequests)
25-
* [Trace outgoing web requests](#outwebrequests)
21+
* [Trace incoming and outgoing remote calls](#remoting)
22+
* [In process linking](#inprocess)
23+
* [Add custom request attributes](#scav)
24+
* [Trace web requests](#webrequests)
25+
* [Trace incoming web requests](#inwebrequests)
26+
* [Trace outgoing web requests](#outwebrequests)
2627
* [Trace messaging](#messaging)
2728
* [Further reading](#furtherreading)
2829
* [Help & Support](#help)
@@ -64,22 +65,25 @@ If you want to integrate the OneAgent SDK into your application, just add the fo
6465
<dependency>
6566
<groupId>com.dynatrace.oneagent.sdk.java</groupId>
6667
<artifactId>oneagent-sdk</artifactId>
67-
<version>1.4.0</version>
68+
<version>1.5.0</version>
6869
<scope>compile</scope>
6970
</dependency>
7071

71-
If you prefer to integrate the SDK using plain jar file, just download them from mavenCentral. You can find the download links for each version in the [Release notes](#releasenotes) section.
72+
If you prefer to integrate the SDK using plain jar file, just download them from mavenCentral. You can find the download links for each
73+
version in the [Release notes](#releasenotes) section.
7274

7375
The Dynatrace OneAgent SDK for Java has no further dependencies.
7476

7577
<a name="troubleshooting" />
7678

7779
### Troubleshooting
78-
If the SDK can't connect to the OneAgent (see usage of SDKState in samples) or you you don't see the desired result in the Dynatrace UI, you can set the following system property to print debug information to standard out:
80+
If the SDK can't connect to the OneAgent (see usage of SDKState in samples) or you you don't see the desired result in the Dynatrace UI,
81+
you can set the following system property to print debug information to standard out:
7982

8083
-Dcom.dynatrace.oneagent.sdk.debug=true
8184

82-
Additionally you should/have to ensure, that you have set a `LoggingCallback`. For usage see class `StdErrLoggingCallback` in `remotecall-server` module (in samples/remotecall folder).
85+
Additionally you should/have to ensure, that you have set a `LoggingCallback`. For usage see class `StdErrLoggingCallback` in
86+
`remotecall-server` module (in samples/remotecall folder).
8387

8488
<a name="apiconcepts" />
8589

@@ -108,13 +112,16 @@ default:
108112
}
109113
```
110114

111-
It is good practice to check the SDK state regularly as it may change at every point of time (except PERMANENTLY_INACTIVE never changes over JVM lifetime).
115+
It is good practice to check the SDK state regularly as it may change at every point of time (except PERMANENTLY_INACTIVE never
116+
changes over JVM lifetime).
112117

113118
<a name="tracers" />
114119

115120
### Tracers
116121

117-
To trace any kind of call you first need to create a Tracer. The Tracer object represents the logical and physical endpoint that you want to call. A Tracer serves two purposes. First to time the call (duraction, cpu and more) and report errors. That is why each Tracer has these three methods. The error method must be called only once, and it must be in between start and end.
122+
To trace any kind of call you first need to create a Tracer. The Tracer object represents the logical and physical endpoint that
123+
you want to call. A Tracer serves two purposes. First to time the call (duraction, cpu and more) and report errors. That is why
124+
each Tracer has these three methods. The error method must be called only once, and it must be in between start and end.
118125

119126
```Java
120127
void start();
@@ -123,13 +130,16 @@ void error(String message);
123130

124131
void end();
125132
```
126-
The second purpose of a Tracer is to allow tracing across process boundaries. To achieve that these kind of traces supply so called tags. Tags are strings or byte arrays that enable Dynatrace to trace a transaction end to end. As such the tag is the one information that you need to transport across these calls yourselfs.
133+
The second purpose of a Tracer is to allow tracing across process boundaries. To achieve that these kind of traces supply so called
134+
tags. Tags are strings or byte arrays that enable Dynatrace to trace a transaction end to end. As such the tag is the one information
135+
that you need to transport across these calls yourselfs.
127136

128137
<a name="features" />
129138

130139
## Features
131140

132-
The feature sets differ slightly with each language implementation. More functionality will be added over time, see <a href="https://answers.dynatrace.com/spaces/483/dynatrace-product-ideas/idea/198106/planned-features-for-oneagent-sdk.html" target="_blank">Planned features for OneAgent SDK</a> for details on upcoming features.
141+
The feature sets differ slightly with each language implementation. More functionality will be added over time, see <a href="https://answers.dynatrace.com/spaces/483/dynatrace-product-ideas/idea/198106/planned-features-for-oneagent-sdk.html" target="_blank">Planned features for OneAgent SDK</a>
142+
for details on upcoming features.
133143

134144
A more detailed specification of the features can be found in [Dynatrace OneAgent SDK](https://github.com/Dynatrace/OneAgent-SDK#features).
135145

@@ -146,12 +156,16 @@ A more detailed specification of the features can be found in [Dynatrace OneAgen
146156

147157
### Trace incoming and outgoing remote calls
148158

149-
You can use the SDK to trace proprietary IPC communication from one process to the other. This will enable you to see full Service Flow, PurePath and Smartscape topology for remoting technologies that Dynatrace is not aware of.
159+
You can use the SDK to trace proprietary IPC communication from one process to the other. This will enable you to see full Service Flow, PurePath
160+
and Smartscape topology for remoting technologies that Dynatrace is not aware of.
150161

151-
To trace any kind of remote call you first need to create a Tracer. The Tracer object represents the endpoint that you want to call, as such you need to supply the name of the remote service and remote method. In addition you need to transport the tag in your remote call to the server side if you want to trace it end to end.
162+
To trace any kind of remote call you first need to create a Tracer. The Tracer object represents the endpoint that you want to call, as such you
163+
need to supply the name of the remote service and remote method. In addition you need to transport the tag in your remote call to the server side
164+
if you want to trace it end to end.
152165

153166
```Java
154-
OutgoingRemoteCallTracer outgoingRemoteCall = OneAgentSDK.traceOutgoingRemoteCall("remoteMethodToCall", "RemoteServiceName", "rmi://Endpoint/service", ChannelType.TCP_IP, "remoteHost:1234");
167+
OneAgentSDK oneAgentSdk = OneAgentSDKFactory.createInstance();
168+
OutgoingRemoteCallTracer outgoingRemoteCall = oneAgentSdk.traceOutgoingRemoteCall("remoteMethodToCall", "RemoteServiceName", "rmi://Endpoint/service", ChannelType.TCP_IP, "remoteHost:1234");
155169
outgoingRemoteCall.setProtocolName("RMI/custom");
156170
outgoingRemoteCall.start();
157171
try {
@@ -164,7 +178,8 @@ try {
164178
}
165179
```
166180

167-
On the server side you need to wrap the handling and processing of your remote call as well. This will not only trace the server side call and everything that happens, it will also connect it to the calling side.
181+
On the server side you need to wrap the handling and processing of your remote call as well. This will not only trace the server side call and
182+
everything that happens, it will also connect it to the calling side.
168183

169184
```Java
170185
OneAgentSDK oneAgentSdk = OneAgentSDKFactory.createInstance();
@@ -189,14 +204,14 @@ try {
189204
You can use the SDK to link inside a single process. To link for eg. an asynchronous execution, you need the following code:
190205
```Java
191206
OneAgentSDK oneAgentSdk = OneAgentSDKFactory.createInstance();
192-
InProcessLink inProcessLink = sdk.createInProcessLink();
207+
InProcessLink inProcessLink = oneAgentSdk.createInProcessLink();
193208
```
194209

195-
Provide the returned inProcessLink to the code, that does the asynchronous execution:
210+
Provide the returned ``inProcessLink`` to the code, that does the asynchronous execution:
196211

197212
```Java
198-
OneAgentSDK sdk = OneAgentSDKFactory.createInstance();
199-
InProcessLinkTracer inProcessLinkTracer = sdk.traceInProcessLink(inProcessLink);
213+
OneAgentSDK oneAgentSdk = OneAgentSDKFactory.createInstance();
214+
InProcessLinkTracer inProcessLinkTracer = oneAgentSdk.traceInProcessLink(inProcessLink);
200215
inProcessLinkTracer.start();
201216
try {
202217
// do the work ...
@@ -212,7 +227,8 @@ try {
212227

213228
### Add custom request attributes
214229

215-
You can use the SDK to add custom request attributes to the current traced service. Custom request attributes allow you to do advanced filtering of your requests in Dynatrace.
230+
You can use the SDK to add custom request attributes to the current traced service. Custom request attributes allow you to do advanced filtering of
231+
your requests in Dynatrace.
216232

217233
Adding custom request attributes to the currently traced service call is simple. Just call one of the addCustomRequestAttribute methods with your key and value:
218234

@@ -231,18 +247,21 @@ When no service call is being traced, the custom request attributes are dropped.
231247

232248
#### Trace incoming web requests
233249

234-
You can use the SDK to trace incoming web requests. This might be useful if Dynatrace does not support the respective web server framework or language processing the incoming web requests.
250+
You can use the SDK to trace incoming web requests. This might be useful if Dynatrace does not support the respective web server framework or language
251+
processing the incoming web requests.
235252

236-
To trace an incoming web request you first need to create a WebServerInfo object. The info object represents the endpoint of your web server (web server name, application name and context root). This object should be reused for all traced web requests within for the same application.
253+
To trace an incoming web request you first need to create a WebServerInfo object. The info object represents the endpoint of your web server (web server
254+
name, application name and context root). This object should be reused for all traced web requests within for the same application.
237255

238256
```Java
239-
WebServerInfo wsInfo = OneAgentSDK.createWebServerInfo("WebShopProduction", "CheckoutService", "/api/service/checkout");
257+
WebServerInfo wsInfo = oneAgentSdk.createWebServerInfo("WebShopProduction", "CheckoutService", "/api/service/checkout");
240258
```
241259

242-
To trace a specific incoming web request you then need to create a Tracer object. Make sure you provide all http headers from the request to the SDK by calling addRequestHeader(...). This ensures that tagging with our built-in sensor will work.
260+
To trace a specific incoming web request you then need to create a Tracer object. Make sure you provide all http headers from the request to the SDK by
261+
calling addRequestHeader(...). This ensures that tagging with our built-in sensor will work.
243262

244263
```Java
245-
IncomingWebRequestTracer tracer = OneAgentSDK.traceIncomingWebRequest(wsInfo,"https://www.oursupershop.com/api/service/checkout/save","POST")
264+
IncomingWebRequestTracer tracer = oneAgentSdk.traceIncomingWebRequest(wsInfo,"https://www.oursupershop.com/api/service/checkout/save","POST")
246265

247266
for (Entry<String, String> headerField : httpRequest.getHeaders().entrySet()) {
248267
incomingWebrequestTracer.addRequestHeader(headerField.getKey(), headerField.getValue());
@@ -273,24 +292,27 @@ try {
273292

274293
#### Trace outgoing web requests
275294

276-
You can use the SDK to trace outgoing web requests. This might be useful if Dynatrace does not support the respective http library or language sending the request.
295+
You can use the SDK to trace outgoing web requests. This might be useful if Dynatrace does not support the respective http library or
296+
language sending the request.
277297

278-
To trace an outgoing web request you need to create a Tracer object. It is important to send the Dynatrace Header. This ensures that tagging with our built-in sensor will work.
298+
To trace an outgoing web request you need to create a Tracer object. It is important to send the Dynatrace Header. This ensures that
299+
tagging with our built-in sensor will work.
279300

280301
```Java
281302
OutgoingWebRequestTracer outgoingWebRequestTracer = oneAgentSdk.traceOutgoingWebRequest(url, "GET");
303+
304+
// provide all request headers to outgoingWebRequestTracer (optional):
305+
for (Entry<String, String> entry : yourHttpClient.getRequestHeaders().entrySet()) {
306+
outgoingWebRequestTracer.addRequestHeader(entry.getKey(), entry.getValue());
307+
}
308+
282309
outgoingWebRequestTracer.start();
283310
try {
284311
yourHttpClient.setUrl(url);
285312

286313
// sending HTTP header OneAgentSDK.DYNATRACE_HTTP_HEADERNAME is necessary for tagging:
287314
yourHttpClient.addRequestHeader(OneAgentSDK.DYNATRACE_HTTP_HEADERNAME, outgoingWebRequestTracer.getDynatraceStringTag());
288315

289-
// provide all request headers to outgoingWebRequestTracer (optional):
290-
for (Entry<String, String> entry : yourHttpClient.getRequestHeaders().entrySet()) {
291-
outgoingWebRequestTracer.addRequestHeader(entry.getKey(), entry.getValue());
292-
}
293-
294316
yourHttpClient.processHttpRequest();
295317

296318
for (Entry<String, List<String>> entry : yourHttpClient.getHeaderFields().entrySet()) {
@@ -341,7 +363,8 @@ try {
341363
}
342364
```
343365

344-
On the incoming side, we need to differentiate between the blocking receiving part and processing the received message. Therefore two different tracers are being used: ``ReceivingMessageTracer`` and ``ProcessingMessageTracer``.
366+
On the incoming side, we need to differentiate between the blocking receiving part and processing the received message. Therefore two
367+
different tracers are being used: ``ReceivingMessageTracer`` and ``ProcessingMessageTracer``.
345368

346369
```Java
347370
MessagingSystemInfo messagingSystemInfo = oneAgentSDK.createMessagingSystemInfo("myMessagingSystem",
@@ -379,7 +402,8 @@ while(true) {
379402
}
380403
```
381404

382-
In case of non-blocking receive (e. g. via eventhandler), there is no need to use ``ReceivingMessageTracer`` - just trace processing of the message by using the ``ProcessingMessageTracer``:
405+
In case of non-blocking receive (e. g. via eventhandler), there is no need to use ``ReceivingMessageTracer`` - just trace processing
406+
of the message by using the ``ProcessingMessageTracer``:
383407

384408
```Java
385409
MessagingSystemInfo messagingSystemInfo = oneAgentSDK.createMessagingSystemInfo("myMessagingSystem",

0 commit comments

Comments
 (0)