Span Indicesedit

Spans are stored in separate indices of the format apm-[version]-span-[date]. Conceptually, spans are part of transactions.

Example documentsedit

See how span documents can look like when indexed in Elasticsearch:

[
    {
        "parent": {
            "id": "945254c567a5417e"
        },
        "transaction": {
            "id": "945254c567a5417e"
        },
        "span": {
            "stacktrace": [
                {
                    "function": "onread",
                    "abs_path": "net.js",
                    "vars": {
                        "key": "value"
                    },
                    "module": "some module",
                    "exclude_from_grouping": false,
                    "filename": "net.js",
                    "library_frame": true,
                    "context": {
                        "pre": [
                            "  var trans = this.currentTransaction",
                            ""
                        ],
                        "post": [
                            "    ins.currentTransaction = prev",
                            "    return result",
                            "}"
                        ]
                    },
                    "line": {
                        "column": 4,
                        "number": 547,
                        "context": "line3"
                    }
                },
                {
                    "line": {
                        "number": 10
                    },
                    "exclude_from_grouping": false,
                    "filename": "my2file.js"
                }
            ],
            "http": {
                "url": {
                    "original": "http://localhost:8000"
                },
                "method": "get",
                "response": {
                    "status_code": 200
                }
            },
            "name": "SELECT FROM product_types",
            "start": {
                "us": 2830
            },
            "db": {
                "instance": "customers",
                "type": "sql",
                "user": {
                    "name": "readonly_user"
                },
                "statement": "SELECT * FROM product_types WHERE user_id=?"
            },
            "sync": false,
            "action": "query",
            "subtype": "postgresql",
            "duration": {
                "us": 3781
            },
            "type": "db",
            "id": "0aaaaaaaaaaaaaaa"
        },
        "trace": {
            "id": "945254c567a5417eaaaaaaaaaaaaaaaa"
        },
        "observer": {
            "ephemeral_id": "b0eca9b8-818a-40af-89d9-52ce62270ecf",
            "version_major": 8,
            "hostname": "alloy",
            "version": "8.0.0",
            "type": "apm-server",
            "id": "6c887131-df07-4f05-a69d-e60897ccbb64"
        },
        "timestamp": {
            "us": 1496170407154000
        },
        "@timestamp": "2017-05-30T18:53:27.154Z",
        "labels": {
            "span_tag": "something"
        },
        "agent": {
            "version": "3.14.0",
            "name": "elastic-node"
        },
        "service": {
            "environment": "staging",
            "name": "1234_service-12a3"
        },
        "ecs": {
            "version": "1.5.0"
        },
        "processor": {
            "name": "transaction",
            "event": "span"
        }
    },
    {
        "parent": {
            "id": "85925e55b43f4342"
        },
        "transaction": {
            "id": "85925e55b43f4342"
        },
        "span": {
            "name": "SELECT FROM product_types",
            "start": {
                "us": 2830
            },
            "destination": {
                "service": {
                    "type": "db",
                    "resource": "postgresql",
                    "name": "postgresql"
                }
            },
            "db": {
                "instance": "customers",
                "type": "sql",
                "user": {
                    "name": "readonly_user"
                },
                "statement": "SELECT * FROM product_types WHERE user_id=?"
            },
            "id": "15aaaaaaaaaaaaaa",
            "subtype": "postgresql",
            "duration": {
                "us": 3781
            },
            "type": "db.postgresql.query",
            "action": "query.custom"
        },
        "trace": {
            "id": "85925e55b43f4342aaaaaaaaaaaaaaaa"
        },
        "observer": {
            "ephemeral_id": "b0eca9b8-818a-40af-89d9-52ce62270ecf",
            "version_major": 8,
            "hostname": "alloy",
            "version": "8.0.0",
            "type": "apm-server",
            "id": "6c887131-df07-4f05-a69d-e60897ccbb64"
        },
        "timestamp": {
            "us": 1496170422281000
        },
        "@timestamp": "2017-05-30T18:53:42.281Z",
        "destination": {
            "ip": "0:0::0:1",
            "port": 5432,
            "address": "0:0::0:1"
        },
        "agent": {
            "version": "1.3",
            "name": "js-base"
        },
        "service": {
            "environment": "staging",
            "name": "serviceabc"
        },
        "ecs": {
            "version": "1.5.0"
        },
        "processor": {
            "name": "transaction",
            "event": "span"
        }
    },
    {
        "parent": {
            "id": "945254c567a5417e"
        },
        "transaction": {
            "id": "945254c567a5417e"
        },
        "span": {
            "name": "GET /api/types",
            "start": {
                "us": 0
            },
            "subtype": "external",
            "duration": {
                "us": 32592
            },
            "type": "request",
            "id": "1aaaaaaaaaaaaaaa"
        },
        "trace": {
            "id": "945254c567a5417eaaaaaaaaaaaaaaaa"
        },
        "observer": {
            "ephemeral_id": "b0eca9b8-818a-40af-89d9-52ce62270ecf",
            "version_major": 8,
            "hostname": "alloy",
            "version": "8.0.0",
            "type": "apm-server",
            "id": "6c887131-df07-4f05-a69d-e60897ccbb64"
        },
        "timestamp": {
            "us": 1496170407154000
        },
        "@timestamp": "2017-05-30T18:53:27.154Z",
        "agent": {
            "version": "3.14.0",
            "name": "elastic-node"
        },
        "service": {
            "environment": "staging",
            "name": "1234_service-12a3"
        },
        "ecs": {
            "version": "1.5.0"
        },
        "processor": {
            "name": "transaction",
            "event": "span"
        }
    },
    {
        "parent": {
            "id": "945254c567a5417e"
        },
        "transaction": {
            "id": "945254c567a5417e"
        },
        "span": {
            "name": "GET /api/types",
            "start": {
                "us": 1845
            },
            "subtype": "http",
            "action": "post",
            "duration": {
                "us": 3564
            },
            "type": "request",
            "id": "2aaaaaaaaaaaaaaa"
        },
        "trace": {
            "id": "945254c567a5417eaaaaaaaaaaaaaaaa"
        },
        "observer": {
            "ephemeral_id": "b0eca9b8-818a-40af-89d9-52ce62270ecf",
            "version_major": 8,
            "hostname": "alloy",
            "version": "8.0.0",
            "type": "apm-server",
            "id": "6c887131-df07-4f05-a69d-e60897ccbb64"
        },
        "timestamp": {
            "us": 1496170407154000
        },
        "@timestamp": "2017-05-30T18:53:27.154Z",
        "agent": {
            "version": "3.14.0",
            "name": "elastic-node"
        },
        "service": {
            "environment": "staging",
            "name": "1234_service-12a3"
        },
        "ecs": {
            "version": "1.5.0"
        },
        "processor": {
            "name": "transaction",
            "event": "span"
        }
    },
    {
        "parent": {
            "id": "945254c567a5417e"
        },
        "transaction": {
            "id": "945254c567a5417e"
        },
        "span": {
            "duration": {
                "us": 13980
            },
            "start": {
                "us": 0
            },
            "type": "request",
            "name": "GET /api/types",
            "id": "3aaaaaaaaaaaaaaa"
        },
        "trace": {
            "id": "945254c567a5417eaaaaaaaaaaaaaaaa"
        },
        "observer": {
            "ephemeral_id": "b0eca9b8-818a-40af-89d9-52ce62270ecf",
            "version_major": 8,
            "hostname": "alloy",
            "version": "8.0.0",
            "type": "apm-server",
            "id": "6c887131-df07-4f05-a69d-e60897ccbb64"
        },
        "timestamp": {
            "us": 1496170407154000
        },
        "@timestamp": "2017-05-30T18:53:27.154Z",
        "agent": {
            "version": "3.14.0",
            "name": "elastic-node"
        },
        "service": {
            "environment": "staging",
            "name": "1234_service-12a3"
        },
        "ecs": {
            "version": "1.5.0"
        },
        "processor": {
            "name": "transaction",
            "event": "span"
        }
    }
]