question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Spring Boot 2.2.0 with Micrometer 1.3.0 for ElasticSearch 7.1 not working

See original GitHub issue

I’m trying to get the basic metrics into the ElasticSearch index on AWS. I’m using Spring Boot 2.2.0 with WebFlux. For Micrometer I’m using Elastic Registry 1.3.0. After starting the app, I’m getting these errors on the app side:

2019-11-04 10:56:24.495 ERROR 1510 --- [trics-publisher] i.m.elastic.ElasticMeterRegistry : failed to send metrics to elastic (sent 55 metrics but created 0 metrics):
{
    "took": 0,
    "errors": true,
    "items": [
        {
            "index": {
                "_index": "",
                "_type": "metrics-2019-11",
                "_id": null,
                "status": 500,
                "error": {
                    "type": "string_index_out_of_bounds_exception",
                    "reason": "String index out of range: 0"
                }
            }
        }, ...

And on the ElasticSearch side, the error is this:

[2019-11-04T02:48:01,553][WARN ][r.suppressed ] [76ba019e12d26993bb1160a3b9e7e9b0] path: __PATH__ params: {index=, id=metrics_template, type=_template}
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(String.java:658) ~[?:1.8.0_172]
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.validateIndexOrAliasName(MetaDataCreateIndexService.java:172) ~[elasticsearch-7.1.1.jar:7.1.1]
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.validateIndexName(MetaDataCreateIndexService.java:144) ~[elasticsearch-7.1.1.jar:7.1.1]
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.validate(MetaDataCreateIndexService.java:608) ~[elasticsearch-7.1.1.jar:7.1.1]
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService$IndexCreationTask.execute(MetaDataCreateIndexService.java:286) ~[elasticsearch-7.1.1.jar:7.1.1]
at org.elasticsearch.cluster.ClusterStateUpdateTask.execute(ClusterStateUpdateTask.java:47) ~[elasticsearch-7.1.1.jar:7.1.1]
at org.elasticsearch.cluster.service.MasterService.executeTasks(MasterService.java:687) ~[elasticsearch-7.1.1.jar:7.1.1]
at org.elasticsearch.cluster.service.MasterService.calculateTaskOutputs(MasterService.java:310) ~[elasticsearch-7.1.1.jar:7.1.1]
at org.elasticsearch.cluster.service.MasterService.runTasks(MasterService.java:210) [elasticsearch-7.1.1.jar:7.1.1]
at org.elasticsearch.cluster.service.MasterService$Batcher.run(MasterService.java:142) [elasticsearch-7.1.1.jar:7.1.1]
at org.elasticsearch.cluster.service.TaskBatcher.runIfNotProcessed(TaskBatcher.java:150) [elasticsearch-7.1.1.jar:7.1.1]
at org.elasticsearch.cluster.service.TaskBatcher$BatchedTask.run(TaskBatcher.java:188) [elasticsearch-7.1.1.jar:7.1.1]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:690) [elasticsearch-7.1.1.jar:7.1.1]
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:252) [elasticsearch-7.1.1.jar:7.1.1]
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:215) [elasticsearch-7.1.1.jar:7.1.1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_172]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_172]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_172]

I did a basic endpoint configuration and that is all. I also tried setting the index name into the application.yml but it did not help.

Any ideas on how to overcome this issue?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
kvaidascommented, Jan 2, 2020

I might have had this issue recently which I think I solved by removing a trailing forward slash in management.metrics.export.elastic.host.

2reactions
nemanjanediccommented, Nov 7, 2019

Sorry for not able to answer before. I did manage to make this working with the latest standalone version of ElasticSearch (7.4.2) with the Bitnami AWS image. If I have time in the upcoming weeks, I’ll create a sample app with the AWS managed ELK stack.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Elasticsearch not working after spring-boot upgrade to 2.2.0 ...
You could be facing this issue. I was trying to test and have below pom - adjusted as per your build file
Read more >
Spring Boot Reference Documentation
Try the How-to documents. They provide solutions to the most common questions. Learn the Spring basics. Spring Boot builds on many other Spring...
Read more >
Spring Boot Reference Documentation
Spring Boot provides an alternative method of working with properties that lets strongly typed beans govern and validate the configuration of your application....
Read more >
Spring Boot Reference Documentation
Try the How-to documents. They provide solutions to the most common questions. • Learn the Spring basics. Spring Boot builds on many other...
Read more >
Spring Boot 2.7.0 available now
I am too facing similar kind of problem, post upgrade from 2.6.7 to 2.7.0 but its very hard to confirm this is a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found