Skip to content

Commit

Permalink
add README.md for library
Browse files Browse the repository at this point in the history
  • Loading branch information
chenlujjj committed Jan 14, 2025
1 parent 527b244 commit 12e289d
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions instrumentation/jsonrpc4j-1.3/library/README.md
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());
}
```

0 comments on commit 12e289d

Please sign in to comment.