From 407d9e0ad820c7162c6bbeb13d11c00331f49d70 Mon Sep 17 00:00:00 2001 From: Thomas Grassauer Date: Wed, 24 Jan 2018 16:47:17 +0100 Subject: [PATCH 1/2] moved test files --- .../openkit/{test => core/util}/DefaultLoggerTest.java | 2 +- .../openkit/{test => core/util}/InetAddressValidatorTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename src/test/java/com/dynatrace/openkit/{test => core/util}/DefaultLoggerTest.java (95%) rename src/test/java/com/dynatrace/openkit/{test => core/util}/InetAddressValidatorTest.java (96%) diff --git a/src/test/java/com/dynatrace/openkit/test/DefaultLoggerTest.java b/src/test/java/com/dynatrace/openkit/core/util/DefaultLoggerTest.java similarity index 95% rename from src/test/java/com/dynatrace/openkit/test/DefaultLoggerTest.java rename to src/test/java/com/dynatrace/openkit/core/util/DefaultLoggerTest.java index 8cf69074..a372a40f 100644 --- a/src/test/java/com/dynatrace/openkit/test/DefaultLoggerTest.java +++ b/src/test/java/com/dynatrace/openkit/core/util/DefaultLoggerTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.dynatrace.openkit.test; +package com.dynatrace.openkit.core.util; import com.dynatrace.openkit.core.util.DefaultLogger; import org.junit.Test; diff --git a/src/test/java/com/dynatrace/openkit/test/InetAddressValidatorTest.java b/src/test/java/com/dynatrace/openkit/core/util/InetAddressValidatorTest.java similarity index 96% rename from src/test/java/com/dynatrace/openkit/test/InetAddressValidatorTest.java rename to src/test/java/com/dynatrace/openkit/core/util/InetAddressValidatorTest.java index f71b930a..c464f938 100644 --- a/src/test/java/com/dynatrace/openkit/test/InetAddressValidatorTest.java +++ b/src/test/java/com/dynatrace/openkit/core/util/InetAddressValidatorTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.dynatrace.openkit.test; +package com.dynatrace.openkit.core.util; import com.dynatrace.openkit.core.util.InetAddressValidator; import org.junit.Test; From 77fce159f3a512398f0e4e8fec08ecc1b2cd7e10 Mon Sep 17 00:00:00 2001 From: Thomas Grassauer Date: Wed, 24 Jan 2018 17:17:32 +0100 Subject: [PATCH 2/2] updated documentation --- README.md | 14 +++++--------- docs/example.md | 11 ++++++++--- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 20ed1a54..162683c1 100644 --- a/README.md +++ b/README.md @@ -21,12 +21,12 @@ This repository contains the reference implementation in pure Java. Other implem * Create Sessions and User Actions * Report values, events, errors and crashes * Trace web requests to server-side PurePaths -* Sessions can be tagged with a user tag +* Tag Sessions with a user tag * Use it together with Dynatrace or AppMon ## What you cannot do with the OpenKit -* Create server-side PurePaths (you have to use an ADK for that) -* Create metrics (you have to use an ADK for that) +* Create server-side PurePaths (this functionality will be provided by OneAgent SDKs) +* Create metrics (this functionality will be provided by OneAgent SDKs) ## Design Principles * API should be as simple and easy-to-understand as possible @@ -152,6 +152,8 @@ OpenKit openKit = new DynatraceOpenKitBuilder(endpointURL, applicationID, device .withModelID("MyModelID") .build(); +// This call is optional. If waitForInitCompletion is not called, OpenKit +// will be initialized asynchronously. openKit.waitForInitCompletion(); String clientIP = "8.8.8.8"; @@ -171,12 +173,6 @@ session.end(); openKit.shutdown(); ``` - ## Known Current Limitations * problem with SSL keysize > 1024 for Diffie-Hellman (used by Dynatrace) in Java 6 (http://bugs.java.com/bugdatabase/view_bug.do?bug_id=7044060) * fixed in Java 6u171, which is only available via Oracle support (http://bugs.java.com/bugdatabase/view_bug.do?bug_id=8182231) - -## TODOs -* prevent re-entrances e.g. of startup/shutdown -* HTTP optimizations (reuse connection, pool http client?) -* introduce traffic control diff --git a/docs/example.md b/docs/example.md index 1fe0b171..3fdc6832 100644 --- a/docs/example.md +++ b/docs/example.md @@ -83,14 +83,19 @@ in `isDebugEnabled` and `isInfoEnabled`. ## Initializing OpenKit When obtaining an OpenKit instance from the OpenKit builder the instance starts an automatic -initialization phase. Since initialization happens asynchronously the application developers -might want to wait until initialization completes, as shown in the example below. +initialization phase. By default, initialization is performed asynchronously. + +There might be situations when a developer wants to ensure that initialization is completed before proceeding with +the program logic. For example, short-lived applications where a valid init and shutdown cannot be guaranteed. In +such a case `waitForInitCompletion` can be used. ```java // wait until the OpenKit instance is fully initialized boolean success = openKit.waitForInitCompletion(); ``` +:grey_exclamation: Please refer to the Javadoc for additional information. + The method `waitForInitCompletion` blocks the calling thread until OpenKit is initialized. In case of misconfiguration this might block the calling thread indefinitely. The return value indicates whether the OpenKit instance has been initialized or `shutdown` has been called meanwhile. @@ -330,4 +335,4 @@ When an OpenKit instance is no longer needed (e.g. the application using OpenKit obtained instance can be cleared by invoking the `shutdown` method. Calling the `shutdown` method blocks the calling thread while the OpenKit flushes data which has not been transmitted yet to the backend (Dynatrace SaaS/Dynatrace Managed/AppMon). -Details are explained in [internals.md](#internals.md) +Details are explained in [internals.md](internals.md)