You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sentry-opentelemetry/README.md
+48-5Lines changed: 48 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,5 @@
1
1
# sentry-opentelemetry
2
2
3
-
*NOTE: Our OpenTelemetry modules are still experimental. Any feedback is welcome.*
4
-
5
3
## OpenTelemetry
6
4
7
5
More information on OpenTelemetry can be found on their [website](https://opentelemetry.io/) as well
@@ -21,8 +19,7 @@ application. Please see the module [README](sentry-opentelemetry-agent/README.md
21
19
22
20
This contains customizations to the OpenTelemetry Java Agent such as registering the
23
21
`SentrySpanProcessor` and `SentryPropagator` as well as providing default properties that
24
-
enable the `sentry` propagator and disable exporters so our agent doesn't trigger lots of log
25
-
warnings due to OTLP server not being there. This can also be used without the agent.
22
+
enable the `sentry` propagator.
26
23
27
24
### `sentry-opentelemetry-bootstrap`
28
25
@@ -39,4 +36,50 @@ you also need this module as a dependency.
39
36
Contains `SentrySpanProcessor` and `SentryPropagator` which are used by our Java Agent but can also
40
37
be used when manually instrumenting using OpenTelemetry. If you want to use OpenTelemetry without
41
38
the agent but still want some configuration convenience, you should rather use the
42
-
`sentry-opentelemetry-agentcustomization` module.
39
+
`sentry-opentelemetry-agentless` module or the `sentry-opentelemetry-agentless-spring` module if you are using Spring Boot.
40
+
41
+
### `sentry-opentelemetry-agentless`
42
+
Combines all modules and dependencies needed to use Sentry with OpenTelemetry without the agent.
43
+
44
+
### `sentry-opentelemetry-agentless-spring`
45
+
Combines all modules and dependencies needed to use Sentry with OpenTelemetry in Spring Boot without an agent.
46
+
47
+
## Running without an Agent
48
+
If you want to use Sentry with OpenTelemetry without an agent, you can do so by adding the `sentry-opentelemetry-agentless` (or `sentry-opentelemetry-agentless-spring`) module as dependency to your project.
49
+
50
+
And run your application with the following JVM arguments:
51
+
```
52
+
-Dotel.java.global-autoconfigure.enabled=true
53
+
```
54
+
You may also want to set the following environment variables to if you do not use OpenTelemetry exporters:
As an alternative to the `SENTRY_PROPERTIES_FILE` environment variable you can provide individual
24
-
settings as environment variables (e.g. `SENTRY_DSN=...`) or you may initialize `Sentry` inside
25
-
your target application. If you do so, please make sure to set the `instrumenter` to `otel`, e.g.
26
-
like this:
22
+
settings as environment variables (e.g. `SENTRY_DSN=...`).
23
+
24
+
## Controlling auto initialization of Sentry
25
+
26
+
By default, if you pass either `SENTRY_DSN` or `SENTRY_PROPERTIES_FILE` as environment variable,
27
+
Sentry will automatically be initialized by this agent. To disable this behaviour, you can set
28
+
`SENTRY_AUTO_INIT=false` as environment variable. You will then have to use a Sentry SDK that takes care of initialization or initialize Sentry manually inside
29
+
the target application:
27
30
28
31
```
29
32
Sentry.init(
30
33
options -> {
31
34
options.setDsn("...");
32
35
...
33
-
options.setInstrumenter(Instrumenter.OTEL);
34
36
}
35
37
)
36
38
```
37
39
38
-
Using the `otel` instrumenter will ensure `Sentry` instrumentation will be done via OpenTelemetry
39
-
and integrations as well as direct interactions with transactions and spans have no effect.
40
-
41
-
## Controlling auto initialization of Sentry
42
-
43
-
By default if you pass either `SENTRY_DSN` or `SENTRY_PROPERTIES_FILE` as environment variable,
44
-
Sentry will automatically be initialized by this agent. To disable this behaviour, you can set
45
-
`SENTRY_AUTO_INIT=false` as environment variable. You will then have to initialize Sentry inside
46
-
the target application.
47
-
48
40
## Debugging
49
41
50
42
To enable debug logging for Sentry, please provide `SENTRY_DEBUG=true` as environment variable or
@@ -62,6 +54,7 @@ Example log message:
62
54
```
63
55
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
64
56
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
57
+
ERROR io.opentelemetry.exporter.internal.http.HttpExporter - Failed to export logs. The request could not be executed. Full error message: Failed to connect to localhost/[0:0:0:0:0:0:0:1]:4318
65
58
```
66
59
67
60
### Traces
@@ -73,3 +66,8 @@ see [OpenTelemetry GitHub](https://github.com/open-telemetry/opentelemetry-java/
73
66
74
67
To turn off exporting of metrics you can set `OTEL_METRICS_EXPORTER=none`
75
68
see [OpenTelemetry GitHub](https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure#otlp-exporter-span-metric-and-log-exporters)
69
+
70
+
### Logs
71
+
72
+
To turn off log exporting, set `OTEL_LOGS_EXPORTER=none`
73
+
see [OpenTelemetry GitHub](https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure#otlp-exporter-span-metric-and-log-exporters).
*NOTE: Our OpenTelemetry modules are still experimental. Any feedback is welcome.*
3
+
This module allows the use of Sentry with OpenTelemetry in SpringBoot without an agent by using the OpenTelemetry Spring Boot Starter.
4
+
For guidance on when to use this module instead of the agent, please have a look at the [OpenTelemetry Spring Boot Starter documentation](https://opentelemetry.io/docs/zero-code/java/spring-boot-starter/).
4
5
5
6
## How to use it
6
7
7
-
Add the latest `sentry-opentelemetry-agentless-spring` module as a dependency and add a `sentry.properties`
8
-
configuration file to your project that could look like this:
8
+
Add the latest `sentry-opentelemetry-agentless-spring` module as a dependency to your Sentry enabled [SpringBoot](https://docs.sentry.io/platforms/java/guides/spring-boot/) application and add the following to your `application.properties`:
9
9
10
10
```properties
11
-
# NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in your Sentry project/dashboard
In case you are using this module without needing to use any OpenTelemetry exporters you can add
37
-
the following environment variables to turn off exporters and stop seeing error messages about
38
-
servers not being reachable in the logs.
39
-
40
-
Example log message:
41
-
```
42
-
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
43
-
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
44
-
```
45
-
46
-
### Traces
47
-
48
-
To turn off exporting of traces you can set `OTEL_TRACES_EXPORTER=none`
49
-
see [OpenTelemetry GitHub](https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure#otlp-exporter-span-metric-and-log-exporters)
50
-
51
-
### Metrics
52
-
53
-
To turn off exporting of metrics you can set `OTEL_METRICS_EXPORTER=none`
54
-
see [OpenTelemetry GitHub](https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure#otlp-exporter-span-metric-and-log-exporters)
20
+
With the dependency and configuration in place, just run your SpringBoot application as usual.
In case you are using this module without needing to use any OpenTelemetry exporters you can add
37
-
the following environment variables to turn off exporters and stop seeing error messages about
38
-
servers not being reachable in the logs.
39
-
40
-
Example log message:
41
-
```
42
-
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
43
-
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
25
+
You may also want to set the following environment variables to if you do not use OpenTelemetry exporters:
If you're not using `sentry.properties` or environment variables you can then initialize Sentry programmatically as usual:
47
47
48
-
To turn off exporting of traces you can set `OTEL_TRACES_EXPORTER=none`
49
-
see [OpenTelemetry GitHub](https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure#otlp-exporter-span-metric-and-log-exporters)
50
-
51
-
### Metrics
52
-
53
-
To turn off exporting of metrics you can set `OTEL_METRICS_EXPORTER=none`
54
-
see [OpenTelemetry GitHub](https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure#otlp-exporter-span-metric-and-log-exporters)
Copy file name to clipboardExpand all lines: sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Sentry Sample Spring Boot 3.0+
2
2
3
-
Sample application showing how to use Sentry with [Spring boot](http://spring.io/projects/spring-boot) from version `3.0` onwards.
3
+
Sample application showing how to use Sentry with [Spring boot](http://spring.io/projects/spring-boot) from version `3.0` onwards integrated with the [OpenTelemetry Spring Boot Starter](https://opentelemetry.io/docs/zero-code/java/spring-boot-starter/) without an agent.
Copy file name to clipboardExpand all lines: sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/resources/application.properties
Copy file name to clipboardExpand all lines: sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Sentry Sample Spring Boot
2
2
3
-
Sample application showing how to use Sentry with [Spring boot](http://spring.io/projects/spring-boot).
3
+
Sample application showing how to use Sentry with [Spring boot](http://spring.io/projects/spring-boot) integrated with the [OpenTelemetry Spring Boot Starter](https://opentelemetry.io/docs/zero-code/java/spring-boot-starter/).
0 commit comments