-
-
Notifications
You must be signed in to change notification settings - Fork 456
POTEL 64 - sentry-opentelemetry-agentless
module
#3961
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to add some info on how to initialize with
AutoConfiguredOpenTelemetrySdk
. Or find another way to do that in e.g.OtelSpanFactory.getTracerProvider()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's follow up in a different PR.