Skip to content
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

Make API more user friendly for non Dropwizard users #7

Open
billoneil opened this issue Jul 4, 2018 · 3 comments
Open

Make API more user friendly for non Dropwizard users #7

billoneil opened this issue Jul 4, 2018 · 3 comments

Comments

@billoneil
Copy link

It's a little difficult to use this library in applications that use dropwizard metrics without the rest of the framework. It would be more user friendly to add setters to the Factory classes so its possible to create them manually.

The following would make this much more convenient to use.

new InfluxDbWriter.Factory()
    .host(host)
    .port(port)
    .build(registry);

Even in the unit tests the way its constructed is a little awkward where it builds the object from a json string and deserializes it into the object since there is no access to set these parameters.

This also applies to the reporter factory.

@stuvie
Copy link

stuvie commented Mar 23, 2019

Hi @billoneil - how do you use this library in applications that use dropwizard metrics without the rest of the framework? If you can give me the starting point, maybe I can put together a solution and pull request. Thanks!

@billoneil
Copy link
Author

It's not a difficult change this library just needs to allow the user to manually construct the objects.

Currently, it assumes you have a yml configuration file and all the objects are wired up based on that.

@jeantil
Copy link

jeantil commented Jan 26, 2021

@stuvie I'm also interested in this feature, you can see an example of how reporters are directly configured and built in metrics documentation :
https://metrics.dropwizard.io/4.1.2/manual/collectd.html

if you want a more involved example, you can look at the apache james project:
https://github.com/apache/james-project/blob/master/server/container/metrics/metrics-es-reporter/src/main/java/org/apache/james/metrics/es/ESMetricReporter.java
I would like to be able to build the same class to plug influxdb instead of ES, for that I need to be able to programmatically set the configuration instead of relying on a jackson based injection (because james doen't use yaml files and doesn't deserialize its configuration through jackson).

Thus a classic java builder API would be just fine as @billoneil said

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

No branches or pull requests

3 participants