Skip to content

When reading numeric strings from an Elasticsearch store with --es.tags-as-fields.all, the string is parsed as a number #1236

Closed
@ScottKaye

Description

Requirement - what kind of business use case are you trying to solve?

There seems to be a bug similar to jaegertracing/jaeger-ui#146, which may now relate to #1018. I am using Elasticsearch as my span store, with ES_TAGS_AS_FIELDS_ALL=true. This stores spans like this:

{
    "traceID": "bb62383fdf565f55",
    "spanID": "bb62383fdf565f55",
    "operationName": "operation",
    "references": [],
    "flags": 1,
    "startTime": 1543345090571024,
    "startTimeMillis": 1543345090571,
    "duration": 420980,
    "tag": {
        "sampler@type": "const",
        "sampler@param": "True",
        "identifier": "000045"
    },
    "logs": [],
    "process": {
        "serviceName": "ui",
        "tag": {
            "jaeger@version": "CSharp-0.2.2.0",
            "hostname": "local",
            "ip": "10.1.1.1"
        }
    }
}

Here's the relevant part of the index mapping, showing that identifier is mapped as a keyword (string), rather than a number.

{
    "span": {
        "properties": {
            "tag": {
                "properties": {
                    "identifier": {
                        "type": "keyword",
                        "ignore_above": 256
                    },
                    "sampler@param": {
                        "type": "keyword",
                        "ignore_above": 256
                    },
                    "sampler@type": {
                        "type": "keyword",
                        "ignore_above": 256
                    }
                }
            }
        }
    }
}

Problem - what in Jaeger blocks you from solving the requirement?

However when I open this span in Jaeger UI,

The string is parsed as a number, resulting in the zeroes (padding) being truncated. Users copying and pasting the identifier value into another tool to search for aren't getting the correct results until they manually pad the number.

Proposal - what do you suggest to solve the problem or improve the existing situation?

If there is any way to read the Elasticsearch type mapped to the value at query time, a value of "keyword" would represent a string. The mapping can be pulled with GET localhost:9200/jaeger-span*/_mapping/span/field/tag.identifier, which returns

{
    "jaeger-span-2018-11-27": {
        "mappings": {
            "span": {
                "tag.identifier": {
                    "full_name": "tag.identifier",
                    "mapping": {
                        "identifier": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    }
                }
            }
        }
    }
}

Prefixing the identifiers with anything non-numeric keeps the string format and works, though users have to now remove the extra character before searching.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions