Transactionsedit

A transaction represents one event, captured by an Elastic APM agent within one service. It is identified by a unique ID.

Within one transaction several spans can be captured, which have a transaction.id as a referrer to the transaction they belong to.

A transaction at least holds information about when the event started and the duration until it completed, as well as information about the kind of the event. A transaction can for example be a single HTTP request or an asynchrounous background job within one service.

Some of the key attributes of a transaction 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.

Transactionedit

The information available within the transaction group includes the duration of the transaction, a unique id, the type and an automatically retrieved name, as well as an indication whether or not the transaction was handled successfully. The transaction can also contain:

  • sampled: if a transaction was sampled, the spans of the transaction were captured and are available as seperate documents
  • span_count.dropped: how many spans have not been captured, according to configuration on the agent side
  • marks: captures the timing in milliseconds of a significant event during the lifetime of a transaction, set by the user or the agent

Example documentedit

{
    "context": {
        "custom": {
            "and_objects": {
                "foo": [
                    "bar",
                    "baz"
                ]
            },
            "my_key": 1,
            "some_other_value": "foo bar"
        },
        "process": {
            "argv": [
                "node",
                "server.js"
            ],
            "pid": 1234,
            "ppid": 6789,
            "title": "node"
        },
        "request": {
            "body": {
                "additional": {
                    "bar": 123,
                    "req": "additional information"
                },
                "str": "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"
        }
    },
    "processor": {
        "event": "transaction",
        "name": "transaction"
    },
    "transaction": {
        "duration": {
            "us": 32592
        },
        "id": "945254c5-67a5-417e-8a4e-aa29efcbfb79",
        "marks": {
            "navigationTiming": {
                "appBeforeBootstrap": 608.930000,
                "navigationStart": -21
            }
        },
        "name": "GET /api/types",
        "result": "success",
        "sampled": true,
        "span_count": {
            "dropped": {
                "total": 2
            }
        },
        "type": "request"
    }
}