Skip to content

Commit

Permalink
Merge branch 'master' of github.com:open-telemetry/opentelemetry-java…
Browse files Browse the repository at this point in the history
… into tracer-sdk-builder-addspanprocessor
  • Loading branch information
Anuraag Agrawal committed Dec 15, 2020
2 parents f4dab61 + 3701a8b commit 108b948
Show file tree
Hide file tree
Showing 240 changed files with 5,083 additions and 5,328 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/master-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ jobs:
name: Setup Java 8
uses: actions/setup-java@v1
with:
java-version: 8.0.275
java-version: 8
java-package: jre
- id: setup-java-11
name: Setup Java 11
uses: actions/setup-java@v1
with:
java-version: 11
- uses: burrunan/gradle-cache-action@v1.5
- uses: burrunan/gradle-cache-action@v1.6
with:
remote-build-cache-proxy-enabled: false
arguments: build --stacktrace ${{ matrix.coverage && ':opentelemetry-all:jacocoTestReport' || '' }}
Expand All @@ -55,7 +56,7 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 11
- uses: burrunan/gradle-cache-action@v1.5
- uses: burrunan/gradle-cache-action@v1.6
with:
remote-build-cache-proxy-enabled: false
arguments: artifactoryPublish
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/patch-release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ jobs:
# Trim whitespaces and cherrypick
echo $word | sed 's/ *$//g' | sed 's/^ *//g' | git cherry-pick --stdin
done
- uses: burrunan/gradle-cache-action@v1.5
- uses: burrunan/gradle-cache-action@v1.6
with:
job-id: jdk11
remote-build-cache-proxy-enabled: false
arguments: build --stacktrace -Prelease.version=${{ github.event.inputs.version }}
- name: Publish artifacts
uses: burrunan/gradle-cache-action@v1.5
uses: burrunan/gradle-cache-action@v1.6
with:
job-id: jdk11
remote-build-cache-proxy-enabled: false
Expand All @@ -85,7 +85,7 @@ jobs:
- run: git push
- name: Checkout master
uses: actions/checkout@v2
- uses: burrunan/gradle-cache-action@v1.5
- uses: burrunan/gradle-cache-action@v1.6
with:
job-id: jdk11
remote-build-cache-proxy-enabled: false
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ jobs:
name: Setup Java 8
uses: actions/setup-java@v1
with:
java-version: 8.0.275
java-version: 8
java-package: jre
- id: setup-java-11
name: Setup Java 11
uses: actions/setup-java@v1
with:
java-version: 11
- uses: burrunan/gradle-cache-action@v1.5
- uses: burrunan/gradle-cache-action@v1.6
with:
remote-build-cache-proxy-enabled: false
arguments: build --stacktrace ${{ matrix.coverage && ':opentelemetry-all:jacocoTestReport' || '' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-examples-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 11
- uses: burrunan/gradle-cache-action@v1.5
- uses: burrunan/gradle-cache-action@v1.6
with:
remote-build-cache-proxy-enabled: false
arguments: clean check fatJar
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/setup-java@v1
with:
java-version: 11
- uses: burrunan/gradle-cache-action@v1.5
- uses: burrunan/gradle-cache-action@v1.6
with:
job-id: jdk11
remote-build-cache-proxy-enabled: false
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ enabling it in high-throughput environments that do not need this strict verific
- The API has been broken into separate modules, in preparation for the 1.0 release of the tracing API.
If you depend on the `opentelemetry-api` module, you should get the rest of the API modules as transitive dependencies.

### SDK

#### Miscellaneous

- The `SpanData.Link.getContext()` method has been deprecated in favor of a new `SpanData.Link.getSpanContext()`.
The deprecated method will be removed in the next release of the SDK.

### Extensions

#### Breaking Changes

- The deprecated `opentelemetry-extension-runtime-metrics` module has been removed. The functionality is available in the
opentelemetry-java-instrumentation project under a different module name.
- The deprecated `trace-utils` module has been removed.

-----

## Version 0.12.0 - 2020-12-04
Expand Down
4 changes: 2 additions & 2 deletions QUICKSTART.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,12 +383,12 @@ tracerSdkManagement.addSpanProcessor(MultiSpanProcessor.create(Arrays.asList(
### Exporter

Span processors are initialized with an exporter which is responsible for sending the telemetry data
a particular backend. OpenTelemetry offers four exporters out of the box:
a particular backend. OpenTelemetry offers five exporters out of the box:
- In-Memory Exporter: keeps the data in memory, useful for debugging.
- Jaeger Exporter: prepares and sends the collected telemetry data to a Jaeger backend via gRPC.
- Zipkin Exporter: prepares and sends the collected telemetry data to a Zipkin backend via the Zipkin APIs.
- Logging Exporter: saves the telemetry data into log streams.
- OpenTelemetry Exporter: sends the data to the [OpenTelemetry Collector] (not yet implemented).
- OpenTelemetry Exporter: sends the data to the [OpenTelemetry Collector].

Other exporters can be found in the [OpenTelemetry Registry].

Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ project.
This project contains the following top level components:

* [OpenTelemetry API](api/):
* [tracing api](api/src/main/java/io/opentelemetry/api/trace/) includes `Tracer`, `Span` and `SpanContext`.
* [baggage api](/api/src/main/java/io/opentelemetry/api/baggage) defines a collection of entries in the form of key-value pairs of data that can be propagated to provide contextual information.
* [metrics api](api/src/main/java/io/opentelemetry/api/metrics/).
* [tracing api](api/trace/src/main/java/io/opentelemetry/api/trace/) includes `Tracer`, `Span` and `SpanContext`.
* [baggage api](api/baggage/src/main/java/io/opentelemetry/api/baggage/) defines a collection of entries in the form of key-value pairs of data that can be propagated to provide contextual information.
* [metrics api](api/metrics/src/main/java/io/opentelemetry/api/metrics/).
* [context api](api/context/src/main/java/io/opentelemetry/context/).
* [extensions](extensions/) define additional API extensions, which are not part of the core API.
* [sdk](sdk/) define the reference implementation complying to the OpenTelemetry API.
* [sdk-extensions](sdk-extensions/) define additional SDK extensions, which are not part of the core SDK.
Expand Down
112 changes: 56 additions & 56 deletions all/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,69 +5,69 @@ plugins {
description = "OpenTelemetry All"
ext.moduleName = "io.opentelemetry.all"

def subprojects = [
project(':opentelemetry-api'),
project(':opentelemetry-context'),
project(':opentelemetry-extension-runtime-metrics'),
project(':opentelemetry-extension-trace-propagators'),
project(':opentelemetry-extension-trace-utils'),
project(':opentelemetry-extension-annotations'),
project(':opentelemetry-exporter-jaeger'),
project(':opentelemetry-exporter-logging'),
project(':opentelemetry-exporter-otlp'),
project(':opentelemetry-exporter-prometheus'),
project(':opentelemetry-exporter-zipkin'),
project(':opentelemetry-opencensus-shim'),
project(':opentelemetry-opentracing-shim'),
project(':opentelemetry-sdk-common'),
project(':opentelemetry-sdk-metrics'),
project(':opentelemetry-sdk-testing'),
project(':opentelemetry-sdk-trace'),
project(':opentelemetry-sdk'),
project(':opentelemetry-sdk-extension-async-processor'),
project(':opentelemetry-sdk-extension-aws'),
project(':opentelemetry-sdk-extension-jaeger-remote-sampler'),
project(':opentelemetry-sdk-extension-logging'),
project(':opentelemetry-sdk-extension-otproto'),
project(':opentelemetry-sdk-extension-resources'),
project(':opentelemetry-sdk-extension-tracing-incubator'),
project(':opentelemetry-sdk-extension-zpages'),
]

for (subproject in rootProject.subprojects) {
if (subproject == project) {
continue
dependencies {
rootProject.subprojects.each { subproject ->
// Generate aggregate coverage report for published modules that enable jacoco.
subproject.plugins.withId("jacoco") {
subproject.plugins.withId("maven-publish") {
implementation(subproject) {
transitive = false
}
}
}
}
evaluationDependsOn(subproject.path)
testCompile libraries.archunit
}

dependencies {
compile subprojects
testCompile libraries.archunit
// https://docs.gradle.org/current/samples/sample_jvm_multi_project_with_code_coverage.html

def sourcesPath = configurations.create("sourcesPath") {
visible = false
canBeResolved = true
canBeConsumed = false
extendsFrom(configurations.implementation)
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME))
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.DOCUMENTATION))
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named(DocsType, 'source-folders'))
}
}

task jacocoMerge(type: JacocoMerge) {
dependsOn(subprojects.jacocoTestReport.dependsOn)
mustRunAfter(subprojects.jacocoTestReport.mustRunAfter)
destinationFile = file("${buildDir}/jacoco/test.exec")
executionData = files(subprojects.jacocoTestReport.executionData)
.filter { f -> f.exists() }
def coverageDataPath = configurations.create("coverageDataPath") {
visible = false
canBeResolved = true
canBeConsumed = false
extendsFrom(configurations.implementation)
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME))
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.DOCUMENTATION))
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named(DocsType, 'jacoco-coverage-data'))
}
}

jacocoTestReport {
dependsOn(jacocoMerge)
reports {
xml.enabled = true
html.enabled = true
tasks.named('jacocoTestReport', JacocoReport) {
enabled = true

configurations.runtimeClasspath.each {
additionalClassDirs(zipTree(it).filter {
// Exclude mrjar (jacoco complains), shaded, and generated code
!it.absolutePath.contains("META-INF/versions/") &&
!it.absolutePath.contains("/internal/shaded/") &&
!it.absolutePath.contains("io/opentelemetry/proto/") &&
!it.absolutePath.contains("io/opentelemetry/exporter/jaeger/proto/") &&
!it.absolutePath.contains("io/opentelemetry/sdk/extension/trace/jaeger/proto/")
})
}
additionalSourceDirs(sourcesPath.incoming.artifactView { lenient(true) }.files)
executionData(coverageDataPath.incoming.artifactView { lenient(true) }.files.filter { it.exists() })

additionalSourceDirs.from = files(subprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories.from = files(subprojects.sourceSets.main.allSource.srcDirs)
classDirectories.from = files(subprojects.sourceSets.main.output)
classDirectories.from = files(classDirectories.files.collect {
fileTree(dir: it, excludes: [
// Ignore generated code
"io/opentelemetry/exporters/jaeger/proto/**"
])
})
reports {
// xml is usually used to integrate code coverage with
// other tools like SonarQube, Coveralls or Codecov
xml.enabled true

// HTML reports can be used to see code coverage
// without any external tools
html.enabled true
}
}
1 change: 0 additions & 1 deletion api/all/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ dependencies {
api project(':opentelemetry-context'),
project(':opentelemetry-api-baggage'),
project(':opentelemetry-api-common'),
project(':opentelemetry-api-internal'),
project(':opentelemetry-api-metrics'),
project(':opentelemetry-api-trace')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@

package io.opentelemetry.api;

import static java.util.Objects.requireNonNull;

import io.opentelemetry.api.metrics.MeterProvider;
import io.opentelemetry.api.trace.TracerProvider;
import io.opentelemetry.context.propagation.ContextPropagators;
import io.opentelemetry.spi.OpenTelemetryFactory;
import io.opentelemetry.spi.metrics.MeterProviderFactory;
import io.opentelemetry.spi.trace.TracerProviderFactory;
import java.util.ServiceLoader;
import javax.annotation.Nullable;
import javax.annotation.concurrent.ThreadSafe;
Expand All @@ -24,6 +20,11 @@
@ThreadSafe
public class DefaultOpenTelemetry implements OpenTelemetry {
private static final Object mutex = new Object();
@Nullable private static volatile OpenTelemetry globalOpenTelemetry;

private final TracerProvider tracerProvider;
private final MeterProvider meterProvider;
private volatile ContextPropagators propagators;

static OpenTelemetry getGlobalOpenTelemetry() {
if (globalOpenTelemetry == null) {
Expand All @@ -45,17 +46,15 @@ static void setGlobalOpenTelemetry(OpenTelemetry openTelemetry) {
globalOpenTelemetry = openTelemetry;
}

static Builder builder() {
return new Builder();
/**
* Returns a builder for the {@link DefaultOpenTelemetry}.
*
* @return a builder for the {@link DefaultOpenTelemetry}.
*/
public static DefaultOpenTelemetryBuilder builder() {
return new DefaultOpenTelemetryBuilder();
}

@Nullable private static volatile OpenTelemetry globalOpenTelemetry;

private final TracerProvider tracerProvider;
private final MeterProvider meterProvider;

private volatile ContextPropagators propagators;

@Override
public void setPropagators(ContextPropagators propagators) {
this.propagators = propagators;
Expand Down Expand Up @@ -93,7 +92,7 @@ protected DefaultOpenTelemetry(
* @throws IllegalStateException if a specified provider is not found
*/
@Nullable
private static <T> T loadSpi(Class<T> providerClass) {
static <T> T loadSpi(Class<T> providerClass) {
String specifiedProvider = System.getProperty(providerClass.getName());
ServiceLoader<T> providers = ServiceLoader.load(providerClass);
for (T provider : providers) {
Expand All @@ -112,57 +111,4 @@ private static <T> T loadSpi(Class<T> providerClass) {
static void reset() {
globalOpenTelemetry = null;
}

protected static class Builder implements OpenTelemetryBuilder<Builder> {
protected ContextPropagators propagators = ContextPropagators.noop();

protected TracerProvider tracerProvider;
protected MeterProvider meterProvider;

@Override
public Builder setTracerProvider(TracerProvider tracerProvider) {
requireNonNull(tracerProvider, "tracerProvider");
this.tracerProvider = tracerProvider;
return this;
}

@Override
public Builder setMeterProvider(MeterProvider meterProvider) {
requireNonNull(meterProvider, "meterProvider");
this.meterProvider = meterProvider;
return this;
}

@Override
public Builder setPropagators(ContextPropagators propagators) {
requireNonNull(propagators, "propagators");
this.propagators = propagators;
return this;
}

@Override
public OpenTelemetry build() {
MeterProvider meterProvider = this.meterProvider;
if (meterProvider == null) {
MeterProviderFactory meterProviderFactory = loadSpi(MeterProviderFactory.class);
if (meterProviderFactory != null) {
meterProvider = meterProviderFactory.create();
} else {
meterProvider = MeterProvider.getDefault();
}
}

TracerProvider tracerProvider = this.tracerProvider;
if (tracerProvider == null) {
TracerProviderFactory tracerProviderFactory = loadSpi(TracerProviderFactory.class);
if (tracerProviderFactory != null) {
tracerProvider = tracerProviderFactory.create();
} else {
tracerProvider = TracerProvider.getDefault();
}
}

return new DefaultOpenTelemetry(tracerProvider, meterProvider, propagators);
}
}
}
Loading

0 comments on commit 108b948

Please sign in to comment.