-
Notifications
You must be signed in to change notification settings - Fork 901
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Library Instrumentation for jsonrpc4j 1.3.3+ | ||
|
||
Provides OpenTelemetry instrumentation for [jsonrpc4j](https://github.com/briandilley/jsonrpc4j) server. | ||
|
||
## Quickstart | ||
|
||
### Add the following dependencies to your project | ||
|
||
Replace `OPENTELEMETRY_VERSION` with the [latest release](https://search.maven.org/search?q=g:io.opentelemetry.instrumentation%20AND%20a:opentelemetry-jsonrpc4j-1.3). | ||
|
||
For Maven, add the following to your `pom.xml` dependencies: | ||
|
||
```xml | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.opentelemetry.instrumentation</groupId> | ||
<artifactId>opentelemetry-jsonrpc4j-1.3</artifactId> | ||
<version>OPENTELEMETRY_VERSION</version> | ||
</dependency> | ||
</dependencies> | ||
``` | ||
|
||
For Gradle, add the following to your dependencies: | ||
|
||
```groovy | ||
implementation("io.opentelemetry.instrumentation:opentelemetry-jsonrpc4j-1.3:OPENTELEMETRY_VERSION") | ||
``` | ||
|
||
### Usage | ||
|
||
The instrumentation library provides the implementation of `InvocationListener` to provide OpenTelemetry-based spans and context propagation. | ||
|
||
```java | ||
// For server-side, attatch the invocation listener to your service. | ||
JsonRpcBasicServer configureServer(OpenTelemetry openTelemetry, JsonRpcBasicServer server) { | ||
JsonRpcTelemetry jsonrpcTelemetry = JsonRpcTelemetry.create(openTelemetry); | ||
return server.setInvocationListener(jsonrpcTelemetry.newServerInvocationListener()); | ||
} | ||
``` |