Errorsedit

An error record represents one error event, captured by Elastic APM agents within one service. It is identified by a unique ID.

Some of the key attributes of an error are described in more detail:

Contextedit

An event’s context bundles information regarding the environment in which it is recorded. It describes the service in which the event is captured, the system in which the monitored service is running and the event’s process information.

It can also contain information about the authenticated user.

An event’s context can also include information about the request leading to the event and the response of processing the event. In case a http request is captured, it contains information about the url, cookies, body, headers, etc.

The agents provide some configuration options with which the users can also capture customized information. The non-indexed information is captured within a custom object, while the searchable information is stored within tags.

The context information is defined for transaction and error events.

Erroredit

An error event contains at least information about the original exception that occured or information about a log that was created when the exception occured.

Both the captured exception and the captured log of an error can contain stack trace information, helpful for debugging an error.

The culprit of an error gives some information about the origin of the error.

Errors also contain a grouping_key which can be used to group together identical or similar errors.

An error can be mapped to the transaction during which it happened, via the transaction.id, indexed together with the error event.

Example documentedit

{
    "context": {
        "custom": {
            "and_objects": {
                "foo": [
                    "bar",
                    "baz"
                ]
            },
            "my_key": 1,
            "some_other_value": "foo bar"
        },
        "process": {
            "argv": [
                "node",
                "server.js"
            ],
            "pid": 1234,
            "title": "node"
        },
        "request": {
            "body": "Hello World",
            "cookies": {
                "c1": "v1",
                "c2": "v2"
            },
            "env": {
                "GATEWAY_INTERFACE": "CGI/1.1",
                "SERVER_SOFTWARE": "nginx"
            },
            "headers": {
                "array": [
                    "foo",
                    "bar",
                    "baz"
                ],
                "content-type": "text/html",
                "cookie": "c1=v1; c2=v2",
                "some-other-header": "foo",
                "user-agent": "Mozilla Chrome Edge"
            },
            "http_version": "1.1",
            "method": "POST",
            "socket": {
                "encrypted": true,
                "remote_address": "12.53.12.1"
            },
            "url": {
                "full": "https://www.example.com/p/a/t/h?query=string#hash",
                "hash": "#hash",
                "hostname": "www.example.com",
                "pathname": "/p/a/t/h",
                "port": "8080",
                "protocol": "https:",
                "raw": "/p/a/t/h?query=string#hash",
                "search": "?query=string"
            }
        },
        "response": {
            "finished": true,
            "headers": {
                "content-type": "application/json"
            },
            "headers_sent": true,
            "status_code": 200
        },
        "service": {
            "agent": {
                "name": "elastic-node",
                "version": "3.14.0"
            },
            "environment": "staging",
            "framework": {
                "name": "Express",
                "version": "1.2.3"
            },
            "language": {
                "name": "ecmascript",
                "version": "8"
            },
            "name": "1234_service-12a3",
            "runtime": {
                "name": "node",
                "version": "8.0.0"
            },
            "version": "5.1.3"
        },
        "system": {
            "architecture": "x64",
            "hostname": "prod1.example.com",
            "platform": "darwin"
        },
        "tags": {
            "organization_uuid": "9f0e9d64-c185-4d21-a6f4-4673ed561ec8"
        },
        "user": {
            "email": "foo@example.com",
            "id": 99,
            "username": "foo"
        }
    },
    "error": {
        "culprit": "my.module.function_name",
        "exception": {
            "attributes": {
                "foo": "bar"
            },
            "code": "42",
            "handled": false,
            "message": "The username root is unknown",
            "module": "__builtins__",
            "stacktrace": [
                {
                    "abs_path": "/real/file/name.py",
                    "context": {
                        "post": [
                            "line4",
                            "line5"
                        ],
                        "pre": [
                            "line1",
                            "line2"
                        ]
                    },
                    "exclude_from_grouping": false,
                    "filename": "file/name.py",
                    "function": "foo",
                    "library_frame": true,
                    "line": {
                        "column": 4,
                        "context": "line3",
                        "number": 3
                    },
                    "module": "App::MyModule",
                    "vars": {
                        "key": "value"
                    }
                },
                {
                    "abs_path": "/Users/watson/code/node_modules/elastic/lib/instrumentation/index.js",
                    "context": {
                        "post": [
                            "    ins.currentTransaction = prev",
                            "    return result",
                            "}",
                            "}",
                            "",
                            "Instrumentation.prototype._recoverTransaction = function (trans) {",
                            "  if (this.currentTransaction === trans) return"
                        ],
                        "pre": [
                            "  var trans = this.currentTransaction",
                            "",
                            "  return instrumented",
                            "",
                            "  function instrumented () {",
                            "    var prev = ins.currentTransaction",
                            "    ins.currentTransaction = trans"
                        ]
                    },
                    "exclude_from_grouping": false,
                    "filename": "lib/instrumentation/index.js",
                    "function": "instrumented",
                    "line": {
                        "context": "    var result = original.apply(this, arguments)",
                        "number": 102
                    },
                    "vars": {
                        "key": "value"
                    }
                }
            ],
            "type": "DbError"
        },
        "grouping_key": "50f62f37edffc4630c6655ba3ecfcf46",
        "id": "9f0e9d64-c185-4d21-a6f4-4673ed561ec8",
        "log": {
            "level": "warning",
            "logger_name": "my.logger.name",
            "message": "My service could not talk to the database named foobar",
            "param_message": "My service could not talk to the database named %s",
            "stacktrace": [
                {
                    "abs_path": "/real/file/name.py",
                    "context": {
                        "post": [
                            "line4",
                            "line5"
                        ],
                        "pre": [
                            "line1",
                            "line2"
                        ]
                    },
                    "exclude_from_grouping": false,
                    "filename": "/webpack/file/name.py",
                    "function": "foo",
                    "library_frame": false,
                    "line": {
                        "column": 4,
                        "context": "line3",
                        "number": 3
                    },
                    "module": "App::MyModule",
                    "vars": {
                        "key": "value"
                    }
                },
                {
                    "abs_path": "/Users/watson/code/node_modules/elastic/lib/instrumentation/index.js",
                    "context": {
                        "post": [
                            "    ins.currentTransaction = prev",
                            "    return result",
                            "}",
                            "}",
                            "",
                            "Instrumentation.prototype._recoverTransaction = function (trans) {",
                            "  if (this.currentTransaction === trans) return"
                        ],
                        "pre": [
                            "  var trans = this.currentTransaction",
                            "",
                            "  return instrumented",
                            "",
                            "  function instrumented () {",
                            "    var prev = ins.currentTransaction",
                            "    ins.currentTransaction = trans"
                        ]
                    },
                    "exclude_from_grouping": false,
                    "filename": "lib/instrumentation/index.js",
                    "function": "instrumented",
                    "line": {
                        "context": "    var result = original.apply(this, arguments)",
                        "number": 102
                    },
                    "vars": {
                        "key": "value"
                    }
                }
            ]
        }
    },
    "processor": {
        "event": "error",
        "name": "error"
    },
    "transaction": {
        "id": "945254c5-67a5-417e-8a4e-aa29efcbfb79"
    }
}