Skip to content

Commit 867dc70

Browse files
committed
add links
1 parent 5307e20 commit 867dc70

File tree

12 files changed

+123
-2
lines changed

12 files changed

+123
-2
lines changed

docs/instrumentation-list.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,6 +1651,7 @@ libraries:
16511651
- name: c3p0-0.9
16521652
description: The c3p0 instrumentation provides connection pool metrics for c3p0
16531653
data sources.
1654+
library_link: https://github.com/swaldman/c3p0
16541655
source_path: instrumentation/c3p0-0.9
16551656
scope:
16561657
name: io.opentelemetry.c3p0-0.9
@@ -2971,6 +2972,7 @@ libraries:
29712972
- name: google-http-client-1.19
29722973
description: This instrumentation enables HTTP CLIENT spans and metrics for Google
29732974
HTTP Client requests.
2975+
library_link: https://github.com/googleapis/google-http-java-client
29742976
source_path: instrumentation/google-http-client-1.19
29752977
scope:
29762978
name: io.opentelemetry.google-http-client-1.19
@@ -3059,6 +3061,7 @@ libraries:
30593061
graphql:
30603062
- name: graphql-java-12.0
30613063
description: This instrumentation enables spans for GraphQL Java operations.
3064+
library_link: https://www.graphql-java.com/
30623065
source_path: instrumentation/graphql-java/graphql-java-12.0
30633066
scope:
30643067
name: io.opentelemetry.graphql-java-12.0

instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/internal/InstrumentationMetaData.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ public class InstrumentationMetaData {
2525

2626
private String classification;
2727

28+
@JsonProperty("library_link")
29+
@Nullable
30+
private String libraryLink;
31+
2832
private List<ConfigurationOption> configurations = Collections.emptyList();
2933

3034
public InstrumentationMetaData() {
@@ -35,10 +39,12 @@ public InstrumentationMetaData(
3539
@Nullable String description,
3640
String classification,
3741
@Nullable Boolean disabledByDefault,
42+
@Nullable String libraryLink,
3843
@Nullable List<ConfigurationOption> configurations) {
3944
this.classification = classification;
4045
this.disabledByDefault = disabledByDefault;
4146
this.description = description;
47+
this.libraryLink = libraryLink;
4248
this.configurations = Objects.requireNonNullElse(configurations, Collections.emptyList());
4349
}
4450

@@ -77,4 +83,13 @@ public List<ConfigurationOption> getConfigurations() {
7783
public void setConfigurations(@Nullable List<ConfigurationOption> configurations) {
7884
this.configurations = Objects.requireNonNullElse(configurations, Collections.emptyList());
7985
}
86+
87+
@Nullable
88+
public String getLibraryLink() {
89+
return libraryLink;
90+
}
91+
92+
public void setLibraryLink(@Nullable String libraryLink) {
93+
this.libraryLink = libraryLink;
94+
}
8095
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ private static void addMetadataProperties(
198198
if (module.getMetadata().getDescription() != null) {
199199
moduleMap.put("description", module.getMetadata().getDescription());
200200
}
201+
if (module.getMetadata().getLibraryLink() != null) {
202+
moduleMap.put("library_link", module.getMetadata().getLibraryLink());
203+
}
201204
if (module.getMetadata().getDisabledByDefault()) {
202205
moduleMap.put("disabled_by_default", module.getMetadata().getDisabledByDefault());
203206
}

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

Lines changed: 94 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ void testPrintInstrumentationList() throws Exception {
4343
"Spring Web 6.0 instrumentation",
4444
InstrumentationClassification.LIBRARY.toString(),
4545
true,
46+
null,
4647
null);
4748

4849
modules.add(
@@ -114,6 +115,7 @@ void testGenerateInstrumentationYamlSeparatesClassifications() throws Exception
114115
"Spring Web 6.0 instrumentation",
115116
InstrumentationClassification.LIBRARY.toString(),
116117
false,
118+
null,
117119
List.of(
118120
new ConfigurationOption(
119121
"otel.instrumentation.spring-web-6.0.enabled",
@@ -134,7 +136,7 @@ void testGenerateInstrumentationYamlSeparatesClassifications() throws Exception
134136

135137
InstrumentationMetaData internalMetadata =
136138
new InstrumentationMetaData(
137-
null, InstrumentationClassification.INTERNAL.toString(), null, null);
139+
null, InstrumentationClassification.INTERNAL.toString(), null, null, null);
138140

139141
modules.add(
140142
new InstrumentationModule.Builder()
@@ -148,7 +150,7 @@ void testGenerateInstrumentationYamlSeparatesClassifications() throws Exception
148150

149151
InstrumentationMetaData customMetadata =
150152
new InstrumentationMetaData(
151-
null, InstrumentationClassification.CUSTOM.toString(), null, null);
153+
null, InstrumentationClassification.CUSTOM.toString(), null, null, null);
152154

153155
Map<InstrumentationType, Set<String>> externalAnnotationsVersions =
154156
Map.of(
@@ -214,6 +216,7 @@ void testMetadataParser() throws JsonProcessingException {
214216
description: test description
215217
classification: internal
216218
disabled_by_default: true
219+
library_link: https://example.com/test-library
217220
configurations:
218221
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
219222
description: Enables statement sanitization for database queries.
@@ -233,6 +236,7 @@ void testMetadataParser() throws JsonProcessingException {
233236
assertThat(metadata.getClassification()).isEqualTo(InstrumentationClassification.INTERNAL);
234237
assertThat(metadata.getDescription()).isEqualTo("test description");
235238
assertThat(metadata.getDisabledByDefault()).isEqualTo(true);
239+
assertThat(metadata.getLibraryLink()).isEqualTo("https://example.com/test-library");
236240
}
237241

238242
@Test
@@ -241,6 +245,18 @@ void testMetadataParserWithOnlyLibraryEntry() throws JsonProcessingException {
241245
InstrumentationMetaData metadata = YamlHelper.metaDataParser(input);
242246
assertThat(metadata.getClassification()).isEqualTo(InstrumentationClassification.INTERNAL);
243247
assertThat(metadata.getDescription()).isNull();
248+
assertThat(metadata.getLibraryLink()).isNull();
249+
assertThat(metadata.getDisabledByDefault()).isFalse();
250+
assertThat(metadata.getConfigurations()).isEmpty();
251+
}
252+
253+
@Test
254+
void testMetadataParserWithOnlyLibraryLink() throws JsonProcessingException {
255+
String input = "library_link: https://example.com/only-link";
256+
InstrumentationMetaData metadata = YamlHelper.metaDataParser(input);
257+
assertThat(metadata.getClassification()).isEqualTo(InstrumentationClassification.LIBRARY);
258+
assertThat(metadata.getDescription()).isNull();
259+
assertThat(metadata.getLibraryLink()).isEqualTo("https://example.com/only-link");
244260
assertThat(metadata.getDisabledByDefault()).isFalse();
245261
assertThat(metadata.getConfigurations()).isEmpty();
246262
}
@@ -485,4 +501,80 @@ void testTelemetryGroupsAreSorted() throws Exception {
485501

486502
assertThat(yaml1).isEqualTo(yaml2);
487503
}
504+
505+
@Test
506+
void testYamlGenerationWithLibraryLink() throws Exception {
507+
List<InstrumentationModule> modules = new ArrayList<>();
508+
Map<InstrumentationType, Set<String>> targetVersions = new HashMap<>();
509+
targetVersions.put(
510+
InstrumentationType.JAVAAGENT, new HashSet<>(List.of("com.example:test-library:[1.0.0,)")));
511+
512+
InstrumentationMetaData metadataWithLink =
513+
new InstrumentationMetaData(
514+
"Test library instrumentation with link",
515+
InstrumentationClassification.LIBRARY.toString(),
516+
false,
517+
"https://example.com/test-library-docs",
518+
emptyList());
519+
520+
modules.add(
521+
new InstrumentationModule.Builder()
522+
.srcPath("instrumentation/test-lib/test-lib-1.0")
523+
.instrumentationName("test-lib-1.0")
524+
.namespace("test-lib")
525+
.group("test-lib")
526+
.targetVersions(targetVersions)
527+
.metadata(metadataWithLink)
528+
.build());
529+
530+
InstrumentationMetaData metadataWithoutLink =
531+
new InstrumentationMetaData(
532+
"Test library instrumentation without link",
533+
InstrumentationClassification.LIBRARY.toString(),
534+
false,
535+
null,
536+
emptyList());
537+
538+
modules.add(
539+
new InstrumentationModule.Builder()
540+
.srcPath("instrumentation/other-lib/other-lib-1.0")
541+
.instrumentationName("other-lib-1.0")
542+
.namespace("other-lib")
543+
.group("other-lib")
544+
.targetVersions(targetVersions)
545+
.metadata(metadataWithoutLink)
546+
.build());
547+
548+
StringWriter stringWriter = new StringWriter();
549+
BufferedWriter writer = new BufferedWriter(stringWriter);
550+
551+
YamlHelper.generateInstrumentationYaml(modules, writer);
552+
writer.flush();
553+
554+
String expectedYaml =
555+
"""
556+
libraries:
557+
other-lib:
558+
- name: other-lib-1.0
559+
description: Test library instrumentation without link
560+
source_path: instrumentation/other-lib/other-lib-1.0
561+
scope:
562+
name: io.opentelemetry.other-lib-1.0
563+
target_versions:
564+
javaagent:
565+
- com.example:test-library:[1.0.0,)
566+
test-lib:
567+
- name: test-lib-1.0
568+
description: Test library instrumentation with link
569+
library_link: https://example.com/test-library-docs
570+
source_path: instrumentation/test-lib/test-lib-1.0
571+
scope:
572+
name: io.opentelemetry.test-lib-1.0
573+
target_versions:
574+
javaagent:
575+
- com.example:test-library:[1.0.0,)
576+
""";
577+
578+
assertThat(expectedYaml).isEqualTo(stringWriter.toString());
579+
}
488580
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
description: This instrumentation enables SERVER spans and metrics for the ActiveJ HTTP server.
2+
library_link: https://activej.io/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
description: This instrumentation provides context propagation for Akka actors, it does not emit any telemetry on its own.
2+
library_link: https://doc.akka.io/docs/akka/current/typed/index.html
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
description: This instrumentation provides context propagation for the Akka Fork-Join Pool, it does not emit any telemetry on its own.
2+
library_link: https://doc.akka.io/docs/akka/current/typed/index.html
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
description: This instrumentation enables CLIENT and SERVER spans and metrics for the Akka HTTP client and server.
2+
library_link: https://doc.akka.io/docs/akka-http/current/index.html
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
description: >
22
The Alibaba Druid instrumentation generates database connection pool metrics for druid data
33
sources.
4+
library_link: https://github.com/alibaba/druid
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
description: The c3p0 instrumentation provides connection pool metrics for c3p0 data sources.
2+
library_link: https://github.com/swaldman/c3p0

0 commit comments

Comments
 (0)