forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request quarkusio#35193 from michalvavrik/feature/fix-otel…
…-svc-name-when-no-attrs OpenTelemetry service name should have higher priority than app name when no resource attributes are set
- Loading branch information
Showing
7 changed files
with
115 additions
and
31 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
...rc/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameAppNameTest.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,22 @@ | ||
package io.quarkus.opentelemetry.deployment; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; | ||
import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class OpenTelemetryServiceNameAppNameTest extends OpenTelemetryServiceNameBaseTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest TEST = new QuarkusUnitTest().setArchiveProducer( | ||
() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClass(TestSpanExporter.class) | ||
.addClass(TestSpanExporterProvider.class) | ||
.addAsResource(new StringAsset("" + | ||
"quarkus.otel.bsp.schedule.delay=50\n" + | ||
"quarkus.application.name=" + SERVICE_NAME + "\n"), "application.properties")); | ||
} |
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
22 changes: 22 additions & 0 deletions
22
...io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameCombinedResourceWinsTest.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,22 @@ | ||
package io.quarkus.opentelemetry.deployment; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; | ||
import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class OpenTelemetryServiceNameCombinedResourceWinsTest extends OpenTelemetryServiceNameBaseTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest TEST = new QuarkusUnitTest().setArchiveProducer( | ||
() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClass(TestSpanExporter.class) | ||
.addClass(TestSpanExporterProvider.class)) | ||
.overrideConfigKey("quarkus.application.name", "application-name-must-fail") | ||
.overrideRuntimeConfigKey("quarkus.otel.bsp.schedule.delay", "50")// speed up test | ||
.overrideRuntimeConfigKey("quarkus.otel.service.name", SERVICE_NAME) | ||
.overrideRuntimeConfigKey("quarkus.otel.resource.attributes", "service.name=" + "attributes-must-fail"); | ||
} |
21 changes: 21 additions & 0 deletions
21
.../io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameCombinedServiceWinsTest.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,21 @@ | ||
package io.quarkus.opentelemetry.deployment; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; | ||
import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class OpenTelemetryServiceNameCombinedServiceWinsTest extends OpenTelemetryServiceNameBaseTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest TEST = new QuarkusUnitTest().setArchiveProducer( | ||
() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClass(TestSpanExporter.class) | ||
.addClass(TestSpanExporterProvider.class)) | ||
.overrideConfigKey("quarkus.application.name", "application-name-must-fail") | ||
.overrideRuntimeConfigKey("quarkus.otel.bsp.schedule.delay", "50")// speed up test | ||
.overrideRuntimeConfigKey("quarkus.otel.resource.attributes", "service.name=" + SERVICE_NAME); | ||
} |
20 changes: 20 additions & 0 deletions
20
...java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameNoResourceAttrsTest.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,20 @@ | ||
package io.quarkus.opentelemetry.deployment; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; | ||
import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class OpenTelemetryServiceNameNoResourceAttrsTest extends OpenTelemetryServiceNameBaseTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest TEST = new QuarkusUnitTest().setArchiveProducer( | ||
() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClass(TestSpanExporter.class) | ||
.addClass(TestSpanExporterProvider.class)) | ||
.overrideConfigKey("quarkus.otel.service.name", SERVICE_NAME) | ||
.overrideRuntimeConfigKey("quarkus.otel.bsp.schedule.delay", "50");// speed up test | ||
} |
20 changes: 20 additions & 0 deletions
20
...st/java/io/quarkus/opentelemetry/deployment/OpenTelemetryServiceNameResourceAttrTest.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,20 @@ | ||
package io.quarkus.opentelemetry.deployment; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.opentelemetry.deployment.common.TestSpanExporter; | ||
import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class OpenTelemetryServiceNameResourceAttrTest extends OpenTelemetryServiceNameBaseTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest TEST = new QuarkusUnitTest().setArchiveProducer( | ||
() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClass(TestSpanExporter.class) | ||
.addClass(TestSpanExporterProvider.class)) | ||
.overrideRuntimeConfigKey("quarkus.otel.bsp.schedule.delay", "50")// speed up test | ||
.overrideRuntimeConfigKey("quarkus.otel.resource.attributes", "service.name=" + SERVICE_NAME); | ||
} |
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