-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix throwing exception when tracing protocol is not grpc
Adjust exception message for unsupported tracing exporter protocols Add test for unsupported otlp exporter protocol config
- Loading branch information
Showing
4 changed files
with
55 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...o/quarkus/opentelemetry/deployment/exporter/otlp/OtlpExporterUnsupportedProtocolTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package io.quarkus.opentelemetry.deployment.exporter.otlp; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static org.junit.jupiter.api.Assertions.fail; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class OtlpExporterUnsupportedProtocolTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest TEST = new QuarkusUnitTest() | ||
.withEmptyApplication() | ||
.overrideConfigKey("otel.traces.exporter", "cdi") | ||
.overrideConfigKey("quarkus.otel.exporter.otlp.traces.protocol", "http/protobuf") | ||
.overrideConfigKey("quarkus.opentelemetry.tracer.exporter.otlp.endpoint", "http://localhost ") | ||
.overrideConfigKey("quarkus.otel.bsp.schedule.delay", "50") | ||
.overrideConfigKey("quarkus.otel.bsp.export.timeout", "1s") | ||
.assertException(t -> { | ||
Throwable e = t; | ||
IllegalStateException ie = null; | ||
while (e != null) { | ||
if (t instanceof IllegalStateException) { | ||
ie = (IllegalStateException) t; | ||
break; | ||
} | ||
e = e.getCause(); | ||
} | ||
|
||
if (ie == null) { | ||
fail("No IllegalStateException thrown: " + t); | ||
} | ||
assertTrue(ie.getMessage().contains("Only the `grpc` protocol is currently supported."), | ||
ie.getMessage()); | ||
assertTrue(ie.getMessage().contains("`http/protobuf` is available after Quarkus 3.3."), | ||
ie.getMessage()); | ||
assertTrue(ie.getMessage().contains("Please check `otel.exporter.otlp.traces.protocol` property"), | ||
ie.getMessage()); | ||
}); | ||
|
||
@Test | ||
void testNotSupportedProtocolConfig() { | ||
fail(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters