55
66package io .opentelemetry .smoketest ;
77
8- import io .opentelemetry .javaagent .testing .common . AgentTestingExporterAccess ;
8+ import io .opentelemetry .instrumentation .testing .internal . TelemetryConverter ;
99import io .opentelemetry .sdk .logs .data .LogRecordData ;
1010import io .opentelemetry .sdk .metrics .data .MetricData ;
1111import io .opentelemetry .sdk .trace .data .SpanData ;
@@ -29,23 +29,29 @@ public void clearTelemetry() {
2929
3030 public List <SpanData > waitForTraces () {
3131 try {
32- return AgentTestingExporterAccess .getSpanData (
32+ return TelemetryConverter .getSpanData (
3333 Collections .singletonList (waitForContent ("get-traces" )));
3434 } catch (InterruptedException e ) {
3535 throw new RuntimeException (e );
3636 }
3737 }
3838
3939 public Collection <MetricData > waitForMetrics () {
40- // return waitForTelemetry("get-metrics", () -> ExportMetricsServiceRequest.newBuilder());
41- // todo
42- return Collections .emptyList ();
40+ try {
41+ return TelemetryConverter .getMetricsData (
42+ Collections .singletonList (waitForContent ("get-metrics" )));
43+ } catch (InterruptedException e ) {
44+ throw new RuntimeException (e );
45+ }
4346 }
4447
4548 public Collection <LogRecordData > waitForLogs () {
46- // return waitForTelemetry("get-logs", () -> ExportLogsServiceRequest.newBuilder());
47- // todo
48- return Collections .emptyList ();
49+ try {
50+ return TelemetryConverter .getLogRecordData (
51+ Collections .singletonList (waitForContent ("get-logs" )));
52+ } catch (InterruptedException e ) {
53+ throw new RuntimeException (e );
54+ }
4955 }
5056
5157 private byte [] waitForContent (String path ) throws InterruptedException {
@@ -63,6 +69,9 @@ private byte[] waitForContent(String path) throws InterruptedException {
6369 TimeUnit .MILLISECONDS .sleep (500 );
6470 }
6571
72+ // todo remove debug
73+ System .out .println (new String (content , StandardCharsets .UTF_8 ));
74+
6675 return content ;
6776 }
6877
0 commit comments