-
-
Notifications
You must be signed in to change notification settings - Fork 444
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '8.x.x' into feat/graphql-22-update-instrumentation
- Loading branch information
Showing
11 changed files
with
91 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
sentry-opentelemetry/sentry-opentelemetry-agentless/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# sentry-opentelemetry-agentless | ||
|
||
*NOTE: Our OpenTelemetry modules are still experimental. Any feedback is welcome.* | ||
|
||
## How to use it | ||
|
||
Add the latest `sentry-opentelemetry-agentless` module as a dependency and add a `sentry.properties` | ||
configuration file to your project that could look like this: | ||
|
||
```properties | ||
# NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in your Sentry project/dashboard | ||
dsn=https://[email protected]/5428563 | ||
traces-sample-rate=1.0 | ||
``` | ||
|
||
For more details on configuring Sentry via `sentry.properties` please see the | ||
[docs page](https://docs.sentry.io/platforms/java/configuration/). | ||
|
||
As an alternative to the `SENTRY_PROPERTIES_FILE` environment variable you can provide individual | ||
settings as environment variables (e.g. `SENTRY_DSN=...`) or you may initialize `Sentry` inside | ||
your target application. If you do so, please make sure to apply OpenTelemetry specific options, e.g. | ||
like this: | ||
|
||
``` | ||
Sentry.init( | ||
options -> { | ||
options.setDsn("..."); | ||
... | ||
OpenTelemetryUtil.applyOpenTelemetryOptions(options, false); | ||
} | ||
) | ||
``` | ||
|
||
## Getting rid of exporter error messages | ||
|
||
In case you are using this module without needing to use any OpenTelemetry exporters you can add | ||
the following environment variables to turn off exporters and stop seeing error messages about | ||
servers not being reachable in the logs. | ||
|
||
Example log message: | ||
``` | ||
ERROR io.opentelemetry.exporter.internal.grpc.OkHttpGrpcExporter - Failed to export spans. The request could not be executed. Full error message: Failed to connect to localhost/[0:0:0:0:0:0:0:1]:4317 | ||
ERROR io.opentelemetry.exporter.internal.grpc.OkHttpGrpcExporter - Failed to export metrics. The request could not be executed. Full error message: Failed to connect to localhost/[0:0:0:0:0:0:0:1]:4317 | ||
``` | ||
|
||
### Traces | ||
|
||
To turn off exporting of traces you can set `OTEL_TRACES_EXPORTER=none` | ||
see [OpenTelemetry GitHub](https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure#otlp-exporter-span-metric-and-log-exporters) | ||
|
||
### Metrics | ||
|
||
To turn off exporting of metrics you can set `OTEL_METRICS_EXPORTER=none` | ||
see [OpenTelemetry GitHub](https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure#otlp-exporter-span-metric-and-log-exporters) |
18 changes: 18 additions & 0 deletions
18
sentry-opentelemetry/sentry-opentelemetry-agentless/build.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
plugins { | ||
`java-library` | ||
} | ||
|
||
configure<JavaPluginExtension> { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
|
||
dependencies { | ||
api(projects.sentry) | ||
api(projects.sentryOpentelemetry.sentryOpentelemetryBootstrap) | ||
implementation(projects.sentryOpentelemetry.sentryOpentelemetryAgentcustomization) | ||
api(Config.Libs.OpenTelemetry.otelSdk) | ||
api(Config.Libs.OpenTelemetry.otelSemconv) | ||
api(Config.Libs.OpenTelemetry.otelSemconvIncubating) | ||
api(Config.Libs.OpenTelemetry.otelExtensionAutoconfigure) | ||
} |
3 changes: 3 additions & 0 deletions
3
...-opentelemetry-agentless/src/main/java/io/sentry/opentelemetry/agent/AgentlessMarker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package io.sentry.opentelemetry.agent; | ||
|
||
public final class AgentlessMarker {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
import io.sentry.SentryEvent; | ||
import io.sentry.SentryLevel; | ||
import io.sentry.SpanStatus; | ||
import io.sentry.opentelemetry.OpenTelemetryUtil; | ||
import io.sentry.protocol.Message; | ||
import io.sentry.protocol.User; | ||
import java.util.Collections; | ||
|
@@ -28,6 +29,8 @@ public static void main(String[] args) throws InterruptedException { | |
options.setDsn( | ||
"https://[email protected]/5428563"); | ||
|
||
OpenTelemetryUtil.applyOpenTelemetryOptions(options, false); | ||
|
||
// All events get assigned to the release. See more at | ||
// https://docs.sentry.io/workflow/releases/ | ||
options.setRelease("[email protected]+1"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters