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

ElasticMeterRegistry: template index pattern is hardcoded to metrics* #2196

Closed
micheljung opened this issue Jul 20, 2020 · 2 comments
Closed
Labels
bug A general bug registry: elastic An ElasticSearch Registry related issue
Milestone

Comments

@micheljung
Copy link

The index name is configurable:

protected String indexName() {
ZonedDateTime dt = ZonedDateTime.ofInstant(new Date(config().clock().wallTime()).toInstant(), ZoneOffset.UTC);
return config.index() + config.indexDateSeparator() + indexDateFormatter.format(dt);
}

However, the index pattern in the template is not:

private static final String TEMPLATE_BODY_BEFORE_VERSION_7 = "{\"template\":\"metrics*\",\"mappings\":{\"_default_\":{\"_all\":{\"enabled\":false}," + TEMPLATE_PROPERTIES + "}}}";
private static final String TEMPLATE_BODY_AFTER_VERSION_7 = "{\n" +
" \"index_patterns\": [\"metrics*\"],\n" +

This results in two issues:

  1. If my custom index-pattern doesn't start with metrics, the template won't apply
  2. The template pattern metrics* is too broad and prevents me from using indices like metrics-something-* in other applications (in my case, the config of _source breaks the other application. See Configurable _source.enabled Elastic mapping property #1629)

Making the template index-pattern configurable solves these issues.

@izeye
Copy link
Contributor

izeye commented Jul 20, 2020

@micheljung Thanks for the issue. This seems to be an oversight. I created #2197 to try to resolve this.

@micheljung
Copy link
Author

Thanks for the quick fix! #2197 looks exactly as it should be :-)

@shakuzen shakuzen added bug A general bug registry: elastic An ElasticSearch Registry related issue labels Sep 17, 2020
@shakuzen shakuzen added this to the 1.1.18 milestone Sep 17, 2020
@shakuzen shakuzen changed the title ElasticMeterRegistry: Make template index pattern configurable ElasticMeterRegistry: template index pattern is hardcoded to metrics* Sep 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A general bug registry: elastic An ElasticSearch Registry related issue
Projects
None yet
Development

No branches or pull requests

3 participants