Skip to content

Commit

Permalink
Merge pull request #1566 from microsoft/trask/otel-fork-updated
Browse files Browse the repository at this point in the history
Update otel-fork
  • Loading branch information
trask authored Mar 17, 2021
2 parents ca1e555 + b2cc2ff commit b034c6b
Show file tree
Hide file tree
Showing 326 changed files with 8,456 additions and 3,284 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-grpc-smoke-dist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
java-version: 11

- name: Cache gradle dependencies
uses: burrunan/gradle-cache-action@v1.6
uses: burrunan/gradle-cache-action@v1.10
with:
job-id: grpc-smoke

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-play-smoke-dist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
java-version: 11

- name: Cache gradle dependencies
uses: burrunan/gradle-cache-action@v1.6
uses: burrunan/gradle-cache-action@v1.10
with:
job-id: play-smoke

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-smoke-dist-fakebackend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
java-version: 11

- name: Cache gradle dependencies
uses: burrunan/gradle-cache-action@v1.6
uses: burrunan/gradle-cache-action@v1.10
with:
job-id: fakebackend-smoke

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-springboot-smoke-dist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
java-version: 11

- name: Cache gradle dependencies
uses: burrunan/gradle-cache-action@v1.6
uses: burrunan/gradle-cache-action@v1.10
with:
job-id: springboot-smoke

Expand Down
43 changes: 39 additions & 4 deletions .github/workflows/build-test-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ on:
paths:
- 'smoke-tests/matrix/**'
- '.github/workflows/build-test-matrix.yaml'
branches: 'main'
branches: ['main']
workflow_dispatch:

jobs:
publish:
buildLinux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -19,7 +19,7 @@ jobs:
java-version: 11

- name: Cache gradle dependencies
uses: burrunan/gradle-cache-action@v1.6
uses: burrunan/gradle-cache-action@v1.10
with:
job-id: matrix-smoke

Expand All @@ -34,5 +34,40 @@ jobs:
run: |
TAG="$(date '+%Y%m%d').$GITHUB_RUN_ID"
echo "Using extra tag $TAG"
./gradlew buildMatrix pushMatrix -PextraTag=$TAG
./gradlew buildLinuxTestImages pushMatrix -PextraTag=$TAG
working-directory: smoke-tests/matrix

buildWindows:
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- name: Support longpaths
run: git config --system core.longpaths true

- uses: actions/checkout@v2

- name: Set up JDK 11 for running Gradle
uses: actions/setup-java@v1
with:
java-version: 11

- name: Cache gradle dependencies
uses: burrunan/gradle-cache-action@v1.10
with:
job-id: matrix-smoke

- name: Login to GitHub Package Registry
uses: azure/docker-login@v1
with:
login-server: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}

- name: Build Docker Image
run: |
TAG="$(date '+%Y%m%d').$GITHUB_RUN_ID"
echo "Using extra tag $TAG"
./gradlew buildWindowsTestImages pushMatrix -PextraTag=$TAG
working-directory: smoke-tests/matrix
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
java-version: 11

- name: Restore cache
uses: burrunan/gradle-cache-action@v1.5
uses: burrunan/gradle-cache-action@v1.10
with:
job-id: jdk11

Expand All @@ -43,7 +43,7 @@ jobs:
java-version: 11

- name: Restore cache
uses: burrunan/gradle-cache-action@v1.6
uses: burrunan/gradle-cache-action@v1.10
with:
job-id: jdk11

Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
java-version: 11

- name: Restore cache
uses: burrunan/gradle-cache-action@v1.5
uses: burrunan/gradle-cache-action@v1.10
with:
job-id: jdk${{ matrix.java }}

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
java-version: 11

- name: Restore cache
uses: burrunan/gradle-cache-action@v1.6
uses: burrunan/gradle-cache-action@v1.10
with:
job-id: jdk11

Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
java-version: 11

- name: Restore cache
uses: burrunan/gradle-cache-action@v1.6
uses: burrunan/gradle-cache-action@v1.10
with:
job-id: jdk${{ matrix.java }}

Expand All @@ -74,7 +74,7 @@ jobs:
java-version: 11

- name: Restore cache
uses: burrunan/gradle-cache-action@v1.6
uses: burrunan/gradle-cache-action@v1.10
with:
job-id: latestDepTest

Expand All @@ -98,7 +98,7 @@ jobs:
java-version: 11

- name: Restore cache
uses: burrunan/gradle-cache-action@v1.6
uses: burrunan/gradle-cache-action@v1.10
with:
job-id: jdk11

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/patch-release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
echo $word | sed 's/ *$//g' | sed 's/^ *//g' | git cherry-pick --stdin
done
- name: Build and publish artifacts
uses: burrunan/gradle-cache-action@v1.6
uses: burrunan/gradle-cache-action@v1.10
with:
job-id: jdk11
remote-build-cache-proxy-enabled: false
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
java-version: 11

- name: Restore cache
uses: burrunan/gradle-cache-action@v1.6
uses: burrunan/gradle-cache-action@v1.10
with:
job-id: jdk11

Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
java-version: 11

- name: Restore cache
uses: burrunan/gradle-cache-action@v1.6
uses: burrunan/gradle-cache-action@v1.10
with:
job-id: jdk11

Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
java-version: 11

- name: Restore cache
uses: burrunan/gradle-cache-action@v1.6
uses: burrunan/gradle-cache-action@v1.10
with:
job-id: jdk${{ matrix.java }}

Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:
java-version: 11

- name: Restore cache
uses: burrunan/gradle-cache-action@v1.6
uses: burrunan/gradle-cache-action@v1.10
with:
job-id: smokeTests

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:
with:
java-version: 11
- name: Build and publish artifacts
uses: burrunan/gradle-cache-action@v1.6
uses: burrunan/gradle-cache-action@v1.10
with:
job-id: jdk11
remote-build-cache-proxy-enabled: false
arguments: build final closeAndReleaseRepository --stacktrace -Prelease.version=${{ github.event.inputs.version }}
arguments: build final closeAndReleaseSonatypeStagingRepository --stacktrace -Prelease.version=${{ github.event.inputs.version }}
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ java -version

and then you can find the java agent artifact at

`javaagent/build/lib/opentelemetry-javaagent-<version>-all.jar`.
`javaagent/build/libs/opentelemetry-javaagent-<version>-all.jar`.

### IntelliJ setup

Expand Down
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,15 @@ configured to send data to
at `http://localhost:4317`.

Configuration parameters are passed as Java system properties (`-D` flags) or
as environment variables. See below for a full list of environment variables. For example:
as environment variables. See [the configuration documentation](/~https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/agent-config.md)
for the full list of configuration items. For example:
```
java -javaagent:path/to/opentelemetry-javaagent-all.jar \
-Dotel.resource.attributes=service.name=your-service-name \
-Dotel.traces.exporter=zipkin \
-jar myapp.jar
```

Specify the external exporter JAR file using the `otel.exporter.jar` system property:
```
java -javaagent:path/to/opentelemetry-javaagent-all.jar \
-Dotel.exporter.jar=path/to/external-exporter.jar \
-jar myapp.jar
```


## Configuring the Agent

The agent is [highly configurable](docs/agent-config.md)! Many aspects of the agent's behavior can be
Expand Down
2 changes: 1 addition & 1 deletion benchmark-integration/run-perf-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ header='Client Version'
for label in "${test_order[@]}"; do
header="$header,$label Latency,$label Throughput"
done
header="$header,Agent CPU Burn,Server CPU Burn,Agent RSS Delta,Server Max RSS,Server Start RSS,Server Load Increase RSS"
header="$header,Server CPU Burn,Server Max RSS,Server Start RSS,Server Load Increase RSS"
echo $header > $test_csv_file

for agent_jar in $agent_jars; do
Expand Down
29 changes: 20 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import java.time.Duration

plugins {
id 'idea'

id "de.marcphilipp.nexus-publish" version "0.4.0" apply false
id "io.codearte.nexus-staging" version "0.22.0"
id "io.github.gradle-nexus.publish-plugin" version "1.0.0"

id 'org.gradle.test-retry' version '1.2.0' apply false

Expand All @@ -19,15 +20,25 @@ plugins {
id "net.ltgt.errorprone" version "1.3.0" apply false
}

nexusStaging {
nexusPublishing {
packageGroup = "io.opentelemetry"
username = System.getenv('SONATYPE_USER')
password = System.getenv('SONATYPE_KEY')

// We have many artifacts so Maven Central takes a long time on its compliance checks. This sets
// the timeout for waiting for the repository to close to a comfortable 50 minutes.
numberOfRetries = 300
delayBetweenRetriesInMillis = 10000
repositories {
sonatype {
username = System.getenv('SONATYPE_USER')
password = System.getenv('SONATYPE_KEY')
}
}

connectTimeout = Duration.ofMinutes(5)
clientTimeout = Duration.ofMinutes(5)

transitionCheckOptions {
// We have many artifacts so Maven Central takes a long time on its compliance checks. This sets
// the timeout for waiting for the repository to close to a comfortable 50 minutes.
maxRetries.set(300)
delayBetween.set(Duration.ofSeconds(10))
}
}

// Enable after verifying Maven Central publishing once through manual closing
Expand Down
41 changes: 23 additions & 18 deletions docs/agent-config.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,47 @@
# Configuration parameters
# Agent Configuration

## NOTE: subject to change!

Note: These parameter names are very likely to change over time, so please check
back here when trying out a new version! Please report any bugs or unexpected
behavior you find.
Note: The environment variables/system properties in this document are very likely to change over time.
Please check back here when trying out a new version!

Please report any bugs or unexpected behavior you find.

## Contents

* [SDK Autoconfiguration](#sdk-autoconfiguration)
* [Peer service name](#peer-service-name)
* [DB statement sanitization](#db-statement-sanitization)
* [Customizing the OpenTelemetry SDK](#customizing-the-opentelemetry-sdk)
* [Suppressing specific auto-instrumentation](#suppressing-specific-auto-instrumentation)

## SDK Autoconfiguration

The SDK's autoconfiguration module is used for basic configuration of the agent. Read the
[docs](/~https://github.com/open-telemetry/opentelemetry-java/tree/v1.0.0/sdk-extensions/autoconfigure#customizing-the-opentelemetry-sdk)
[docs](/~https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure)
to find settings such as configuring export or sampling.

Here are some quick links into those docs for the configuration options for specific portions of the SDK & agent:

* [Exporters](#exporters)
+ [OTLP exporter (both span and metric exporters)](/~https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure/README.md#otlp-exporter-both-span-and-metric-exporters)
+ [Jaeger exporter](/~https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure/README.md#jaeger-exporter)
+ [Zipkin exporter](/~https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure/README.md#zipkin-exporter)
+ [Prometheus exporter](/~https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure/README.md#prometheus-exporter)
+ [Logging exporter](/~https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure/README.md#logging-exporter)
* [Trace context propagation](/~https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure/README.md#propagator)
* [OpenTelemetry Resource and service name](/~https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure/README.md#opentelemetry-resource)
* [Batch span processor](/~https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure/README.md#batch-span-processor)
* [Sampler](/~https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure/README.md#sampler)
* [Span limits](/~https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure/README.md#span-limits)
* [Using SPI to further configure the SDK](/~https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure/README.md#customizing-the-opentelemetry-sdk)

## Peer service name

The [peer service name](/~https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/span-general.md#general-remote-service-attributes) is the name of a remote service being connected to. It corresponds to `service.name` in the [Resource](/~https://github.com/open-telemetry/opentelemetry-specification/tree/master/specification/resource/semantic_conventions#service) for the local service.

| System property | Environment variable | Description |
|--------------------------------------|--------------------------------------|----------------------------------------------------------------------------------|
| `otel.endpoint.peer.service.mapping` | `OTEL_ENDPOINT_PEER_SERVICE_MAPPING` | Used to specify a mapping from hostnames or IP addresses to peer services, as a comma-separated list of host=name pairs. The peer service is added as an attribute to a span whose host or IP match the mapping. For example, if set to 1.2.3.4=cats-service,dogs-abcdef123.serverlessapis.com=dogs-api, requests to `1.2.3.4` will have a `peer.service` attribute of `cats-service` and requests to `dogs-abcdef123.serverlessapis.com` will have an attribute of `dogs-api`. |
| `otel.instrumentation.common.peer-service-mapping` | `OTEL_INSTRUMENTATION_COMMON_PEER_SERVICE_MAPPING` | Used to specify a mapping from hostnames or IP addresses to peer services, as a comma-separated list of host=name pairs. The peer service is added as an attribute to a span whose host or IP match the mapping. For example, if set to 1.2.3.4=cats-service,dogs-abcdef123.serverlessapis.com=dogs-api, requests to `1.2.3.4` will have a `peer.service` attribute of `cats-service` and requests to `dogs-abcdef123.serverlessapis.com` will have an attribute of `dogs-api`. |

## DB statement sanitization

Expand All @@ -42,17 +57,7 @@ The following property may be used to disable it:

| System property | Environment variable | Description |
|-------------------------------------------------------|-------------------------------------------------------|---------------------------------------------------------------------|
| `otel.instrumentation.db-statement-sanitizer.enabled` | `OTEL_INSTRUMENTATION_DB_STATEMENT_SANITIZER_ENABLED` | Enables the DB statement sanitization. The default value is `true`. |

## Customizing the OpenTelemetry SDK

*Customizing the SDK is highly advanced behavior and is still in the prototyping phase. It may change drastically or be removed completely. Use
with caution*

The OpenTelemetry SDK exposes SPI [hooks](/~https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/spi)
for customizing its behavior, such as the `Resource` attached to spans or the `Sampler`.

Because the automatic instrumentation runs in a different classpath than the instrumented application, it is not possible for customization in the application to take advantage of this customization. In order to provide such customization, you can provide the path to a JAR file, including an SPI implementation using the system property `otel.initializer.jar`. Note that this JAR needs to shade the OpenTelemetry API in the same way as the agent does. The simplest way to do this is to use the same shading configuration as the agent from [here](/~https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/cfade733b899a2f02cfec7033c6a1efd7c54fd8b/java-agent/java-agent.gradle#L39). In addition, you must specify the `io.opentelemetry.javaagent.shaded.io.opentelemetry.api.trace.spi.TraceProvider` to the name of the class that implements the SPI.
| `otel.instrumentation.common.db-statement-sanitizer.enabled` | `OTEL_INSTRUMENTATION_COMMON_DB_STATEMENT_SANITIZER_ENABLED` | Enables the DB statement sanitization. The default value is `true`. |

## Suppressing specific auto-instrumentation

Expand Down
Loading

0 comments on commit b034c6b

Please sign in to comment.