-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38707 from radcortez/mp-telemetry
MicroProfile Telemetry compatibility
- Loading branch information
Showing
3 changed files
with
128 additions
and
2 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
35 changes: 35 additions & 0 deletions
35
...ntelemetry/runtime/tracing/intrumentation/resteasy/OpenTelemetryClassicThreadContext.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,35 @@ | ||
package io.quarkus.opentelemetry.runtime.tracing.intrumentation.resteasy; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import jakarta.ws.rs.ext.Provider; | ||
|
||
import org.jboss.resteasy.spi.concurrent.ThreadContext; | ||
|
||
import io.opentelemetry.context.Context; | ||
import io.opentelemetry.context.Scope; | ||
|
||
@Provider | ||
public class OpenTelemetryClassicThreadContext implements ThreadContext<Map<String, Object>> { | ||
@Override | ||
public Map<String, Object> capture() { | ||
Map<String, Object> context = new HashMap<>(); | ||
context.put("context", Context.current()); | ||
return context; | ||
} | ||
|
||
@Override | ||
public void push(final Map<String, Object> context) { | ||
Context current = (Context) context.get("context"); | ||
Scope scope = current.makeCurrent(); | ||
context.put("scope", scope); | ||
} | ||
|
||
@Override | ||
public void reset(final Map<String, Object> context) { | ||
Scope scope = (Scope) context.get("scope"); | ||
scope.close(); | ||
context.clear(); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...time/src/main/resources/META-INF/services/org.jboss.resteasy.spi.concurrent.ThreadContext
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 @@ | ||
io.quarkus.opentelemetry.runtime.tracing.intrumentation.resteasy.OpenTelemetryClassicThreadContext |