-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OpenTelemetry: fallback to default storage when not on a Vert.x thread (
#72) The VertxContextStorageProvider is chosen by OpenTelemetry via the service loader mechanism. While it is mandatory to use context for storage of spans created on Vert.x threads, there may be parts of the application implemented without Vert.x. In this case, the storage provider fails with NPE. Instead, it is better to fall back to the default storage mechanism, which uses thread local variables. Signed-off-by: Thomas Segismont <[email protected]>
- Loading branch information
1 parent
eb4bf5b
commit 1bdeb88
Showing
8 changed files
with
201 additions
and
138 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
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
36 changes: 36 additions & 0 deletions
36
vertx-opentelemetry/src/main/java/io/vertx/tracing/opentelemetry/Operation.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,36 @@ | ||
/* | ||
* Copyright (c) 2011-2023 Contributors to the Eclipse Foundation | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
*/ | ||
|
||
package io.vertx.tracing.opentelemetry; | ||
|
||
import io.opentelemetry.api.trace.Span; | ||
import io.opentelemetry.context.Scope; | ||
|
||
import java.util.Objects; | ||
|
||
final class Operation { | ||
|
||
private final Span span; | ||
private final Scope scope; | ||
|
||
Operation(Span span, Scope scope) { | ||
this.span = Objects.requireNonNull(span); | ||
this.scope = Objects.requireNonNull(scope); | ||
} | ||
|
||
public Span span() { | ||
return span; | ||
} | ||
|
||
public Scope scope() { | ||
return scope; | ||
} | ||
} |
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
Oops, something went wrong.