Transactions

edit

Transactions are events corresponding to an incoming request or similar task occurring in a monitored service.

Transaction Schema

edit

The APM Server uses JSON Schema for validating requests. The specification for transactions is defined below:

{
    "$id": "docs/spec/transactions/transaction.json",
    "type": "object",
    "description": "An event corresponding to an incoming request or similar task occurring in a monitored service",
    "allOf": [
        { "$ref": "../timestamp_epoch.json" },
        { "$ref": "../transaction_name.json" },
        { "$ref": "../transaction_type.json" },
        {
            "properties": {
                "id": {
                    "type": "string",
                    "description": "Hex encoded 64 random bits ID of the transaction.",
                    "maxLength": 1024
                },
                "trace_id": {
                    "description": "Hex encoded 128 random bits ID of the correlated trace.",
                    "type": "string",
                    "maxLength": 1024
                },
                "parent_id": {
                    "description": "Hex encoded 64 random bits ID of the parent transaction or span. Only root transactions of a trace do not have a parent_id, otherwise it needs to be set.",
                    "type": ["string", "null"],
                    "maxLength": 1024
                },
                "span_count": {
                    "type": "object",
                    "properties": {
                        "started": {
                            "type": "integer",
                            "description": "Number of correlated spans that are recorded."

                        },
                        "dropped": {
                            "type": ["integer","null"],
                            "description": "Number of spans that have been dropped by the agent recording the transaction."

                        }
                    },
                    "required": ["started"]
                },
                "context": {
                    "$ref": "../context.json"
                },
                "duration": {
                    "type": "number",
                    "description": "How long the transaction took to complete, in ms with 3 decimal points"
                },
                "result": {
                    "type": ["string", "null"],
                    "description": "The result of the transaction. For HTTP-related transactions, this should be the status code formatted like 'HTTP 2xx'.",
                    "maxLength": 1024
                },
                "marks": {
                    "type": ["object", "null"],
                    "description": "A mark captures the timing of a significant event during the lifetime of a transaction. Marks are organized into groups and can be set by the user or the agent.",
                    "patternProperties": {
                        "^[^.*\"]*$": {
                            "$ref": "mark.json"
                        }
                    },
                    "additionalProperties": false
                },
                "sampled": {
                    "type": ["boolean", "null"],
                    "description": "Transactions that are 'sampled' will include all available information. Transactions that are not sampled will not have 'spans' or 'context'. Defaults to true."
                }
            },
            "required": ["id", "trace_id", "span_count", "duration", "type"]
        }
    ]
}