Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions docs/instrumentation-list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ libraries:
description: This instrumentation provides context propagation for Akka actors,
it does not emit any telemetry on its own.
source_path: instrumentation/akka/akka-actor-2.3
classification:
- propagator
scope:
name: io.opentelemetry.akka-actor-2.3
target_versions:
Expand All @@ -73,6 +75,8 @@ libraries:
description: This instrumentation provides context propagation for the Akka Fork-Join
Pool, it does not emit any telemetry on its own.
source_path: instrumentation/akka/akka-actor-fork-join-2.5
classification:
- propagator
scope:
name: io.opentelemetry.akka-actor-fork-join-2.5
target_versions:
Expand Down Expand Up @@ -668,6 +672,8 @@ libraries:
description: |
This instrumentation does not emit telemetry on its own. Instead, it augments existing SERVER spans and HTTP server metrics with the HTTP route and Shenyu specific attributes.
source_path: instrumentation/apache-shenyu-2.4
classification:
- enricher
scope:
name: io.opentelemetry.apache-shenyu-2.4
target_versions:
Expand Down Expand Up @@ -913,6 +919,8 @@ libraries:
description: |
This instrumentation does not emit telemetry on its own. Instead, it hooks into the Avaje Jex Context to extract the HTTP route and attach it to existing SERVER spans and HTTP server metrics.
source_path: instrumentation/avaje-jex-3.0
classification:
- enricher
minimum_java_version: 21
scope:
name: io.opentelemetry.avaje-jex-3.0
Expand Down Expand Up @@ -1580,6 +1588,8 @@ libraries:
description: This instrumentation enables context propagation for the Azure Core
library, it does not emit any telemetry on its own.
source_path: instrumentation/azure-core/azure-core-1.14
classification:
- propagator
scope:
name: io.opentelemetry.azure-core-1.14
target_versions:
Expand All @@ -1589,6 +1599,8 @@ libraries:
description: This instrumentation enables context propagation for the Azure Core
library, it does not emit any telemetry on its own.
source_path: instrumentation/azure-core/azure-core-1.19
classification:
- propagator
scope:
name: io.opentelemetry.azure-core-1.19
target_versions:
Expand All @@ -1598,6 +1610,8 @@ libraries:
description: This instrumentation enables context propagation for the Azure Core
library, it does not emit any telemetry on its own.
source_path: instrumentation/azure-core/azure-core-1.36
classification:
- propagator
scope:
name: io.opentelemetry.azure-core-1.36
target_versions:
Expand Down Expand Up @@ -2225,6 +2239,8 @@ libraries:
description: |
Couchbase instrumentation is owned by the Couchbase project for versions 3+. This instrumentation automatically configures the instrumentation provided by the Couchbase library.
source_path: instrumentation/couchbase/couchbase-3.1
classification:
- configuration
scope:
name: io.opentelemetry.couchbase-3.1
target_versions:
Expand All @@ -2234,6 +2250,8 @@ libraries:
description: |
Couchbase instrumentation is owned by the Couchbase project for versions 3+. This instrumentation automatically configures the instrumentation provided by the Couchbase library.
source_path: instrumentation/couchbase/couchbase-3.1.6
classification:
- configuration
scope:
name: io.opentelemetry.couchbase-3.1.6
target_versions:
Expand All @@ -2243,6 +2261,8 @@ libraries:
description: |
Couchbase instrumentation is owned by the Couchbase project for versions 3+. This instrumentation automatically configures the instrumentation provided by the Couchbase library.
source_path: instrumentation/couchbase/couchbase-3.2
classification:
- configuration
scope:
name: io.opentelemetry.couchbase-3.2
target_versions:
Expand Down Expand Up @@ -2825,6 +2845,8 @@ libraries:
description: |
The executor instrumentation ensures that context is automatically propagated when using common Java executors (e.g., ThreadPoolExecutor, ScheduledThreadPoolExecutor, ForkJoinPool). When a task is submitted, the current context is captured and bound to the task. Then, when the task eventually runs, even if it’s on a different thread, the instrumentation reactivates that context, enabling consistent correlation across concurrent and asynchronous workflows.
source_path: instrumentation/executors
classification:
- propagator
scope:
name: io.opentelemetry.executors
target_versions:
Expand Down Expand Up @@ -5228,6 +5250,8 @@ libraries:
description: |
This instrumentation does not emit telemetry on its own. Instead, it extracts the HTTP route and attaches it to SERVER spans and HTTP server metrics.
source_path: instrumentation/spark-2.3
classification:
- enricher
scope:
name: io.opentelemetry.spark-2.3
target_versions:
Expand Down Expand Up @@ -5656,6 +5680,8 @@ libraries:
This instrumentation does not emit any telemetry on its own. Instead, it captures enduser attributes, and is only enabled when at least one of the `enduser` configurations is enabled.
NOTE: The `enduser` attributes have been deprecated and will be removed in 3.0+ of the java agent.
source_path: instrumentation/spring/spring-security-config-6.0
classification:
- enricher
minimum_java_version: 17
scope:
name: io.opentelemetry.spring-security-config-6.0
Expand Down
13 changes: 9 additions & 4 deletions instrumentation-docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,12 @@ public class SpringWebInstrumentationModule extends InstrumentationModule
## Instrumentation metadata

* classification
* `library` - Instrumentation that targets a library
* `internal` - Instrumentation that is used internally by the OpenTelemetry Java Agent
* `custom` - Utilities that are used to create custom instrumentation
* `library` - Instrumentation that targets a library.
* `internal` - Instrumentation that is used internally by the OpenTelemetry Java Agent.
* `custom` - Utilities that are used by end users to create custom instrumentation.
* `enricher` - Instrumentation that enriches the telemetry produced by other instrumentations but does not generate or emit telemetry on its own.
* `propagator` - Instrumentation that acts as a bridge for context propagation but does not generate or emit telemetry on its own.
* `configuration` - Instrumentation that configures or sets up native library instrumentation.
* name
* Identifier for instrumentation module, used to enable/disable
* Configured in `InstrumentationModule` code for each module
Expand Down Expand Up @@ -147,7 +150,9 @@ As of now, the following fields are supported, all of which are optional:
```yaml
description: "Instruments..." # Description of the instrumentation module
disabled_by_default: true # Defaults to `false`
classification: internal # instrumentation classification: library | internal | custom
classification:
- library
- enricher
configurations:
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
description: Enables statement sanitization for database queries.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,14 @@ private static void printStats(List<InstrumentationModule> modules) {
}

private static String getClassificationStats(List<InstrumentationModule> modules) {
// Flatten all classifications and count each individually
return modules.stream()
.collect(
Collectors.groupingBy(
m -> m.getMetadata().getClassification(), TreeMap::new, Collectors.toList()))
.flatMap(m -> m.getMetadata().getClassifications().stream())
.map(c -> c.name().toLowerCase(Locale.ROOT))
.collect(Collectors.groupingBy(c -> c, TreeMap::new, Collectors.counting()))
.entrySet()
.stream()
.map(
entry ->
String.format(
Locale.getDefault(FORMAT), "\t%s: %d", entry.getKey(), entry.getValue().size()))
.map(entry -> String.format(Locale.ROOT, "\t%s: %d", entry.getKey(), entry.getValue()))
.collect(Collectors.joining("\n"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import com.fasterxml.jackson.databind.exc.ValueInstantiationException;
import io.opentelemetry.instrumentation.docs.internal.InstrumentationMetaData;
import io.opentelemetry.instrumentation.docs.internal.InstrumentationMetadata;
import io.opentelemetry.instrumentation.docs.internal.InstrumentationModule;
import io.opentelemetry.instrumentation.docs.internal.InstrumentationType;
import io.opentelemetry.instrumentation.docs.parsers.GradleParser;
Expand Down Expand Up @@ -58,9 +58,9 @@ public List<InstrumentationModule> analyze() throws IOException {
}

private void enrichModule(InstrumentationModule module) throws IOException {
InstrumentationMetaData metaData = getMetadata(module);
if (metaData != null) {
module.setMetadata(metaData);
InstrumentationMetadata metadata = getMetadata(module);
if (metadata != null) {
module.setMetadata(metadata);
}

module.setTargetVersions(getVersionInformation(module));
Expand All @@ -69,14 +69,14 @@ private void enrichModule(InstrumentationModule module) throws IOException {
}

@Nullable
private InstrumentationMetaData getMetadata(InstrumentationModule module)
private InstrumentationMetadata getMetadata(InstrumentationModule module)
throws JsonProcessingException {
String metadataFile = fileManager.getMetaDataFile(module.getSrcPath());
String metadataFile = fileManager.getMetadataFile(module.getSrcPath());
if (metadataFile == null) {
return null;
}
try {
return YamlHelper.metaDataParser(metadataFile);
return YamlHelper.metadataParser(metadataFile);
} catch (ValueInstantiationException | MismatchedInputException e) {
logger.severe("Error parsing metadata file for " + module.getInstrumentationName());
throw e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
public enum InstrumentationClassification {
LIBRARY,
CUSTOM,
INTERNAL;
INTERNAL,
ENRICHER,
CONFIGURATION,
PROPAGATOR;

@Nullable
public static InstrumentationClassification fromString(@Nullable String type) {
Expand All @@ -26,6 +29,9 @@ public static InstrumentationClassification fromString(@Nullable String type) {
case "library" -> LIBRARY;
case "internal" -> INTERNAL;
case "custom" -> CUSTOM;
case "enricher" -> ENRICHER;
case "configuration" -> CONFIGURATION;
case "propagator" -> PROPAGATOR;
default -> null;
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,53 +5,66 @@

package io.opentelemetry.instrumentation.docs.internal;

import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/**
* Represents the data in a metadata.yaml file. This class is internal and is hence not for public
* use. Its APIs are unstable and can change at any time.
*/
public class InstrumentationMetaData {
public class InstrumentationMetadata {
@Nullable private String description;

@JsonProperty("disabled_by_default")
@Nullable
private Boolean disabledByDefault;

private String classification;
private List<String> classifications;

private List<ConfigurationOption> configurations = Collections.emptyList();
private List<ConfigurationOption> configurations = emptyList();

public InstrumentationMetaData() {
this.classification = InstrumentationClassification.LIBRARY.toString();
public InstrumentationMetadata() {
this.classifications = singletonList(InstrumentationClassification.LIBRARY.name());
}

public InstrumentationMetaData(
public InstrumentationMetadata(
@Nullable String description,
String classification,
List<String> classifications,
@Nullable Boolean disabledByDefault,
@Nullable List<ConfigurationOption> configurations) {
this.classification = classification;
this.classifications =
Objects.requireNonNullElse(
classifications, singletonList(InstrumentationClassification.LIBRARY.name()));
this.disabledByDefault = disabledByDefault;
this.description = description;
this.configurations = Objects.requireNonNullElse(configurations, Collections.emptyList());
this.configurations = Objects.requireNonNullElse(configurations, emptyList());
}

@Nullable
public String getDescription() {
return description;
}

@Nonnull
public InstrumentationClassification getClassification() {
return Objects.requireNonNullElse(
InstrumentationClassification.fromString(classification),
InstrumentationClassification.LIBRARY);
public List<InstrumentationClassification> getClassifications() {
if (classifications == null || classifications.isEmpty()) {
return singletonList(InstrumentationClassification.LIBRARY);
}
return classifications.stream()
.map(
classification -> {
InstrumentationClassification result =
InstrumentationClassification.fromString(classification);
if (result == null) {
throw new IllegalArgumentException("Invalid classification: " + classification);
}
return result;
})
.toList();
}

public Boolean getDisabledByDefault() {
Expand All @@ -62,8 +75,11 @@ public void setDescription(@Nullable String description) {
this.description = description;
}

public void setClassification(String classification) {
this.classification = classification;
public void setClassifications(@Nullable List<String> classifications) {
this.classifications =
(classifications == null || classifications.isEmpty())
? singletonList(InstrumentationClassification.LIBRARY.name())
: classifications;
}

public void setDisabledByDefault(@Nullable Boolean disabledByDefault) {
Expand All @@ -75,6 +91,6 @@ public List<ConfigurationOption> getConfigurations() {
}

public void setConfigurations(@Nullable List<ConfigurationOption> configurations) {
this.configurations = Objects.requireNonNullElse(configurations, Collections.emptyList());
this.configurations = Objects.requireNonNullElse(configurations, emptyList());
}
}
Loading