Transactionsedit

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

Transaction Schemaedit

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

{
    "$id": "docs/spec/transactions/common_transaction.json",
    "type": "object",
    "description": "Data captured by an agent representing an event occurring in a monitored service",
    "properties": {
        "context": {
            "$ref": "../context.json"
        },
        "duration": {
            "type": "number",
            "description": "How long the transaction took to complete, in ms with 3 decimal points"
        },
        "name": {
            "type": ["string","null"],
            "description": "Generic designation of a transaction in the scope of a single service (eg: 'GET /users/:id')",
            "maxLength": 1024
        },
        "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
        },
        "type": {
            "type": "string",
            "description": "Keyword of specific relevance in the service's domain (eg: 'request', 'backgroundjob', etc)",
            "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": ["duration", "type"]
}
{
    "$id": "docs/spec/transactions/v2_transaction.json",
    "type": "object",
    "description": "An event corresponding to an incoming request or similar task occurring in a monitored service",
    "allOf": [
        { "$ref": "common_transaction.json"  },
        { "$ref": "../timestamp_epoch.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"]
                }
            },
            "required": ["id", "trace_id", "span_count"]
        }
    ]
}