File tree Expand file tree Collapse file tree 7 files changed +20
-9
lines changed
main/java/org/hypertrace/agent/otel/extensions/config
java/org/hypertrace/agent/otel/extensions/config
smoke-tests/src/test/java/org/hypertrace/agent/smoketest Expand file tree Collapse file tree 7 files changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -43,10 +43,10 @@ The final artifact is in `javaagent/build/libs/hypertrace-agent-<version>-all.ja
4343Download the [ latest version] ( https://github.com/hypertrace/javaagent/releases/latest/download/hypertrace-agent-all.jar ) .
4444
4545``` bash
46- HT_EXPORTING_ENDPOINT =http://localhost:9411/api/v2/spans java -javaagent:javaagent/build/libs/hypertrace-agent-< version> -all.jar -jar app.jar
46+ HT_REPORTING_ENDPOINT =http://localhost:4317 java -javaagent:javaagent/build/libs/hypertrace-agent-< version> -all.jar -jar app.jar
4747```
4848
49- By default the agent uses Zipkin exporter.
49+ By default the agent uses Otlp exporter.
5050
5151The configuration precedence order
52521 . OpenTelemetry Agent's trace config file ` OTEL_TRACE_CONFIG ` /` otel.trace.config `
Original file line number Diff line number Diff line change 11service_name : service_name
22reporting :
3- endpoint : http://localhost:9411/api/v2/spans
3+ endpoint : http://localhost:4317
Original file line number Diff line number Diff line change 3838import org .hypertrace .agent .config .Config .Opa .Builder ;
3939import org .hypertrace .agent .config .Config .PropagationFormat ;
4040import org .hypertrace .agent .config .Config .Reporting ;
41+ import org .hypertrace .agent .config .Config .TraceReporterType ;
4142import org .slf4j .Logger ;
4243import org .slf4j .LoggerFactory ;
4344
@@ -52,7 +53,7 @@ private HypertraceConfig() {}
5253 private static volatile AgentConfig agentConfig ;
5354
5455 static final String DEFAULT_SERVICE_NAME = "unknown" ;
55- static final String DEFAULT_REPORTING_ENDPOINT = "http://localhost:9411/api/v2/spans " ;
56+ static final String DEFAULT_REPORTING_ENDPOINT = "http://localhost:4317 " ;
5657 static final String DEFAULT_OPA_ENDPOINT = "http://opa.traceableai:8181/" ;
5758 static final int DEFAULT_OPA_POLL_PERIOD_SECONDS = 30 ;
5859 // 128 KiB
@@ -143,7 +144,7 @@ private static Reporting.Builder applyReportingDefaults(Reporting.Builder builde
143144 builder .setEndpoint (StringValue .newBuilder ().setValue (DEFAULT_REPORTING_ENDPOINT ).build ());
144145 }
145146 if (builder .getTraceReporterType ().equals (Config .TraceReporterType .UNSPECIFIED )) {
146- builder .setTraceReporterType (Config . TraceReporterType .ZIPKIN );
147+ builder .setTraceReporterType (TraceReporterType .OTLP );
147148 }
148149 Builder opaBuilder = applyOpaDefaults (builder .getOpa ().toBuilder ());
149150 builder .setOpa (opaBuilder );
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ public void defaultValues() throws IOException {
4040 Assertions .assertTrue (agentConfig .getEnabled ().getValue ());
4141 Assertions .assertEquals ("unknown" , agentConfig .getServiceName ().getValue ());
4242 Assertions .assertEquals (
43- TraceReporterType .ZIPKIN , agentConfig .getReporting ().getTraceReporterType ());
43+ TraceReporterType .OTLP , agentConfig .getReporting ().getTraceReporterType ());
4444 Assertions .assertEquals (
4545 HypertraceConfig .DEFAULT_REPORTING_ENDPOINT ,
4646 agentConfig .getReporting ().getEndpoint ().getValue ());
@@ -106,7 +106,7 @@ private void assertConfig(AgentConfig agentConfig) {
106106 Assertions .assertEquals (
107107 TraceReporterType .OTLP , agentConfig .getReporting ().getTraceReporterType ());
108108 Assertions .assertEquals (
109- "http://localhost:9411 " , agentConfig .getReporting ().getEndpoint ().getValue ());
109+ "http://localhost:4317 " , agentConfig .getReporting ().getEndpoint ().getValue ());
110110 Assertions .assertEquals (true , agentConfig .getReporting ().getSecure ().getValue ());
111111 Assertions .assertEquals (
112112 "http://opa.localhost:8181/" , agentConfig .getReporting ().getOpa ().getEndpoint ().getValue ());
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ enabled: false
44propagationFormats :
55 - B3
66reporting :
7- endpoint : http://localhost:9411
7+ endpoint : http://localhost:4317
88 secure : true
99 trace_reporter_type : OTLP
1010 opa :
Original file line number Diff line number Diff line change 4949import org .testcontainers .utility .MountableFile ;
5050
5151public abstract class AbstractSmokeTest {
52+
5253 private static final Logger log = LoggerFactory .getLogger (OpenTelemetryStorage .class );
5354 private static final String OTEL_COLLECTOR_IMAGE = "otel/opentelemetry-collector:0.21.0" ;
5455 private static final String MOCK_BACKEND_IMAGE =
@@ -159,6 +160,13 @@ protected static Stream<InstrumentationLibrarySpans> getInstrumentationLibSpanSt
159160 .flatMap (resourceSpans -> resourceSpans .getInstrumentationLibrarySpansList ().stream ());
160161 }
161162
163+ protected Collection <ExportTraceServiceRequest > waitForTraces (final int count ) {
164+ return Awaitility .await ()
165+ .until (
166+ this ::waitForTraces ,
167+ exportTraceServiceRequests -> exportTraceServiceRequests .size () == count );
168+ }
169+
162170 protected Collection <ExportTraceServiceRequest > waitForTraces () throws IOException {
163171 String content = waitForContent ();
164172
Original file line number Diff line number Diff line change 2020import io .opentelemetry .semconv .resource .attributes .ResourceAttributes ;
2121import java .io .IOException ;
2222import java .util .ArrayList ;
23+ import java .util .Collection ;
2324import java .util .List ;
2425import java .util .jar .Attributes ;
2526import java .util .jar .JarFile ;
@@ -185,7 +186,8 @@ public void postJson_payload_truncation() throws IOException {
185186 try (Response response = client .newCall (request ).execute ()) {
186187 Assertions .assertEquals (response .body ().string (), requestBody );
187188 }
188- ArrayList <ExportTraceServiceRequest > traces = new ArrayList <>(waitForTraces ());
189+
190+ Collection <ExportTraceServiceRequest > traces = waitForTraces (2 );
189191
190192 List <String > responseBodyAttributes =
191193 getSpanStream (traces )
You can’t perform that action at this time.
0 commit comments