Skip to content
Merged
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
4 changes: 4 additions & 0 deletions docs/instrumentation-list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
libraries:
activej:
- name: activej-http-6.0
display_name: ActiveJ
description: This instrumentation enables HTTP server spans and HTTP server metrics
for the ActiveJ HTTP server.
library_link: https://activej.io/
Expand Down Expand Up @@ -60,6 +61,7 @@ libraries:
type: STRING
akka:
- name: akka-actor-2.3
display_name: Akka Actors
description: This instrumentation provides context propagation for Akka actors,
it does not emit any telemetry on its own.
library_link: https://doc.akka.io/libraries/akka-core/current/typed/index.html
Expand All @@ -72,6 +74,7 @@ libraries:
- com.typesafe.akka:akka-actor_2.12:[2.3,)
- com.typesafe.akka:akka-actor_2.13:[2.3,)
- name: akka-actor-fork-join-2.5
display_name: Akka Actors
description: This instrumentation provides context propagation for the Akka Fork-Join
Pool, it does not emit any telemetry on its own.
library_link: https://doc.akka.io/libraries/akka-core/current/typed/index.html
Expand All @@ -84,6 +87,7 @@ libraries:
- com.typesafe.akka:akka-actor_2.13:[2.5.23,2.6)
- com.typesafe.akka:akka-actor_2.11:[2.5,)
- name: akka-http-10.0
display_name: Akka HTTP
description: |
This instrumentation enables HTTP client spans and metrics for the Akka HTTP client, and HTTP server spans and metrics for the Akka HTTP server.
library_link: https://doc.akka.io/docs/akka-http/current/index.html
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,7 +58,7 @@ public List<InstrumentationModule> analyze() throws IOException {
}

private void enrichModule(InstrumentationModule module) throws IOException {
InstrumentationMetaData metaData = getMetadata(module);
InstrumentationMetadata metaData = getMetadata(module);
if (metaData != null) {
module.setMetadata(metaData);
}
Expand All @@ -69,7 +69,7 @@ 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());
if (metadataFile == null) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.docs.internal;

import static java.util.Collections.emptyList;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
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 {
@Nullable private String description;

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

private String classification;

@JsonProperty("library_link")
@Nullable
private String libraryLink;

@JsonProperty("display_name")
@Nullable
private String displayName;

private List<ConfigurationOption> configurations = emptyList();

public InstrumentationMetadata() {
this.classification = InstrumentationClassification.LIBRARY.name();
}

public InstrumentationMetadata(
@Nullable String description,
@Nullable Boolean disabledByDefault,
String classification,
@Nullable String libraryLink,
@Nullable String displayName,
@Nullable List<ConfigurationOption> configurations) {
this.classification = classification;
this.disabledByDefault = disabledByDefault;
this.description = description;
this.libraryLink = libraryLink;
this.displayName = displayName;
this.configurations = Objects.requireNonNullElse(configurations, emptyList());
}

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

public void setDisplayName(@Nullable String displayName) {
this.displayName = displayName;
}

@Nullable
public String getDisplayName() {
return displayName;
}

@Nonnull
public InstrumentationClassification getClassification() {
return Objects.requireNonNullElse(
InstrumentationClassification.fromString(classification),
InstrumentationClassification.LIBRARY);
}

public Boolean getDisabledByDefault() {
return Objects.requireNonNullElse(disabledByDefault, false);
}

public void setDescription(@Nullable String description) {
this.description = description;
}

public void setClassification(String classification) {
this.classification = classification;
}

public void setDisabledByDefault(@Nullable Boolean disabledByDefault) {
this.disabledByDefault = disabledByDefault;
}

public List<ConfigurationOption> getConfigurations() {
return configurations;
}

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

@Nullable
public String getLibraryLink() {
return libraryLink;
}

public void setLibraryLink(@Nullable String libraryLink) {
this.libraryLink = libraryLink;
}

/**
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
* any time.
*/
public static class Builder {

@Nullable private String description;
@Nullable private Boolean disabledByDefault;
@Nullable private String classification;
@Nullable private String libraryLink;
@Nullable private String displayName;
private List<ConfigurationOption> configurations = emptyList();

@CanIgnoreReturnValue
public Builder description(@Nullable String description) {
this.description = description;
return this;
}

@CanIgnoreReturnValue
public Builder disabledByDefault(@Nullable Boolean disabledByDefault) {
this.disabledByDefault = disabledByDefault;
return this;
}

@CanIgnoreReturnValue
public Builder classification(@Nullable String classification) {
this.classification = classification;
return this;
}

@CanIgnoreReturnValue
public Builder libraryLink(@Nullable String libraryLink) {
this.libraryLink = libraryLink;
return this;
}

@CanIgnoreReturnValue
public Builder displayName(@Nullable String displayName) {
this.displayName = displayName;
return this;
}

@CanIgnoreReturnValue
public Builder configurations(@Nullable List<ConfigurationOption> configurations) {
this.configurations = Objects.requireNonNullElse(configurations, emptyList());
return this;
}

public InstrumentationMetadata build() {
return new InstrumentationMetadata(
description,
disabledByDefault,
classification != null ? classification : InstrumentationClassification.LIBRARY.name(),
libraryLink,
displayName,
configurations);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class InstrumentationModule {

@Nullable private Integer minJavaVersion;

@Nullable private InstrumentationMetaData metadata;
@Nullable private InstrumentationMetadata metadata;

/**
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
Expand Down Expand Up @@ -79,9 +79,9 @@ public InstrumentationScopeInfo getScopeInfo() {
return scopeInfo;
}

public InstrumentationMetaData getMetadata() {
public InstrumentationMetadata getMetadata() {
if (metadata == null) {
metadata = new InstrumentationMetaData();
metadata = new InstrumentationMetadata();
}

return metadata;
Expand Down Expand Up @@ -109,7 +109,7 @@ public void setTargetVersions(Map<InstrumentationType, Set<String>> targetVersio
this.targetVersions = targetVersions;
}

public void setMetadata(InstrumentationMetaData metadata) {
public void setMetadata(InstrumentationMetadata metadata) {
this.metadata = metadata;
}

Expand All @@ -135,7 +135,7 @@ public static class Builder {
@Nullable private String namespace;
@Nullable private String group;
@Nullable private Integer minJavaVersion;
@Nullable private InstrumentationMetaData metadata;
@Nullable private InstrumentationMetadata metadata;
@Nullable private Map<InstrumentationType, Set<String>> targetVersions;
@Nullable private Map<String, List<EmittedMetrics.Metric>> metrics;
@Nullable private Map<String, List<EmittedSpans.Span>> spans;
Expand Down Expand Up @@ -171,7 +171,7 @@ public Builder group(String group) {
}

@CanIgnoreReturnValue
public Builder metadata(InstrumentationMetaData metadata) {
public Builder metadata(InstrumentationMetadata metadata) {
this.metadata = metadata;
return this;
}
Expand Down
Loading