Name Date Size #Lines LOC

..--

src/H25-Apr-2025-1,9141,312

README.mdH A D25-Apr-20251.8 KiB6554

build.gradleH A D25-Apr-20251.1 KiB3929

README.md

1# OpenCensus Java OC-Agent Metrics Exporter
2
3The *OpenCensus Java OC-Agent Metrics Exporter* is the Java implementation of the OpenCensus Agent
4(OC-Agent) Metrics Exporter.
5
6## Quickstart
7
8### Add the dependencies to your project
9
10For Maven add to your `pom.xml`:
11```xml
12<dependencies>
13  <dependency>
14    <groupId>io.opencensus</groupId>
15    <artifactId>opencensus-api</artifactId>
16    <version>0.22.0</version>
17  </dependency>
18  <dependency>
19    <groupId>io.opencensus</groupId>
20    <artifactId>opencensus-exporter-metrics-ocagent</artifactId>
21    <version>0.22.0</version>
22  </dependency>
23  <dependency>
24    <groupId>io.opencensus</groupId>
25    <artifactId>opencensus-impl</artifactId>
26    <version>0.22.0</version>
27    <scope>runtime</scope>
28  </dependency>
29  <dependency>
30    <groupId>io.netty</groupId>
31    <artifactId>netty-tcnative-boringssl-static</artifactId>
32    <version>2.0.20.Final</version>
33    <scope>runtime</scope>
34  </dependency>
35</dependencies>
36```
37
38For Gradle add to your dependencies:
39```groovy
40compile 'io.opencensus:opencensus-api:0.22.0'
41compile 'io.opencensus:opencensus-exporter-metrics-ocagent:0.22.0'
42runtime 'io.opencensus:opencensus-impl:0.22.0'
43runtime 'io.netty:netty-tcnative-boringssl-static:2.0.20.Final'
44```
45
46### Register the exporter
47
48```java
49import io.opencensus.exporter.metrics.ocagent.OcAgentMetricsExporter;
50
51public class MyMainClass {
52  public static void main(String[] args) throws Exception {
53    OcAgentMetricsExporter.createAndRegister();
54    // ...
55  }
56}
57```
58
59## FAQ
60
61### Why is `netty-tcnative-boringssl-static` needed? Which version should I use?
62
63It's because this artifact depends on `grpc-netty` which requires a runtime dependency on `netty-tcnative-boringssl-static`
64for it to work. For more details and a table of known working version combinations, see
65https://github.com/grpc/grpc-java/blob/master/SECURITY.md#netty.