Skip to content

Conversation

@StephanRichter
Copy link

This option allows to re-use an already established database connection
instead of building a new one in conjunctino with the Reporter.Builder.

This will allow something like:

// existing code
ServerAddress addr = new ServerAddress("localhost", 27017);
MongoCredential credential = MongoCredential.createCredential("user", "coll", "pass".toCharArray());
MongoClientOptions options = new MongoClientOptions.Builder().build();
MongoClient mongoClient = new MongoClient(addr, credential, options);
MongoDatabase mongoDB = mongoClient.getDatabase("coll");

// ...

// metrics added to code already unsing database
MongoDBReporter reporter = MongoDBReporter.forRegistry(metrics).connect(mongoDB).build();

This option allows to re-use an already established database connection
instead of building a new one in conjunctino with the Reporter.Builder.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant