Skip to content

Commit 5dfc1b8

Browse files
authored
Add descriptions for modules related to custom instrumentation (open-telemetry#13704)
1 parent 7a974c9 commit 5dfc1b8

File tree

14 files changed

+134
-49
lines changed

14 files changed

+134
-49
lines changed

docs/instrumentation-list.yaml

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -638,11 +638,6 @@ libraries:
638638
target_versions:
639639
javaagent:
640640
- javax.ws.rs:javax.ws.rs-api:[,]
641-
- name: jaxrs-client-1.1
642-
source_path: instrumentation/jaxrs-client/jaxrs-client-1.1
643-
scope:
644-
name: io.opentelemetry.jaxrs-client-1.1
645-
target_versions: {}
646641
- name: jaxrs-3.0-resteasy-6.0
647642
source_path: instrumentation/jaxrs/jaxrs-3.0/jaxrs-3.0-resteasy-6.0
648643
minimum_java_version: 11
@@ -675,11 +670,6 @@ libraries:
675670
target_versions:
676671
javaagent:
677672
- javax.xml.ws:jaxws-api:[2.0,]
678-
- name: jaxws-2.0-metro-2.2
679-
source_path: instrumentation/jaxws/jaxws-2.0-metro-2.2
680-
scope:
681-
name: io.opentelemetry.jaxws-2.0-metro-2.2
682-
target_versions: {}
683673
- name: jaxws-cxf-3.0
684674
source_path: instrumentation/jaxws/jaxws-cxf-3.0
685675
scope:
@@ -694,11 +684,6 @@ libraries:
694684
target_versions:
695685
javaagent:
696686
- org.apache.axis2:axis2-jaxws:[1.6.0,)
697-
- name: jaxws-2.0-cxf-3.0
698-
source_path: instrumentation/jaxws/jaxws-2.0-cxf-3.0
699-
scope:
700-
name: io.opentelemetry.jaxws-2.0-cxf-3.0
701-
target_versions: {}
702687
- name: jaxws-metro-2.2
703688
source_path: instrumentation/jaxws/jaxws-metro-2.2
704689
scope:
@@ -979,12 +964,10 @@ libraries:
979964
source_path: instrumentation/liberty/liberty-dispatcher-20.0
980965
scope:
981966
name: io.opentelemetry.liberty-dispatcher-20.0
982-
target_versions: {}
983967
- name: liberty-20.0
984968
source_path: instrumentation/liberty/liberty-20.0
985969
scope:
986970
name: io.opentelemetry.liberty-20.0
987-
target_versions: {}
988971
log4j:
989972
- name: log4j-context-data-2.7
990973
source_path: instrumentation/log4j/log4j-context-data/log4j-context-data-2.7
@@ -1175,7 +1158,6 @@ libraries:
11751158
source_path: instrumentation/payara
11761159
scope:
11771160
name: io.opentelemetry.payara
1178-
target_versions: {}
11791161
pekko:
11801162
- name: pekko-actor-1.0
11811163
source_path: instrumentation/pekko/pekko-actor-1.0
@@ -1380,7 +1362,6 @@ libraries:
13801362
source_path: instrumentation/resources
13811363
scope:
13821364
name: io.opentelemetry.resources
1383-
target_versions: {}
13841365
restlet:
13851366
- name: restlet-1.1
13861367
source_path: instrumentation/restlet/restlet-1.1
@@ -1432,12 +1413,10 @@ libraries:
14321413
minimum_java_version: 17
14331414
scope:
14341415
name: io.opentelemetry.runtime-telemetry-java17
1435-
target_versions: {}
14361416
- name: runtime-telemetry-java8
14371417
source_path: instrumentation/runtime-telemetry/runtime-telemetry-java8
14381418
scope:
14391419
name: io.opentelemetry.runtime-telemetry-java8
1440-
target_versions: {}
14411420
rxjava:
14421421
- name: rxjava-1.0
14431422
source_path: instrumentation/rxjava/rxjava-1.0
@@ -1530,7 +1509,6 @@ libraries:
15301509
source_path: instrumentation/spring/spring-boot-resources
15311510
scope:
15321511
name: io.opentelemetry.spring-boot-resources
1533-
target_versions: {}
15341512
- name: spring-batch-3.0
15351513
disabled_by_default: true
15361514
source_path: instrumentation/spring/spring-batch-3.0
@@ -1635,7 +1613,6 @@ libraries:
16351613
source_path: instrumentation/spring/spring-webmvc/spring-webmvc-5.3
16361614
scope:
16371615
name: io.opentelemetry.spring-webmvc-5.3
1638-
target_versions: {}
16391616
- name: spring-core-2.0
16401617
source_path: instrumentation/spring/spring-core-2.0
16411618
minimum_java_version: 17
@@ -1893,6 +1870,10 @@ internal:
18931870
source_path: instrumentation/internal/internal-application-logger
18941871
scope:
18951872
name: io.opentelemetry.internal-application-logger
1873+
target_versions:
1874+
javaagent:
1875+
- org.springframework.boot:spring-boot:[1.2.0,)
1876+
- org.slf4j:slf4j-api:[1.4.0,)
18961877
- name: internal-class-loader
18971878
source_path: instrumentation/internal/internal-class-loader
18981879
scope:
@@ -1909,6 +1890,9 @@ internal:
19091890
source_path: instrumentation/opentelemetry-instrumentation-api
19101891
scope:
19111892
name: io.opentelemetry.opentelemetry-instrumentation-api
1893+
target_versions:
1894+
javaagent:
1895+
- io.opentelemetry.instrumentation:opentelemetry-instrumentation-api:[1.14.0-alpha,)
19121896
- name: opentelemetry-api-1.37
19131897
source_path: instrumentation/opentelemetry-api/opentelemetry-api-1.37
19141898
scope:
@@ -1949,6 +1933,15 @@ internal:
19491933
source_path: instrumentation/internal/internal-url-class-loader
19501934
scope:
19511935
name: io.opentelemetry.internal-url-class-loader
1936+
- name: opentelemetry-extension-kotlin-1.0
1937+
description: |
1938+
Our Kotlin coroutine instrumentation relies on a shaded copy of the opentelemetry-extension-kotlin library. This can cause conflicts when the application itself also uses opentelemetry-extension-kotlin, because the shaded and unshaded versions store the OpenTelemetry context under different keys. To resolve this issue, this instrumentation modifies the application's copy of opentelemetry-extension-kotlin so that it delegates to the shaded version bundled within the agent.
1939+
source_path: instrumentation/opentelemetry-extension-kotlin-1.0
1940+
scope:
1941+
name: io.opentelemetry.opentelemetry-extension-kotlin-1.0
1942+
target_versions:
1943+
javaagent:
1944+
- io.opentelemetry:opentelemetry-extension-kotlin:[0.17.0,)
19521945
- name: opentelemetry-api-1.4
19531946
source_path: instrumentation/opentelemetry-api/opentelemetry-api-1.4
19541947
scope:
@@ -1957,28 +1950,49 @@ internal:
19571950
source_path: instrumentation/opentelemetry-api/opentelemetry-api-1.0
19581951
scope:
19591952
name: io.opentelemetry.opentelemetry-api-1.0
1953+
target_versions:
1954+
javaagent:
1955+
- io.opentelemetry:opentelemetry-api:[0.17.0,)
19601956
custom:
19611957
- name: external-annotations
1958+
description: |
1959+
The external-annotations instrumentation acts as a "shim" that automatically instruments methods annotated with custom or third-party tracing annotations. This is particularly useful if you have existing annotations (such as a custom @Trace or third-party annotation) that you want to leverage with OpenTelemetry. At runtime, this module recognizes those annotations and applies the appropriate OpenTelemetry instrumentation logic, including span creation and context propagation. Covers many common vendor annotations by default, and additional annotations can be targeted using the configuration property "otel.instrumentation.external-annotations.include".
19621960
source_path: instrumentation/external-annotations
19631961
scope:
19641962
name: io.opentelemetry.external-annotations
1963+
target_versions:
1964+
javaagent:
1965+
- Java 8+
19651966
- name: opentelemetry-extension-annotations-1.0
1967+
description: |
1968+
Instruments methods annotated with OpenTelemetry extension annotations, such as @WithSpan and @SpanAttribute.
19661969
source_path: instrumentation/opentelemetry-extension-annotations-1.0
19671970
scope:
19681971
name: io.opentelemetry.opentelemetry-extension-annotations-1.0
1972+
target_versions:
1973+
javaagent:
1974+
- io.opentelemetry:opentelemetry-extension-annotations:[0.16.0,)
19691975
- name: opentelemetry-instrumentation-annotations-1.16
1976+
description: |
1977+
Instruments methods annotated with OpenTelemetry instrumentation annotations, such as @WithSpan and @SpanAttribute.
19701978
source_path: instrumentation/opentelemetry-instrumentation-annotations-1.16
19711979
scope:
19721980
name: io.opentelemetry.opentelemetry-instrumentation-annotations-1.16
1981+
target_versions:
1982+
javaagent:
1983+
- io.opentelemetry:opentelemetry-instrumentation-annotations:(,)
19731984
- name: jmx-metrics
1985+
description: |
1986+
Collects and reports metrics exposed through Java Management Extensions (JMX). It can be configured to extract JVM and application-level telemetry data from JMX MBeans such as memory usage, thread counts, and garbage collection statistics, and translate these measurements into OpenTelemetry metrics.
19741987
source_path: instrumentation/jmx-metrics
19751988
scope:
19761989
name: io.opentelemetry.jmx-metrics
19771990
- name: methods
1991+
description: |
1992+
Provides a flexible way to capture telemetry at the method level in JVM applications. By weaving instrumentation into targeted methods at runtime based on the "otel.instrumentation.methods.include" configuration property, it measures entry and exit points, execution duration and exception occurrences. The resulting data is automatically translated into OpenTelemetry traces.
19781993
source_path: instrumentation/methods
19791994
scope:
19801995
name: io.opentelemetry.methods
1981-
- name: opentelemetry-extension-kotlin-1.0
1982-
source_path: instrumentation/opentelemetry-extension-kotlin-1.0
1983-
scope:
1984-
name: io.opentelemetry.opentelemetry-extension-kotlin-1.0
1996+
target_versions:
1997+
javaagent:
1998+
- Java 8+

instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/utils/YamlHelper.java

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@
1414
import java.util.List;
1515
import java.util.Map;
1616
import java.util.TreeMap;
17+
import java.util.logging.Logger;
1718
import java.util.stream.Collectors;
1819
import org.yaml.snakeyaml.DumperOptions;
1920
import org.yaml.snakeyaml.TypeDescription;
2021
import org.yaml.snakeyaml.Yaml;
2122

2223
public class YamlHelper {
2324

25+
private static final Logger logger = Logger.getLogger(YamlHelper.class.getName());
26+
2427
private static final Yaml metaDataYaml = new Yaml();
2528

2629
static {
@@ -73,22 +76,7 @@ private static Map<String, Object> getLibraryInstrumentations(List<Instrumentati
7376
(group, modules) -> {
7477
List<Map<String, Object>> instrumentations = new ArrayList<>();
7578
for (InstrumentationModule module : modules) {
76-
Map<String, Object> moduleMap = baseProperties(module);
77-
78-
Map<String, Object> targetVersions = new TreeMap<>();
79-
if (module.getTargetVersions() != null && !module.getTargetVersions().isEmpty()) {
80-
module
81-
.getTargetVersions()
82-
.forEach(
83-
(type, versions) -> {
84-
if (!versions.isEmpty()) {
85-
targetVersions.put(type.toString(), new ArrayList<>(versions));
86-
}
87-
});
88-
}
89-
moduleMap.put("target_versions", targetVersions);
90-
91-
instrumentations.add(moduleMap);
79+
instrumentations.add(baseProperties(module));
9280
}
9381
output.put(group, instrumentations);
9482
});
@@ -143,6 +131,24 @@ private static Map<String, Object> baseProperties(InstrumentationModule module)
143131

144132
Map<String, Object> scopeMap = getScopeMap(module);
145133
moduleMap.put("scope", scopeMap);
134+
135+
Map<String, Object> targetVersions = new TreeMap<>();
136+
if (module.getTargetVersions() != null && !module.getTargetVersions().isEmpty()) {
137+
module
138+
.getTargetVersions()
139+
.forEach(
140+
(type, versions) -> {
141+
if (!versions.isEmpty()) {
142+
targetVersions.put(type.toString(), new ArrayList<>(versions));
143+
}
144+
});
145+
}
146+
if (targetVersions.isEmpty()) {
147+
logger.info("No Target versions found for " + module.getInstrumentationName());
148+
} else {
149+
moduleMap.put("target_versions", targetVersions);
150+
}
151+
146152
return moduleMap;
147153
}
148154

instrumentation-docs/src/test/java/io/opentelemetry/instrumentation/docs/utils/YamlHelperTest.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,8 @@ void testPrintInstrumentationList() throws Exception {
9797
@Test
9898
void testGenerateInstrumentationYamlSeparatesClassifications() throws Exception {
9999
List<InstrumentationModule> modules = new ArrayList<>();
100-
Map<InstrumentationType, Set<String>> springTargetVersions = new HashMap<>();
101-
springTargetVersions.put(
102-
InstrumentationType.JAVAAGENT,
103-
new HashSet<>(List.of("org.springframework:spring-web:[6.0.0,)")));
100+
Map<InstrumentationType, Set<String>> springTargetVersions =
101+
Map.of(InstrumentationType.JAVAAGENT, Set.of("org.springframework:spring-web:[6.0.0,)"));
104102

105103
InstrumentationMetaData springMetadata =
106104
new InstrumentationMetaData(
@@ -135,14 +133,19 @@ void testGenerateInstrumentationYamlSeparatesClassifications() throws Exception
135133
InstrumentationMetaData customMetadata =
136134
new InstrumentationMetaData(null, InstrumentationClassification.CUSTOM.toString(), null);
137135

136+
Map<InstrumentationType, Set<String>> externalAnnotationsVersions =
137+
Map.of(
138+
InstrumentationType.JAVAAGENT,
139+
Set.of("io.opentelemetry:opentelemetry-extension-annotations:[0.16.0,)"));
140+
138141
modules.add(
139142
new InstrumentationModule.Builder()
140143
.srcPath("instrumentation/opentelemetry-external-annotations-1.0")
141144
.instrumentationName("opentelemetry-external-annotations")
142145
.namespace("opentelemetry-external-annotations")
143146
.group("opentelemetry-external-annotations")
144147
.metadata(customMetadata)
145-
.targetVersions(new HashMap<>())
148+
.targetVersions(externalAnnotationsVersions)
146149
.build());
147150

148151
StringWriter stringWriter = new StringWriter();
@@ -174,6 +177,9 @@ void testGenerateInstrumentationYamlSeparatesClassifications() throws Exception
174177
source_path: instrumentation/opentelemetry-external-annotations-1.0
175178
scope:
176179
name: io.opentelemetry.opentelemetry-external-annotations
180+
target_versions:
181+
javaagent:
182+
- io.opentelemetry:opentelemetry-extension-annotations:[0.16.0,)
177183
""";
178184

179185
assertThat(expectedYaml).isEqualTo(stringWriter.toString());

instrumentation/external-annotations/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Settings for the external annotations instrumentation
22

3+
The external-annotations instrumentation acts as a "shim" that automatically instruments methods
4+
annotated with custom or third-party tracing annotations. This is particularly useful if you have
5+
existing annotations (such as a custom @Trace or third-party annotation) that you want to leverage
6+
with OpenTelemetry. At runtime, this module recognizes those annotations and applies the appropriate
7+
OpenTelemetry instrumentation logic, including span creation and context propagation. Covers many
8+
common vendor annotations by default, and additional annotations can be targeted using the
9+
configuration property "otel.instrumentation.external-annotations.include".
10+
311
| System property | Type | Default | Description |
412
| ----------------------------------------------------------- | ------ | ------------------- | --------------------------------------------------------------------------------------------------------- |
513
| `otel.instrumentation.external-annotations.include` | String | Default annotations | Configuration for trace annotations, in the form of a pattern that matches `'package.Annotation$Name;*'`. |
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
11
classification: custom
2+
description: >
3+
The external-annotations instrumentation acts as a "shim" that automatically instruments methods
4+
annotated with custom or third-party tracing annotations. This is particularly useful if you have
5+
existing annotations (such as a custom @Trace or third-party annotation) that you want to leverage
6+
with OpenTelemetry. At runtime, this module recognizes those annotations and applies the
7+
appropriate OpenTelemetry instrumentation logic, including span creation and context propagation.
8+
Covers many common vendor annotations by default, and additional annotations can be targeted using
9+
the configuration property "otel.instrumentation.external-annotations.include".
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
classification: custom
2+
description: >
3+
Collects and reports metrics exposed through Java Management Extensions (JMX). It can be
4+
configured to extract JVM and application-level telemetry data from JMX MBeans such as memory
5+
usage, thread counts, and garbage collection statistics, and translate these measurements into
6+
OpenTelemetry metrics.

instrumentation/methods/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Settings for the methods instrumentation
22

3+
Provides a flexible way to capture telemetry at the method level in JVM applications. By weaving
4+
instrumentation into targeted methods at runtime based on the "otel.instrumentation.methods.include"
5+
configuration property, it measures entry and exit points, execution duration and exception
6+
occurrences. The resulting data is automatically translated into OpenTelemetry traces.
7+
38
| System property | Type | Default | Description |
49
| -------------------------------------- | ------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
510
| `otel.instrumentation.methods.include` | String | None | List of methods to include for tracing. For more information, see [Creating spans around methods with `otel.instrumentation.methods.include`][cs]. |
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
classification: custom
2+
description: >
3+
Provides a flexible way to capture telemetry at the method level in JVM applications. By weaving
4+
instrumentation into targeted methods at runtime based on the
5+
"otel.instrumentation.methods.include" configuration property, it measures entry and exit points,
6+
execution duration and exception occurrences. The resulting data is automatically translated into
7+
OpenTelemetry traces.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Settings for the OpenTelemetry Extension Annotations integration
22

3+
Instruments methods annotated with OpenTelemetry extension annotations, such as @WithSpan and
4+
@SpanAttribute.
5+
36
| Environment variable | Type | Default | Description |
47
| ---------------------------------------------------------------- | ------ | ------- | --------------------------------------------------------------------------------- |
58
| `otel.instrumentation.opentelemetry-annotations.exclude-methods` | String | | All methods to be excluded from auto-instrumentation by annotation-based advices. |
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
classification: custom
2+
description: >
3+
Instruments methods annotated with OpenTelemetry extension annotations, such as @WithSpan
4+
and @SpanAttribute.

0 commit comments

Comments
 (0)