elastic/elasticsearch-metrics-reporter-java

Custom configurable fields

Closed this issue · 3 comments

It would be nice to add custom fields. For example:

final MetricRegistry registry = new MetricRegistry();
ElasticsearchReporter reporter = ElasticsearchReporter.forRegistry(registry)
    .hosts("localhost:9200", "localhost:9201")
    .addField("application", "my-app")
    .build();
reporter.start(60, TimeUnit.SECONDS);

Or even, dynamic fields:

final Callable<Long> timeSinceStartup = new Callable<Long>() {
    public Long call() {
        return /* whatever */; 
    }
};
final MetricRegistry registry = new MetricRegistry();
ElasticsearchReporter reporter = ElasticsearchReporter.forRegistry(registry)
    .hosts("localhost:9200", "localhost:9201")
    .addDynamicField("time-since-startup", timeSinceStartup)
    .build();
reporter.start(60, TimeUnit.SECONDS);
bacar commented

Would love this too. I'd like to add things like the host, process name & PID that's sending metrics.

Indeed. Would you be up for a pull request for this one?

Duplicate #8?