Skip to content

Commit

Permalink
Merge pull request #258 from brunobat/fix-docs
Browse files Browse the repository at this point in the history
Fix Docs
  • Loading branch information
brunobat authored Nov 7, 2024
2 parents a3a984e + ee607a1 commit 2203ca1
Show file tree
Hide file tree
Showing 9 changed files with 173 additions and 19 deletions.
16 changes: 5 additions & 11 deletions docs/modules/ROOT/pages/quarkus-opentelemetry-exporter-azure.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,6 @@ If you want to use the Azure Application Insights way of specifying the connecti
applicationinsights.connection.string=your_connection_string
----

* With the `APPLICATIONINSIGHTS_CONNECTION_STRING=your_connection_string` environment variable


You can disable the Azure export in this way:

[source]
----
quarkus.opentelemetry.tracer.exporter.azure.enabled=false
----

Read https://quarkus.io/guides/opentelemetry#configuration-reference[this page] to learn more configuration options.

== Enable more instrumentation
Expand All @@ -67,4 +57,8 @@ Read https://quarkus.io/guides/opentelemetry#configuration-reference[this page]
[[extension-configuration-reference]]
== Extension Configuration Reference

include::includes/quarkus-opentelemetry-tracer-exporter-azure.adoc[leveloffset=+1, opts=optional]
include::includes/quarkus-opentelemetry-exporter-azure_quarkus.otel.adoc[leveloffset=+1, opts=optional]

Configurations using the Azure semantics:

include::includes/quarkus-opentelemetry-exporter-azure_applicationinsights.adoc[leveloffset=+1, opts=optional]
53 changes: 47 additions & 6 deletions docs/pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.quarkiverse.opentelemetry.exporter</groupId>
Expand All @@ -12,11 +13,48 @@
<name>Quarkus Opentelemetry Exporter - Documentation</name>

<dependencies>
<dependency>
<groupId>io.quarkiverse.opentelemetry.exporter</groupId>
<artifactId>quarkus-opentelemetry-exporter-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.opentelemetry.exporter</groupId>
<artifactId>quarkus-opentelemetry-exporter-gcp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.opentelemetry.exporter</groupId>
<artifactId>quarkus-opentelemetry-exporter-azure</artifactId>
<version>${project.version}</version>
</dependency>

<!-- Make sure the doc is built after the other artifacts -->
<dependency>
<groupId>io.quarkiverse.opentelemetry.exporter</groupId>
<artifactId>quarkus-opentelemetry-exporter-gcp-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkiverse.opentelemetry.exporter</groupId>
<artifactId>quarkus-opentelemetry-exporter-azure</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

Expand Down Expand Up @@ -51,6 +89,14 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-config-doc-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<targetDirectory>${project.basedir}/modules/ROOT/pages/includes/</targetDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
Expand All @@ -63,11 +109,6 @@
<configuration>
<outputDirectory>modules/ROOT/pages/includes</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/../target/asciidoc/generated/config/</directory>
<include>quarkus-opentelemetry-tracer-exporter-*.adoc</include>
<filtering>false</filtering>
</resource>
<resource>
<directory>${project.basedir}/templates/includes</directory>
<include>attributes.adoc</include>
Expand Down
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-config-doc-maven-plugin</artifactId>
<version>${quarkus.version}</version>
</plugin>
</plugins>
</pluginManagement>
</build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package io.quarkiverse.opentelemetry.exporter.azure.deployment;

import jakarta.enterprise.inject.Instance;
import jakarta.inject.Inject;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.opentelemetry.api.OpenTelemetry;
import io.quarkiverse.opentelemetry.exporter.azure.runtime.AzureEndpointSampler;
import io.quarkus.test.QuarkusUnitTest;

public class AzureExporterDisabledTest {

@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest()
.withEmptyApplication()
.overrideConfigKey("quarkus.otel.azure.enabled", "false")
.overrideConfigKey("applicationinsights.connection.string",
"InstrumentationKey=bla;IngestionEndpoint=http://127.0.0.1:53602/export");

@Inject
OpenTelemetry openTelemetry;

// just some class that will be available if the Azure exporter is enabled.
@Inject
Instance<AzureEndpointSampler> azureEndpointSamplers;

@Test
void testOpenTelemetryButNoBatchSpanProcessor() {
Assertions.assertNotNull(openTelemetry);
Assertions.assertFalse(azureEndpointSamplers.isResolvable());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package io.quarkiverse.opentelemetry.exporter.azure.deployment;

import jakarta.enterprise.inject.Instance;
import jakarta.inject.Inject;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.opentelemetry.api.OpenTelemetry;
import io.quarkiverse.opentelemetry.exporter.azure.runtime.AzureEndpointSampler;
import io.quarkus.test.QuarkusUnitTest;

public class AzureExporterEnabledTest {

@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest()
.withEmptyApplication()
.overrideConfigKey("quarkus.otel.azure.enabled", "true")
.overrideConfigKey("applicationinsights.connection.string",
"InstrumentationKey=bla;IngestionEndpoint=http://127.0.0.1:53602/export");

@Inject
OpenTelemetry openTelemetry;

// just some class that will be available if the Azure exporter is enabled.
@Inject
Instance<AzureEndpointSampler> azureEndpointSamplers;

@Test
void testOpenTelemetryButNoBatchSpanProcessor() {
Assertions.assertNotNull(openTelemetry);
Assertions.assertTrue(azureEndpointSamplers.isResolvable());
Assertions.assertEquals(1, azureEndpointSamplers.stream().count());
Assertions.assertEquals(AzureEndpointSampler.class.getName(), azureEndpointSamplers.get().getClass().getName());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package io.quarkiverse.opentelemetry.exporter.azure.deployment;

import jakarta.enterprise.inject.Instance;
import jakarta.inject.Inject;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.opentelemetry.api.OpenTelemetry;
import io.quarkiverse.opentelemetry.exporter.azure.runtime.AzureEndpointSampler;
import io.quarkus.test.QuarkusUnitTest;

public class AzureExporterLegacyDisabledTest {

@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest()
.withEmptyApplication()
.overrideConfigKey("quarkus.opentelemetry.tracer.exporter.azure.enabled", "false")
.overrideConfigKey("applicationinsights.connection.string",
"InstrumentationKey=bla;IngestionEndpoint=http://127.0.0.1:53602/export");

@Inject
OpenTelemetry openTelemetry;

// just some class that will be available if the Azure exporter is enabled.
@Inject
Instance<AzureEndpointSampler> azureEndpointSamplers;

@Test
void testOpenTelemetryButNoBatchSpanProcessor() {
Assertions.assertNotNull(openTelemetry);
Assertions.assertFalse(azureEndpointSamplers.isResolvable());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.util.List;

import jakarta.inject.Singleton;

import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.trace.SpanKind;
import io.opentelemetry.context.Context;
Expand All @@ -14,6 +16,7 @@
* Sampler that drops spans based on the target of the request.
* Inspired by {@link io.quarkus.opentelemetry.runtime.tracing.DropTargetsSampler}
*/
@Singleton
public class AzureEndpointSampler implements Sampler {

private final List<String> dropTargets;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithDefault;

@ConfigMapping(prefix = "opentelemetry.tracer.exporter.azure")
@ConfigMapping(prefix = "quarkus.otel.azure")
@ConfigRoot(phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED)
public interface AzureExporterBuildConfig {
/**
* Azure Span Exporter support.
* <p>
* Azure Span Exporter support is enabled by default.
* The legacy quarkus.opentelemetry.tracer.exporter.azure.enabled property, maps to this property.
*/
@WithDefault("true")
@WithDefault("${quarkus.opentelemetry.tracer.exporter.azure.enabled:true}")
Boolean enabled();
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package io.quarkiverse.opentelemetry.exporter.azure.runtime;

import jakarta.inject.Singleton;

import com.azure.monitor.opentelemetry.exporter.AzureMonitorExporterBuilder;

import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdkBuilder;
import io.quarkus.opentelemetry.runtime.AutoConfiguredOpenTelemetrySdkBuilderCustomizer;

@Singleton
public class AzureMonitorCustomizer implements AutoConfiguredOpenTelemetrySdkBuilderCustomizer {

private final String azureConnectionString;
Expand Down

0 comments on commit 2203ca1

Please sign in to comment.