Skip to content

Create an Elasticsearch component template for the metrics_template #6001

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

Open
filiphr opened this issue Mar 6, 2025 · 0 comments
Open

Create an Elasticsearch component template for the metrics_template #6001

filiphr opened this issue Mar 6, 2025 · 0 comments

Comments

@filiphr
Copy link
Contributor

filiphr commented Mar 6, 2025

Please describe the feature request.
Elasticsearch has support for 2 types of templates, an index template (what the ElasticMeterRegistry is using) and Component Templates. Component templates allow you to create an index template consisted of multiple different components.

Rationale
The reason for this change request is the fact that we would like to apply a lifecycle policy for the metrics template. The way to achieve this is by using an index template that looks like:

{
  "index_patterns": ["micrometer-metrics-*"], 
  "template": {
    "settings": {
      "index.lifecycle.name": "micrometer-metrics-lifecycle-policy"
    }
  }
}

However, this would fail as there is already a registered metrics template from Micrometer called metrics_template.
We could circumvent this failure, by adding a priority, but then the template with the highest priority would take precedence, and this is not what we want, we want to combine the both index templates.

One way would be to copy the Micrometer template, but then we need to keep maintaining that with every Micrometer release.

If Micrometer registers a component template then we can use a template that looks like:

{
  "index_patterns": ["micrometer-metrics-*"], 
  "priority": 1,
  "composed_of": [ "micrometer_metrics_template" ],
  "template": {
    "settings": {
      "index.lifecycle.name": "micrometer-metrics-lifecycle-policy"
    }
  }

With this approach, when Micrometer changes the template we don't need to do anything, it will just be applied automatically on all the new indices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant