Skip to content

Commit

Permalink
feat(bootstrap): Migrate to JSON component
Browse files Browse the repository at this point in the history
  • Loading branch information
PerfectSlayer committed Nov 21, 2024
1 parent 45994e5 commit 546b7c8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 400 deletions.
1 change: 1 addition & 0 deletions dd-java-agent/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ tasks.withType(GenerateMavenPom).configureEach { task ->
}

dependencies {
implementation project(path: ':components:json')
modules {
module("com.squareup.okio:okio") {
replacedBy("com.datadoghq.okio:okio") // embed our patched fork
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package datadog.trace.bootstrap;

import datadog.json.JsonBuffer;
import java.io.IOException;
import java.io.OutputStream;
import java.util.concurrent.TimeUnit;

/** Thread safe telemetry class used to relay information about tracer activation. */
public abstract class BootstrapInitializationTelemetry {
/** Returns a singleton no op instance of initialization telemetry */
public static final BootstrapInitializationTelemetry noOpInstance() {
public static BootstrapInitializationTelemetry noOpInstance() {
return NoOp.INSTANCE;
}

Expand All @@ -17,8 +18,7 @@ public static final BootstrapInitializationTelemetry noOpInstance() {
*
* @param forwarderPath - a String - path to forwarding executable
*/
public static final BootstrapInitializationTelemetry createFromForwarderPath(
String forwarderPath) {
public static BootstrapInitializationTelemetry createFromForwarderPath(String forwarderPath) {
return new JsonBased(new ForwarderJsonSender(forwarderPath));
}

Expand Down Expand Up @@ -85,8 +85,8 @@ public void finish() {}
public static final class JsonBased extends BootstrapInitializationTelemetry {
private final JsonSender sender;

private JsonBuffer metaBuffer = new JsonBuffer();
private JsonBuffer pointsBuffer = new JsonBuffer();
private final JsonBuffer metaBuffer = new JsonBuffer();
private final JsonBuffer pointsBuffer = new JsonBuffer();

// one way false to true
private volatile boolean incomplete = false;
Expand Down Expand Up @@ -189,8 +189,8 @@ public void finish() {
}
}

public static interface JsonSender {
public abstract void send(JsonBuffer buffer) throws IOException;
public interface JsonSender {
void send(JsonBuffer buffer) throws IOException;
}

public static final class ForwarderJsonSender implements JsonSender {
Expand Down
264 changes: 0 additions & 264 deletions dd-java-agent/src/main/java/datadog/trace/bootstrap/JsonBuffer.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package datadog.trace.agent
package datadog.trace.bootstrap

import datadog.trace.bootstrap.BootstrapInitializationTelemetry
import datadog.trace.bootstrap.JsonBuffer
import datadog.json.JsonBuffer
import spock.lang.Specification

class BootstrapInitializationTelemetryTest extends Specification {
Expand Down
Loading

0 comments on commit 546b7c8

Please sign in to comment.