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

Gauge mapping errors #10

Open
nilsga opened this issue Oct 29, 2014 · 5 comments
Open

Gauge mapping errors #10

nilsga opened this issue Oct 29, 2014 · 5 comments

Comments

@nilsga
Copy link

nilsga commented Oct 29, 2014

When the dynamic mapping has created the mapping for a gauge of type T, other gauges of other types fails with mapping errors.

@nilsga nilsga closed this as completed Oct 29, 2014
@nilsga nilsga changed the title Mapping for Gauge is too constrained Ignore Oct 29, 2014
@nilsga nilsga reopened this Oct 29, 2014
@nilsga nilsga changed the title Ignore Gauge mapping errors Oct 29, 2014
@nilsga
Copy link
Author

nilsga commented Oct 29, 2014

One solution might be to have a Gauge-mapping for each data type.

@spinscale
Copy link
Contributor

do you have an example I could use for a failing test here?

@Nycander
Copy link

I stumbled upon this bug while tryingon elasticsearch-metrics-reporter in a http://www.dropwizard.io installation. Seems to be quite common for gauges with different value types.

Tried to create a failing test here, sometimes there's an exception on the output, but I failed to reproduce it consistently and assert on it since the exception happens inside elasticsearch.
Nycander@5f12d4f#diff-fc3406b0dc3bcd74bc9935e07f6b862fR242

Anyway, when the problem is that elasticsearch automatically creates a mapping for the first value, which is a double:

  "gauge" : {
    "_all" : {
      "enabled" : false
    },
    "properties" : {
      "@timestamp" : {
        "type" : "date",
        "format" : "dateOptionalTime"
      },
      "name" : {
        "type" : "string",
        "index" : "not_analyzed"
      },
      "value" : {
        "type" : "double"
      }
    }
  }

When lateron a gauge comes along with a string value, the following exception is thrown in elasticsearch:

[2015-10-11 11:04:26,572][DEBUG][action.bulk              ] [Maur-Konn] [metrics-2015-10][0] failed to execute bulk item (index) index {[metrics-2015-10][gauge][AVBWJNfILvCCGXSkD87d], source[{"name":"jvm.attribute.vendor","@timestamp":"2015-10-11T09:04:26.000+0000","value":"Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.51-b03 (1.8)"}]}
org.elasticsearch.index.mapper.MapperParsingException: failed to parse [value]
    at org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:409)
    at org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:706)
    at org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:497)
    at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:544)
    at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:493)
    at org.elasticsearch.index.shard.IndexShard.prepareCreate(IndexShard.java:453)
    at org.elasticsearch.action.bulk.TransportShardBulkAction.shardIndexOperation(TransportShardBulkAction.java:432)
    at org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:149)
    at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:515)
    at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:422)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NumberFormatException: For input string: "Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.51-b03 (1.8)"
    at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
    at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
    at java.lang.Double.parseDouble(Double.java:538)
    at org.elasticsearch.common.xcontent.support.AbstractXContentParser.doubleValue(AbstractXContentParser.java:182)
    at org.elasticsearch.index.mapper.core.DoubleFieldMapper.innerParseCreateField(DoubleFieldMapper.java:310)
    at org.elasticsearch.index.mapper.core.NumberFieldMapper.parseCreateField(NumberFieldMapper.java:236)
    at org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:399)
    ... 12 more

and the gauge is lost :(

@davidkarlsen
Copy link
Contributor

Stagemonitor seems to use an approach where the value is mapped to a given type: https://www.elastic.co/blog/elasticsearch-as-a-time-series-data-store (value, value_string, value_boolean)

@static-max
Copy link

I created a PR for this: #49

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

No branches or pull requests

5 participants