Class MongoTelemetry
java.lang.Object
io.opentelemetry.instrumentation.mongo.v3_1.MongoTelemetry
Entrypoint to OpenTelemetry instrumentation of the MongoDB client.
-
Method Summary
Modifier and TypeMethodDescriptionstatic MongoTelemetryBuilderbuilder(io.opentelemetry.api.OpenTelemetry openTelemetry) Returns a newMongoTelemetryBuilderconfigured with the givenOpenTelemetry.static MongoTelemetrycreate(io.opentelemetry.api.OpenTelemetry openTelemetry) Returns a newMongoTelemetryconfigured with the givenOpenTelemetry.com.mongodb.event.CommandListenerReturns a newCommandListenerthat can be used with methods likeMongoClientOptions.Builder.addCommandListener(CommandListener).com.mongodb.event.CommandListenercreateCommandListener(List<com.mongodb.ServerAddress> configuredServerAddresses) Returns a newCommandListenerusing the supplied seed list to derive the client's logical MongoDB server target.
-
Method Details
-
create
Returns a newMongoTelemetryconfigured with the givenOpenTelemetry. -
builder
Returns a newMongoTelemetryBuilderconfigured with the givenOpenTelemetry. -
createCommandListener
public com.mongodb.event.CommandListener createCommandListener(List<com.mongodb.ServerAddress> configuredServerAddresses) Returns a newCommandListenerusing the supplied seed list to derive the client's logical MongoDB server target.Use this overload when you have the seed addresses from the client's configuration. Pass the complete seed list used to configure the client.
The supplied addresses are used to derive the stable
server.addressandserver.portattributes when stable database semantic conventions are enabled.Where the old database conventions are emitted,
db.connection_stringcontinues to describe the server selected by the driver.- Parameters:
configuredServerAddresses- all seed addresses configured for the client- Returns:
- a command listener
-
createCommandListener
public com.mongodb.event.CommandListener createCommandListener()Returns a newCommandListenerthat can be used with methods likeMongoClientOptions.Builder.addCommandListener(CommandListener).Use this method only when the client's configured seed addresses are not available. If they are available, use
createCommandListener(List)so that stable database semantic conventions can deriveserver.addressandserver.portfrom the configured target.
-