Skip to content

Commit

Permalink
fix smoke tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shashank11p committed Mar 18, 2024
1 parent 2ac846c commit 0d7c40d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import com.google.protobuf.util.JsonFormat;
import io.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;
import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;
import io.opentelemetry.proto.trace.v1.InstrumentationLibrarySpans;
import io.opentelemetry.proto.trace.v1.ScopeSpans;
import io.opentelemetry.proto.trace.v1.Span;
import java.io.IOException;
import java.time.Duration;
Expand Down Expand Up @@ -160,11 +160,11 @@ protected static Stream<Span> getSpanStream(Collection<ExportTraceServiceRequest
.flatMap(librarySpans -> librarySpans.getSpansList().stream());
}

protected static Stream<InstrumentationLibrarySpans> getInstrumentationLibSpanStream(
protected static Stream<ScopeSpans> getInstrumentationLibSpanStream(
Collection<ExportTraceServiceRequest> traceRequest) {
return traceRequest.stream()
.flatMap(request -> request.getResourceSpansList().stream())
.flatMap(resourceSpans -> resourceSpans.getInstrumentationLibrarySpansList().stream());
.flatMap(resourceSpans -> resourceSpans.getScopeSpansList().stream());
}

protected Collection<ExportTraceServiceRequest> waitForTraces(final int count) {
Expand Down Expand Up @@ -237,7 +237,7 @@ protected boolean hasMetricNamed(
String metricName, Collection<ExportMetricsServiceRequest> metricRequests) {
return metricRequests.stream()
.flatMap(metricRequest -> metricRequest.getResourceMetricsList().stream())
.flatMap(resourceMetrics -> resourceMetrics.getInstrumentationLibraryMetricsList().stream())
.flatMap(resourceMetrics -> resourceMetrics.getScopeMetricsList().stream())
.flatMap(
instrumentationLibraryMetrics ->
instrumentationLibraryMetrics.getMetricsList().stream())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,7 @@ public void get() throws IOException {
Assertions.assertTrue(
getInstrumentationLibSpanStream(traces)
.anyMatch(
instLibSpan ->
instLibSpan
.getInstrumentationLibrary()
.getVersion()
.equals(currentAgentVersion)));
instLibSpan -> instLibSpan.getScope().getVersion().equals(currentAgentVersion)));
Assertions.assertEquals(
0,
getSpanStream(traces)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import io.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;
import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import io.opentelemetry.semconv.ResourceAttributes;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
Expand Down Expand Up @@ -126,11 +126,7 @@ public void postJson() throws IOException, InterruptedException {
Assertions.assertTrue(
getInstrumentationLibSpanStream(traces)
.anyMatch(
instLibSpan ->
instLibSpan
.getInstrumentationLibrary()
.getVersion()
.equals(currentAgentVersion)));
instLibSpan -> instLibSpan.getScope().getVersion().equals(currentAgentVersion)));
Assertions.assertTrue(
getSpanStream(traces)
.flatMap(span -> span.getAttributesList().stream())
Expand Down

0 comments on commit 0d7c40d

Please sign in to comment.