Skip to content

Commit 0163d09

Browse files
author
Heiko Holz
authored
Closes #1512: [Feature] - Update otel-collector image used in integration tests to latest (#1514)
* feat(upgrade): update otelcol image used in ExportServiceIntegrationTestBase * set compression to 'none' in the otlp exporter defined in otel-colfig.yaml * fix path of otlp tracing exporter in tests (#1512)
1 parent d67cbd3 commit 0163d09

File tree

4 files changed

+24
-6
lines changed

4 files changed

+24
-6
lines changed

inspectit-ocelot-core/src/test/java/rocks/inspectit/ocelot/core/exporter/ExporterServiceIntegrationTestBase.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@
5757
@Testcontainers(disabledWithoutDocker = true)
5858
abstract class ExporterServiceIntegrationTestBase extends SpringTestBase {
5959

60-
static final String COLLECTOR_IMAGE = "ghcr.io/open-telemetry/opentelemetry-java/otel-collector@sha256:d34519458388e55a3fce38a33e6bc424267c1f432927c09e932ba45f7575bd84";
60+
static final String COLLECTOR_TAG = "0.58.0";
61+
62+
static final String COLLECTOR_IMAGE = "otel/opentelemetry-collector-contrib:" + COLLECTOR_TAG;
6163

6264
static final Integer COLLECTOR_OTLP_GRPC_PORT = 4317;
6365

@@ -91,7 +93,7 @@ abstract class ExporterServiceIntegrationTestBase extends SpringTestBase {
9193
private static final Logger LOGGER = Logger.getLogger(ExporterServiceIntegrationTestBase.class.getName());
9294

9395
/**
94-
* The {@link OtlpGrpcServer} used as an exporter endpoirt for the OpenTelemetry Collector
96+
* The {@link OtlpGrpcServer} used as an exporter endpoint for the OpenTelemetry Collector
9597
*/
9698
static OtlpGrpcServer grpcServer;
9799

@@ -162,6 +164,17 @@ static String getEndpoint(Integer originalPort, String path) {
162164
return String.format("http://%s:%d/%s", collector.getHost(), collector.getMappedPort(originalPort), path.startsWith("/") ? path.substring(1) : path);
163165
}
164166

167+
/**
168+
* Gets the desired endpoint of the {@link #collector} constructed as 'http://{@link GenericContainer#getHost() collector.getHost()}:{@link GenericContainer#getMappedPort(int) collector.getMappedPort(port)}'
169+
*
170+
* @param originalPort the port to get the actual mapped port for
171+
*
172+
* @return the constructed endpoint for the {@link #collector}
173+
*/
174+
static String getEndpoint(Integer originalPort) {
175+
return String.format("http://%s:%d", collector.getHost(), collector.getMappedPort(originalPort));
176+
}
177+
165178
/**
166179
* Creates a nested trace with parent and child span and flushes them.
167180
*

inspectit-ocelot-core/src/test/java/rocks/inspectit/ocelot/core/exporter/OtlpMetricsExporterServiceIntTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void clearRequests() {
5151
@Test
5252
void verifyMetricsWrittenGrpc() {
5353
updateProperties(mps -> {
54-
mps.setProperty("inspectit.exporters.metrics.otlp.endpoint", getEndpoint(COLLECTOR_OTLP_GRPC_PORT, OTLP_METRICS_PATH));
54+
mps.setProperty("inspectit.exporters.metrics.otlp.endpoint", getEndpoint(COLLECTOR_OTLP_GRPC_PORT));
5555
mps.setProperty("inspectit.exporters.metrics.otlp.export-interval", "500ms");
5656
mps.setProperty("inspectit.exporters.metrics.otlp.enabled", ExporterEnabledState.ENABLED);
5757
mps.setProperty("inspectit.exporters.metrics.otlp.protocol", TransportProtocol.GRPC);

inspectit-ocelot-core/src/test/java/rocks/inspectit/ocelot/core/exporter/OtlpTraceExporterServiceIntTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
@DirtiesContext
2323
public class OtlpTraceExporterServiceIntTest extends ExporterServiceIntegrationTestBase {
2424

25-
public static final String OTLP_GRPC_TRACING_PATH = "/v1/trace";
25+
public static final String OTLP_TRACING_PATH = "/v1/traces";
2626

2727
@RegisterExtension
2828
LogCapturer warnLogs = LogCapturer.create()
@@ -41,7 +41,7 @@ void clearRequests() {
4141
void verifyTraceSentGrpc() {
4242
updateProperties(properties -> {
4343
properties.setProperty("inspectit.exporters.tracing.otlp.protocol", TransportProtocol.GRPC);
44-
properties.setProperty("inspectit.exporters.tracing.otlp.endpoint", getEndpoint(COLLECTOR_OTLP_GRPC_PORT, OTLP_GRPC_TRACING_PATH));
44+
properties.setProperty("inspectit.exporters.tracing.otlp.endpoint", getEndpoint(COLLECTOR_OTLP_GRPC_PORT));
4545
properties.setProperty("inspectit.exporters.tracing.otlp.enabled", ExporterEnabledState.ENABLED);
4646
});
4747

@@ -59,7 +59,7 @@ void verifyTraceSentGrpc() {
5959
void verifyTraceSentHttp() {
6060
updateProperties(properties -> {
6161
properties.setProperty("inspectit.exporters.tracing.otlp.protocol", TransportProtocol.HTTP_PROTOBUF);
62-
properties.setProperty("inspectit.exporters.tracing.otlp.endpoint", getEndpoint(COLLECTOR_OTLP_HTTP_PORT, OTLP_GRPC_TRACING_PATH));
62+
properties.setProperty("inspectit.exporters.tracing.otlp.endpoint", getEndpoint(COLLECTOR_OTLP_HTTP_PORT, OTLP_TRACING_PATH));
6363
properties.setProperty("inspectit.exporters.tracing.otlp.enabled", ExporterEnabledState.ENABLED);
6464
});
6565

inspectit-ocelot-core/src/test/resources/otel-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ exporters:
3838
endpoint: $OTLP_EXPORTER_ENDPOINT
3939
tls:
4040
insecure: true
41+
compression: none
42+
4143
service:
4244
extensions: [health_check]
4345
pipelines:
@@ -50,3 +52,6 @@ service:
5052
logs:
5153
receivers: [otlp]
5254
exporters: [logging, otlp]
55+
telemetry:
56+
logs:
57+
level: "info"

0 commit comments

Comments
 (0)