- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1k
 
Library readmes - batch 2 #14631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Library readmes - batch 2 #14631
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # Library Instrumentation for JMX Metrics | ||
| 
     | 
||
| Provides OpenTelemetry instrumentation for [Java Management Extensions (JMX)](https://docs.oracle.com/javase/tutorial/jmx/). | ||
| 
     | 
||
| This instrumentation collects JMX metrics and exports them as OpenTelemetry metrics. | ||
| 
     | 
||
| ## Quickstart | ||
| 
     | 
||
| ### Add these dependencies to your project | ||
| 
     | 
||
| Replace `OPENTELEMETRY_VERSION` with the [latest release](https://central.sonatype.com/artifact/io.opentelemetry.instrumentation/opentelemetry-jmx-metrics). | ||
| 
     | 
||
| For Maven, add to your `pom.xml` dependencies: | ||
| 
     | 
||
| ```xml | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>io.opentelemetry.instrumentation</groupId> | ||
| <artifactId>opentelemetry-jmx-metrics</artifactId> | ||
| <version>OPENTELEMETRY_VERSION</version> | ||
| </dependency> | ||
| </dependencies> | ||
| ``` | ||
| 
     | 
||
| For Gradle, add to your dependencies: | ||
| 
     | 
||
| ```kotlin | ||
| implementation("io.opentelemetry.instrumentation:opentelemetry-jmx-metrics:OPENTELEMETRY_VERSION") | ||
| ``` | ||
| 
     | 
||
| ### Usage | ||
| 
     | 
||
| ```java | ||
| import io.opentelemetry.api.OpenTelemetry; | ||
| import io.opentelemetry.instrumentation.jmx.engine.JmxMetricInsight; | ||
| import io.opentelemetry.instrumentation.jmx.engine.MetricConfiguration; | ||
| 
     | 
||
| // Get an OpenTelemetry instance | ||
| OpenTelemetry openTelemetry = ...; | ||
| 
     | 
||
| JmxMetricInsight jmxMetricInsight = JmxMetricInsight.createService(openTelemetry, 5000); | ||
| 
     | 
||
| // Configure your JMX metrics | ||
| MetricConfiguration config = new MetricConfiguration(); | ||
| 
     | 
||
| jmxMetricInsight.startLocal(config); | ||
| 
         
      Comment on lines
    
      +34
     to 
      +46
    
   
  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately this does not conform to our usual practices. @SylvainJuge any plans to make this similar to our other library instrumentations? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you mean exactly here ? Is it packaging the JMX metrics feature to be similar to other library components in the instrumentation repository ? For example support for auto-configuration or fitting an "idiomatic way" to setup and initialize ? For example, there is currently no way to properly shut-down or disable the feature at runtime, which could be problematic in some case if we want to provide the ability to automatically re-connect to a remote JVM (which is not the case when executed locally within the JVM). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Other library instrumentations use have  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.  | 
||
| ``` | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # Library Instrumentation for Lettuce version 5.1 and higher | ||
| 
     | 
||
| Provides OpenTelemetry instrumentation for [Lettuce](https://lettuce.io/), enabling database client | ||
| spans and metrics. | ||
| 
     | 
||
| ## Quickstart | ||
| 
     | 
||
| ### Add these dependencies to your project | ||
| 
     | 
||
| Replace `OPENTELEMETRY_VERSION` with the [latest release](https://central.sonatype.com/artifact/io.opentelemetry.instrumentation/opentelemetry-lettuce-5.1). | ||
| 
     | 
||
| For Maven, add to your `pom.xml` dependencies: | ||
| 
     | 
||
| ```xml | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>io.opentelemetry.instrumentation</groupId> | ||
| <artifactId>opentelemetry-lettuce-5.1</artifactId> | ||
| <version>OPENTELEMETRY_VERSION</version> | ||
| </dependency> | ||
| </dependencies> | ||
| ``` | ||
| 
     | 
||
| For Gradle, add to your dependencies: | ||
| 
     | 
||
| ```kotlin | ||
| implementation("io.opentelemetry.instrumentation:opentelemetry-lettuce-5.1:OPENTELEMETRY_VERSION") | ||
| ``` | ||
| 
     | 
||
| ### Usage | ||
| 
     | 
||
| ```java | ||
| import io.lettuce.core.RedisClient; | ||
| import io.lettuce.core.api.StatefulRedisConnection; | ||
| import io.lettuce.core.resource.ClientResources; | ||
| import io.opentelemetry.api.OpenTelemetry; | ||
| import io.opentelemetry.instrumentation.lettuce.v5_1.LettuceTelemetry; | ||
| 
     | 
||
| // Get an OpenTelemetry instance | ||
| OpenTelemetry openTelemetry = ...; | ||
| 
     | 
||
| LettuceTelemetry lettuceTelemetry = LettuceTelemetry.create(openTelemetry); | ||
| 
     | 
||
| ClientResources clientResources = ClientResources.builder() | ||
| .tracing(lettuceTelemetry.newTracing()) | ||
| .build(); | ||
| 
     | 
||
| RedisClient redisClient = RedisClient.create(clientResources, "redis://localhost:6379"); | ||
| StatefulRedisConnection<String, String> connection = redisClient.connect(); | ||
| ``` | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| # Library Instrumentation for Netty version 4.1 and higher | ||
| 
     | 
||
| Provides OpenTelemetry instrumentation for [Netty](https://netty.io/), enabling HTTP client and | ||
| server spans and metrics. | ||
| 
     | 
||
| ## Quickstart | ||
| 
     | 
||
| ### Add these dependencies to your project | ||
| 
     | 
||
| Replace `OPENTELEMETRY_VERSION` with the [latest release](https://central.sonatype.com/artifact/io.opentelemetry.instrumentation/opentelemetry-netty-4.1). | ||
| 
     | 
||
| For Maven, add to your `pom.xml` dependencies: | ||
| 
     | 
||
| ```xml | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>io.opentelemetry.instrumentation</groupId> | ||
| <artifactId>opentelemetry-netty-4.1</artifactId> | ||
| <version>OPENTELEMETRY_VERSION</version> | ||
| </dependency> | ||
| </dependencies> | ||
| ``` | ||
| 
     | 
||
| For Gradle, add to your dependencies: | ||
| 
     | 
||
| ```kotlin | ||
| implementation("io.opentelemetry.instrumentation:opentelemetry-netty-4.1:OPENTELEMETRY_VERSION") | ||
| ``` | ||
| 
     | 
||
| ### Usage | ||
| 
     | 
||
| #### HTTP Client | ||
| 
     | 
||
| ```java | ||
| import io.netty.bootstrap.Bootstrap; | ||
| import io.netty.channel.Channel; | ||
| import io.netty.channel.ChannelInitializer; | ||
| import io.netty.channel.nio.NioEventLoopGroup; | ||
| import io.netty.channel.socket.SocketChannel; | ||
| import io.netty.channel.socket.nio.NioSocketChannel; | ||
| import io.netty.handler.codec.http.HttpClientCodec; | ||
| import io.opentelemetry.api.OpenTelemetry; | ||
| import io.opentelemetry.context.Context; | ||
| import io.opentelemetry.instrumentation.netty.v4_1.NettyClientTelemetry; | ||
| 
     | 
||
| // Get an OpenTelemetry instance | ||
| OpenTelemetry openTelemetry = ...; | ||
| 
     | 
||
| NettyClientTelemetry clientTelemetry = NettyClientTelemetry.create(openTelemetry); | ||
| 
     | 
||
| Bootstrap bootstrap = new Bootstrap(); | ||
| bootstrap.group(new NioEventLoopGroup()) | ||
                
       | 
||
| .channel(NioSocketChannel.class) | ||
| .handler(new ChannelInitializer<SocketChannel>() { | ||
| @Override | ||
| protected void initChannel(SocketChannel ch) { | ||
| ch.pipeline() | ||
| .addLast(new HttpClientCodec()) | ||
| .addLast(clientTelemetry.createRequestHandler()) | ||
| .addLast(clientTelemetry.createResponseHandler()); | ||
                
       | 
||
| } | ||
| }); | ||
| 
     | 
||
| Channel channel = bootstrap.connect("localhost", 8080).sync().channel(); | ||
| NettyClientTelemetry.setChannelContext(channel, Context.current()); | ||
| ``` | ||
| 
     | 
||
| #### HTTP Server | ||
| 
     | 
||
| ```java | ||
| import io.netty.bootstrap.ServerBootstrap; | ||
| import io.netty.channel.ChannelInitializer; | ||
| import io.netty.channel.EventLoopGroup; | ||
| import io.netty.channel.nio.NioEventLoopGroup; | ||
| import io.netty.channel.socket.SocketChannel; | ||
| import io.netty.channel.socket.nio.NioServerSocketChannel; | ||
| import io.netty.handler.codec.http.HttpServerCodec; | ||
| import io.opentelemetry.api.OpenTelemetry; | ||
| import io.opentelemetry.instrumentation.netty.v4_1.NettyServerTelemetry; | ||
| 
     | 
||
| // Get an OpenTelemetry instance | ||
| OpenTelemetry openTelemetry = ...; | ||
| 
     | 
||
| NettyServerTelemetry serverTelemetry = NettyServerTelemetry.create(openTelemetry); | ||
| 
     | 
||
| EventLoopGroup bossGroup = new NioEventLoopGroup(); | ||
| EventLoopGroup workerGroup = new NioEventLoopGroup(); | ||
| 
     | 
||
| ServerBootstrap bootstrap = new ServerBootstrap(); | ||
| bootstrap.group(bossGroup, workerGroup) | ||
| .channel(NioServerSocketChannel.class) | ||
| .childHandler(new ChannelInitializer<SocketChannel>() { | ||
| @Override | ||
| protected void initChannel(SocketChannel ch) { | ||
| ch.pipeline() | ||
| .addLast(new HttpServerCodec()) | ||
| .addLast(serverTelemetry.createRequestHandler()) | ||
| .addLast(serverTelemetry.createResponseHandler()); | ||
| } | ||
| }); | ||
| 
     | 
||
| bootstrap.bind(8080).sync(); | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # Library Instrumentation for OSHI version 5.3.1 and higher | ||
| 
     | 
||
| Provides OpenTelemetry instrumentation for [OSHI](https://github.com/oshi/oshi). | ||
| 
     | 
||
| This instrumentation collects system metrics such as memory usage, network I/O, and disk operations. | ||
| 
     | 
||
| ## Quickstart | ||
| 
     | 
||
| ### Add these dependencies to your project | ||
| 
     | 
||
| Replace `OPENTELEMETRY_VERSION` with the [latest release](https://central.sonatype.com/artifact/io.opentelemetry.instrumentation/opentelemetry-oshi). | ||
| 
     | 
||
| For Maven, add to your `pom.xml` dependencies: | ||
| 
     | 
||
| ```xml | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>io.opentelemetry.instrumentation</groupId> | ||
| <artifactId>opentelemetry-oshi</artifactId> | ||
| <version>OPENTELEMETRY_VERSION</version> | ||
| </dependency> | ||
| </dependencies> | ||
| ``` | ||
| 
     | 
||
| For Gradle, add to your dependencies: | ||
| 
     | 
||
| ```kotlin | ||
| implementation("io.opentelemetry.instrumentation:opentelemetry-oshi:OPENTELEMETRY_VERSION") | ||
| ``` | ||
| 
     | 
||
| ### Usage | ||
| 
     | 
||
| ```java | ||
| import io.opentelemetry.api.OpenTelemetry; | ||
| import io.opentelemetry.instrumentation.oshi.SystemMetrics; | ||
| import java.util.List; | ||
| 
     | 
||
| // Get an OpenTelemetry instance | ||
| OpenTelemetry openTelemetry = ...; | ||
| 
     | 
||
| List<AutoCloseable> observables = SystemMetrics.registerObservers(openTelemetry); | ||
| 
     | 
||
| // The observers will automatically collect and export system metrics | ||
| // Close the observables when shutting down your application | ||
| observables.forEach(observable -> { | ||
| try { | ||
| observable.close(); | ||
| } catch (Exception e) { | ||
| // Handle exception | ||
| } | ||
| }); | ||
| ``` | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # Library Instrumentation for Quartz version 2.0 and higher | ||
| 
     | 
||
| Provides OpenTelemetry instrumentation for [Quartz Scheduler](https://www.quartz-scheduler.org/), | ||
| enabling INTERNAL spans for each job execution. | ||
                
      
                  jaydeluca marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| 
     | 
||
| ## Quickstart | ||
| 
     | 
||
| ### Add these dependencies to your project | ||
| 
     | 
||
| Replace `OPENTELEMETRY_VERSION` with the [latest release](https://central.sonatype.com/artifact/io.opentelemetry.instrumentation/opentelemetry-quartz-2.0). | ||
| 
     | 
||
| For Maven, add to your `pom.xml` dependencies: | ||
| 
     | 
||
| ```xml | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>io.opentelemetry.instrumentation</groupId> | ||
| <artifactId>opentelemetry-quartz-2.0</artifactId> | ||
| <version>OPENTELEMETRY_VERSION</version> | ||
| </dependency> | ||
| </dependencies> | ||
| ``` | ||
| 
     | 
||
| For Gradle, add to your dependencies: | ||
| 
     | 
||
| ```kotlin | ||
| implementation("io.opentelemetry.instrumentation:opentelemetry-quartz-2.0:OPENTELEMETRY_VERSION") | ||
| ``` | ||
| 
     | 
||
| ### Usage | ||
| 
     | 
||
| ```java | ||
| import io.opentelemetry.api.OpenTelemetry; | ||
| import io.opentelemetry.instrumentation.quartz.v2_0.QuartzTelemetry; | ||
| import org.quartz.Scheduler; | ||
| import org.quartz.SchedulerException; | ||
| import org.quartz.impl.StdSchedulerFactory; | ||
| 
     | 
||
| // Get an OpenTelemetry instance | ||
| OpenTelemetry openTelemetry = ...; | ||
| 
     | 
||
| QuartzTelemetry quartzTelemetry = QuartzTelemetry.create(openTelemetry); | ||
| 
     | 
||
| Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler(); | ||
| quartzTelemetry.configure(scheduler); | ||
| 
     | 
||
| scheduler.start(); | ||
| // Schedule your jobs - they will now be traced with OpenTelemetry | ||
| ``` | ||
Uh oh!
There was an error while loading. Please reload this page.