|
@@ -6,7 +6,7 @@ This package contains the library to help instrument MongoDB Client.
|
|
|
|
|
|
### Dependencies
|
|
### Dependencies
|
|
|
|
|
|
-Replace OPENTELEMETRY_VERSION with the [latest release](https://central.sonatype.com/search?q=g:io.opentelemetry.instrumentation++a:opentelemetry-mongo-3.1&smo=true).
|
|
|
|
|
|
+Replace OPENTELEMETRY_VERSION with the [latest release](https://central.sonatype.com/search?q=g%3Aio.opentelemetry.instrumentation+a%3Aopentelemetry-mongo-3.1).
|
|
|
|
|
|
For Maven, add to your `pom.xml` dependencies:
|
|
For Maven, add to your `pom.xml` dependencies:
|
|
|
|
|
|
@@ -31,7 +31,8 @@ implementation("io.opentelemetry.instrumentation:instrumentation:opentelemetry-m
|
|
The instrumentation is initialized by passing a `MongoTelemetry::newCommandListener()` to the `MongoClientSettings` builder. You must set the `OpenTelemetry` to use with the feature.
|
|
The instrumentation is initialized by passing a `MongoTelemetry::newCommandListener()` to the `MongoClientSettings` builder. You must set the `OpenTelemetry` to use with the feature.
|
|
|
|
|
|
```java
|
|
```java
|
|
-OpenTelemetry openTelemetry = initializeOpenTelemetryForMe();
|
|
|
|
|
|
+OpenTelemetry openTelemetry = ...;
|
|
|
|
+
|
|
MongoTelemetry mongoTelemetry = MongoTelemetry.builder(openTelemetry).build();
|
|
MongoTelemetry mongoTelemetry = MongoTelemetry.builder(openTelemetry).build();
|
|
|
|
|
|
MongoClientSettings settings = MongoClientSettings.builder()
|
|
MongoClientSettings settings = MongoClientSettings.builder()
|
|
@@ -42,9 +43,3 @@ MongoClientSettings settings = MongoClientSettings.builder()
|
|
// With Reactive Streams
|
|
// With Reactive Streams
|
|
MongoClient client = MongoClients.create(settings);
|
|
MongoClient client = MongoClients.create(settings);
|
|
```
|
|
```
|
|
-
|
|
|
|
-A logging message example produced by `LoggingSpanExporter`:
|
|
|
|
-
|
|
|
|
-```
|
|
|
|
-INFO: 'insert test.MyCollection' : 4487bebe5fcfc91af2cd517685552a33 a56685e62bf8f87c CLIENT [tracer: io.opentelemetry.mongo-3.1:1.31.0-alpha] AttributesMap{data={db.operation=insert, db.mongodb.collection=MyCollection, net.peer.port=27017, db.name=test, db.connection_string=mongodb://localhost:27017, net.peer.name=localhost, db.statement={"insert": "MyCollection", "ordered": "?", "txnNumber": "?", "$db": "?", "$clusterTime": {"clusterTime": "?", "signature": {"hash": "?", "keyId": "?"}}, "lsid": {"id": "?"}, "documents": [{"_id": "?", "name": "?", "createdAt": "?", "updatedAt": "?"}]}, db.system=mongodb}, capacity=128, totalAddedValues=8}
|
|
|
|
-```
|
|
|