elastic / elasticsearch-metrics-reporter-java

Metrics reporter, which reports to elasticsearch
Apache License 2.0
230 stars 103 forks source link

Reporter shouldn't attempt to send anything if there are no metrics collected yet #18

Closed bacar closed 8 years ago

bacar commented 8 years ago

If there are no metrics available yet, the reporter sends an empty document to elastic, which results in an HTTP error from elastic. The send should be bypassed if there's nothing to send yet.

The response from elastic is:

HTTP/1.1 400 Bad Request
{"error":"ElasticsearchParseException[Failed to derive xcontent]","status":400}

And my logs are littered with:

2015-12-11 17:24:09,336 ERROR Reporting returned code 400 Bad Request: {} [metrics-elasticsearch-reporter-thread-1] (org.elasticsearch.metrics.ElasticsearchReporter) [] - [/]
JakobFels commented 8 years ago

It seems to be fixed with commit 6e4405565a7d4cf47bc7ec3381662a3715ef8b9d but there hasn't been a release since then. One workaround is to create a metric on application start.

spinscale commented 8 years ago

just did a release where this is included