From 580656d8fb774bd4d6afd81961da13feb80f0e01 Mon Sep 17 00:00:00 2001 From: Silvia Mitter Date: Mon, 11 Jan 2021 03:27:47 +0100 Subject: [PATCH] internal/apmschema: sync new jsonschema (#864) * Update to latest, simplified JSON schema * Adapt generator script --- internal/apmschema/jsonschema/cloud.json | 108 -- internal/apmschema/jsonschema/context.json | 70 - internal/apmschema/jsonschema/error.json | 1127 +++++++++++++++++ .../apmschema/jsonschema/errors/error.json | 154 --- .../apmschema/jsonschema/http_response.json | 35 - internal/apmschema/jsonschema/message.json | 43 - internal/apmschema/jsonschema/metadata.json | 670 +++++++--- internal/apmschema/jsonschema/metricset.json | 104 ++ .../jsonschema/metricsets/metricset.json | 32 - .../jsonschema/metricsets/sample.json | 10 - internal/apmschema/jsonschema/outcome.json | 7 - internal/apmschema/jsonschema/process.json | 28 - internal/apmschema/jsonschema/request.json | 103 -- .../apmschema/jsonschema/rum_experience.json | 23 - internal/apmschema/jsonschema/service.json | 96 -- .../jsonschema/sourcemaps/payload.json | 28 - internal/apmschema/jsonschema/span.json | 719 +++++++++++ .../apmschema/jsonschema/span_subtype.json | 12 - internal/apmschema/jsonschema/span_type.json | 12 - internal/apmschema/jsonschema/spans/span.json | 235 ---- .../jsonschema/stacktrace_frame.json | 69 - internal/apmschema/jsonschema/system.json | 74 -- internal/apmschema/jsonschema/tags.json | 13 - .../apmschema/jsonschema/timestamp_epoch.json | 12 - .../apmschema/jsonschema/transaction.json | 747 +++++++++++ .../jsonschema/transaction_name.json | 12 - .../jsonschema/transaction_type.json | 12 - .../jsonschema/transactions/mark.json | 11 - .../jsonschema/transactions/transaction.json | 84 -- internal/apmschema/jsonschema/user.json | 22 - internal/apmschema/schema.go | 8 +- internal/apmschema/update.sh | 33 +- 32 files changed, 3199 insertions(+), 1514 deletions(-) delete mode 100644 internal/apmschema/jsonschema/cloud.json delete mode 100644 internal/apmschema/jsonschema/context.json create mode 100644 internal/apmschema/jsonschema/error.json delete mode 100644 internal/apmschema/jsonschema/errors/error.json delete mode 100644 internal/apmschema/jsonschema/http_response.json delete mode 100644 internal/apmschema/jsonschema/message.json create mode 100644 internal/apmschema/jsonschema/metricset.json delete mode 100644 internal/apmschema/jsonschema/metricsets/metricset.json delete mode 100644 internal/apmschema/jsonschema/metricsets/sample.json delete mode 100644 internal/apmschema/jsonschema/outcome.json delete mode 100644 internal/apmschema/jsonschema/process.json delete mode 100644 internal/apmschema/jsonschema/request.json delete mode 100644 internal/apmschema/jsonschema/rum_experience.json delete mode 100644 internal/apmschema/jsonschema/service.json delete mode 100644 internal/apmschema/jsonschema/sourcemaps/payload.json create mode 100644 internal/apmschema/jsonschema/span.json delete mode 100644 internal/apmschema/jsonschema/span_subtype.json delete mode 100644 internal/apmschema/jsonschema/span_type.json delete mode 100644 internal/apmschema/jsonschema/spans/span.json delete mode 100644 internal/apmschema/jsonschema/stacktrace_frame.json delete mode 100644 internal/apmschema/jsonschema/system.json delete mode 100644 internal/apmschema/jsonschema/tags.json delete mode 100644 internal/apmschema/jsonschema/timestamp_epoch.json create mode 100644 internal/apmschema/jsonschema/transaction.json delete mode 100644 internal/apmschema/jsonschema/transaction_name.json delete mode 100644 internal/apmschema/jsonschema/transaction_type.json delete mode 100644 internal/apmschema/jsonschema/transactions/mark.json delete mode 100644 internal/apmschema/jsonschema/transactions/transaction.json delete mode 100644 internal/apmschema/jsonschema/user.json diff --git a/internal/apmschema/jsonschema/cloud.json b/internal/apmschema/jsonschema/cloud.json deleted file mode 100644 index 59fa1687a..000000000 --- a/internal/apmschema/jsonschema/cloud.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "$id": "docs/spec/cloud.json", - "title": "Cloud", - "type": [ - "object", - "null" - ], - "properties": { - "account": { - "properties": { - "id": { - "description": "Cloud account ID", - "type": [ - "string", - "null" - ], - "maxLength": 1024 - }, - "name": { - "description": "Cloud account name", - "type": [ - "string", - "null" - ], - "maxLength": 1024 - } - } - }, - "availability_zone": { - "description": "Cloud availability zone name. e.g. us-east-1a", - "type": [ - "string", - "null" - ], - "maxLength": 1024 - }, - "instance": { - "properties": { - "id": { - "description": "Cloud instance/machine ID", - "type": [ - "string", - "null" - ], - "maxLength": 1024 - }, - "name": { - "description": "Cloud instance/machine name", - "type": [ - "string", - "null" - ], - "maxLength": 1024 - } - } - }, - "machine": { - "properties": { - "type": { - "description": "Cloud instance/machine type", - "type": [ - "string", - "null" - ], - "maxLength": 1024 - } - } - }, - "project": { - "properties": { - "id": { - "description": "Cloud project ID", - "type": [ - "string", - "null" - ], - "maxLength": 1024 - }, - "name": { - "description": "Cloud project name", - "type": [ - "string", - "null" - ], - "maxLength": 1024 - } - } - }, - "provider": { - "description": "Cloud provider name. e.g. aws, azure, gcp, digitalocean.", - "type": [ - "string" - ], - "maxLength": 1024 - }, - "region": { - "description": "Cloud region name. e.g. us-east-1", - "type": [ - "string", - "null" - ], - "maxLength": 1024 - } - }, - "required": [ - "provider" - ] -} \ No newline at end of file diff --git a/internal/apmschema/jsonschema/context.json b/internal/apmschema/jsonschema/context.json deleted file mode 100644 index e3d8e28d1..000000000 --- a/internal/apmschema/jsonschema/context.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "$id": "docs/spec/context.json", - "title": "Context", - "description": "Any arbitrary contextual information regarding the event, captured by the agent, optionally provided by the user", - "type": ["object", "null"], - "properties": { - "custom": { - "description": "An arbitrary mapping of additional metadata to store with the event.", - "type": ["object", "null"], - "patternProperties": { - "^[^.*\"]*$": {} - }, - "additionalProperties": false - }, - "response": { - "type": ["object", "null"], - "allOf": [ - { "$ref": "./http_response.json" }, - { - "properties": { - "finished": { - "description": "A boolean indicating whether the response was finished or not", - "type": [ - "boolean", - "null" - ] - }, - "headers_sent": { - "type": [ - "boolean", - "null" - ] - } - } - } - ] - }, - "request": { - "$ref": "request.json" - }, - "tags": { - "$ref": "tags.json" - }, - "user": { - "description": "Describes the correlated user for this event. If user data are provided here, all user related information from metadata is ignored, otherwise the metadata's user information will be stored with the event.", - "$ref": "user.json" - }, - "page": { - "description": "", - "type": ["object", "null"], - "properties": { - "referer": { - "description": "RUM specific field that stores the URL of the page that 'linked' to the current page.", - "type": ["string", "null"] - }, - "url": { - "description": "RUM specific field that stores the URL of the current page", - "type": ["string", "null"] - } - } - }, - "service": { - "description": "Service related information can be sent per event. Provided information will override the more generic information from metadata, non provided fields will be set according to the metadata information.", - "$ref": "service.json" - }, - "message": { - "$ref": "message.json" - } - } -} diff --git a/internal/apmschema/jsonschema/error.json b/internal/apmschema/jsonschema/error.json new file mode 100644 index 000000000..bfb24161f --- /dev/null +++ b/internal/apmschema/jsonschema/error.json @@ -0,0 +1,1127 @@ +{ + "$id": "docs/spec/v2/error", + "description": "errorEvent represents an error or a logged error message, captured by an APM agent in a monitored service.", + "type": "object", + "properties": { + "context": { + "description": "Context holds arbitrary contextual information for the event.", + "type": [ + "null", + "object" + ], + "properties": { + "custom": { + "description": "Custom can contain additional metadata to be stored with the event. The format is unspecified and can be deeply nested objects. The information will not be indexed or searchable in Elasticsearch.", + "type": [ + "null", + "object" + ] + }, + "experimental": { + "description": "Experimental information is only processed when APM Server is started in development mode and should only be used by APM agent developers implementing new, unreleased features. The format is unspecified." + }, + "message": { + "description": "Message holds details related to message receiving and publishing if the captured event integrates with a messaging system", + "type": [ + "null", + "object" + ], + "properties": { + "age": { + "description": "Age of the message. If the monitored messaging framework provides a timestamp for the message, agents may use it. Otherwise, the sending agent can add a timestamp in milliseconds since the Unix epoch to the message's metadata to be retrieved by the receiving agent. If a timestamp is not available, agents should omit this field.", + "type": [ + "null", + "object" + ], + "properties": { + "ms": { + "description": "Age of the message in milliseconds.", + "type": [ + "null", + "integer" + ] + } + } + }, + "body": { + "description": "Body of the received message, similar to an HTTP request body", + "type": [ + "null", + "string" + ] + }, + "headers": { + "description": "Headers received with the message, similar to HTTP request headers.", + "type": [ + "null", + "object" + ], + "additionalProperties": false, + "patternProperties": { + "[.*]*$": { + "type": [ + "null", + "array", + "string" + ], + "items": { + "type": "string" + } + } + } + }, + "queue": { + "description": "Queue holds information about the message queue where the message is received.", + "type": [ + "null", + "object" + ], + "properties": { + "name": { + "description": "Name holds the name of the message queue where the message is received.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + } + } + }, + "page": { + "description": "Page holds information related to the current page and page referers. It is only sent from RUM agents.", + "type": [ + "null", + "object" + ], + "properties": { + "referer": { + "description": "Referer holds the URL of the page that 'linked' to the current page.", + "type": [ + "null", + "string" + ] + }, + "url": { + "description": "URL of the current page", + "type": [ + "null", + "string" + ] + } + } + }, + "request": { + "description": "Request describes the HTTP request information in case the event was created as a result of an HTTP request.", + "type": [ + "null", + "object" + ], + "properties": { + "body": { + "description": "Body only contais the request bod, not the query string information. It can either be a dictionary (for standard HTTP requests) or a raw request body.", + "type": [ + "null", + "string", + "object" + ] + }, + "cookies": { + "description": "Cookies used by the request, parsed as key-value objects.", + "type": [ + "null", + "object" + ] + }, + "env": { + "description": "Env holds environment variable information passed to the monitored service.", + "type": [ + "null", + "object" + ] + }, + "headers": { + "description": "Headers includes any HTTP headers sent by the requester. Cookies will be taken by headers if supplied.", + "type": [ + "null", + "object" + ], + "additionalProperties": false, + "patternProperties": { + "[.*]*$": { + "type": [ + "null", + "array", + "string" + ], + "items": { + "type": "string" + } + } + } + }, + "http_version": { + "description": "HTTPVersion holds information about the used HTTP version.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "method": { + "description": "Method holds information about the method of the HTTP request.", + "type": "string", + "maxLength": 1024 + }, + "socket": { + "description": "Socket holds information related to the recorded request, such as whether or not data were encrypted and the remote address.", + "type": [ + "null", + "object" + ], + "properties": { + "encrypted": { + "description": "Encrypted indicates whether a request was sent as TLS/HTTPS request.", + "type": [ + "null", + "boolean" + ] + }, + "remote_address": { + "description": "RemoteAddress holds the network address sending the request. It should be obtained through standard APIs and not be parsed from any headers like 'Forwarded'.", + "type": [ + "null", + "string" + ] + } + } + }, + "url": { + "description": "URL holds information sucha as the raw URL, scheme, host and path.", + "type": [ + "null", + "object" + ], + "properties": { + "full": { + "description": "Full, possibly agent-assembled URL of the request, e.g. https://example.com:443/search?q=elasticsearch#top.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "hash": { + "description": "Hash of the request URL, e.g. 'top'", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "hostname": { + "description": "Hostname information of the request, e.g. 'example.com'.\"", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "pathname": { + "description": "Path of the request, e.g. '/search'", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "port": { + "description": "Port of the request, e.g. '443'. Can be sent as string or int.", + "type": [ + "null", + "string", + "integer" + ], + "maxLength": 1024 + }, + "protocol": { + "description": "Protocol information for the recorded request, e.g. 'https:'.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "raw": { + "description": "Raw unparsed URL of the HTTP request line, e.g https://example.com:443/search?q=elasticsearch. This URL may be absolute or relative. For more details, see https://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "search": { + "description": "Search contains the query string information of the request. It is expected to have values delimited by ampersands.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + } + }, + "required": [ + "method" + ] + }, + "response": { + "description": "Response describes the HTTP response information in case the event was created as a result of an HTTP request.", + "type": [ + "null", + "object" + ], + "properties": { + "decoded_body_size": { + "description": "DecodedBodySize holds the size of the decoded payload.", + "type": [ + "null", + "number" + ] + }, + "encoded_body_size": { + "description": "EncodedBodySize holds the size of the encoded payload.", + "type": [ + "null", + "number" + ] + }, + "finished": { + "description": "Finished indicates whether the response was finished or not.", + "type": [ + "null", + "boolean" + ] + }, + "headers": { + "description": "Headers holds the http headers sent in the http response.", + "type": [ + "null", + "object" + ], + "additionalProperties": false, + "patternProperties": { + "[.*]*$": { + "type": [ + "null", + "array", + "string" + ], + "items": { + "type": "string" + } + } + } + }, + "headers_sent": { + "description": "HeadersSent indicates whether http headers were sent.", + "type": [ + "null", + "boolean" + ] + }, + "status_code": { + "description": "StatusCode sent in the http response.", + "type": [ + "null", + "integer" + ] + }, + "transfer_size": { + "description": "TransferSize holds the total size of the payload.", + "type": [ + "null", + "number" + ] + } + } + }, + "service": { + "description": "Service related information can be sent per event. Information provided here will override the more generic information retrieved from metadata, missing service fields will be retrieved from the metadata information.", + "type": [ + "null", + "object" + ], + "properties": { + "agent": { + "description": "Agent holds information about the APM agent capturing the event.", + "type": [ + "null", + "object" + ], + "properties": { + "ephemeral_id": { + "description": "EphemeralID is a free format ID used for metrics correlation by agents", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "name": { + "description": "Name of the APM agent capturing information.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "version": { + "description": "Version of the APM agent capturing information.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "environment": { + "description": "Environment in which the monitored service is running, e.g. `production` or `staging`.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "framework": { + "description": "Framework holds information about the framework used in the monitored service.", + "type": [ + "null", + "object" + ], + "properties": { + "name": { + "description": "Name of the used framework", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "version": { + "description": "Version of the used framework", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "language": { + "description": "Language holds information about the programming language of the monitored service.", + "type": [ + "null", + "object" + ], + "properties": { + "name": { + "description": "Name of the used programming language", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "version": { + "description": "Version of the used programming language", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "name": { + "description": "Name of the monitored service.", + "type": [ + "null", + "string" + ], + "maxLength": 1024, + "pattern": "^[a-zA-Z0-9 _-]+$" + }, + "node": { + "description": "Node must be a unique meaningful name of the service node.", + "type": [ + "null", + "object" + ], + "properties": { + "configured_name": { + "description": "Name of the service node", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "runtime": { + "description": "Runtime holds information about the language runtime running the monitored service", + "type": [ + "null", + "object" + ], + "properties": { + "name": { + "description": "Name of the language runtime", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "version": { + "description": "Version of the language runtime", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "version": { + "description": "Version of the monitored service.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "tags": { + "description": "Tags are a flat mapping of user-defined tags. Allowed value types are string, boolean and number values. Tags are indexed and searchable.", + "type": [ + "null", + "object" + ], + "additionalProperties": { + "type": [ + "null", + "string", + "boolean", + "number" + ], + "maxLength": 1024 + } + }, + "user": { + "description": "User holds information about the correlated user for this event. If user data are provided here, all user related information from metadata is ignored, otherwise the metadata's user information will be stored with the event.", + "type": [ + "null", + "object" + ], + "properties": { + "email": { + "description": "Email of the user.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "id": { + "description": "ID identifies the logged in user, e.g. can be the primary key of the user", + "type": [ + "null", + "string", + "integer" + ], + "maxLength": 1024 + }, + "username": { + "description": "Name of the user.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + } + } + }, + "culprit": { + "description": "Culprit identifies the function call which was the primary perpetrator of this event.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "exception": { + "description": "Exception holds information about the original error. The information is language specific.", + "type": [ + "null", + "object" + ], + "properties": { + "attributes": { + "description": "Attributes of the exception.", + "type": [ + "null", + "object" + ] + }, + "cause": { + "description": "Cause can hold a collection of error exceptions representing chained exceptions. The chain starts with the outermost exception, followed by its cause, and so on.", + "type": [ + "null", + "array" + ], + "items": { + "type": "object" + }, + "minItems": 0 + }, + "code": { + "description": "Code that is set when the error happened, e.g. database error code.", + "type": [ + "null", + "string", + "integer" + ], + "maxLength": 1024 + }, + "handled": { + "description": "Handled indicates whether the error was caught in the code or not.", + "type": [ + "null", + "boolean" + ] + }, + "message": { + "description": "Message contains the originally captured error message.", + "type": [ + "null", + "string" + ] + }, + "module": { + "description": "Module describes the exception type's module namespace.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "stacktrace": { + "description": "Stacktrace information of the captured exception.", + "type": [ + "null", + "array" + ], + "items": { + "type": "object", + "properties": { + "abs_path": { + "description": "AbsPath is the absolute path of the frame's file.", + "type": [ + "null", + "string" + ] + }, + "classname": { + "description": "Classname of the frame.", + "type": [ + "null", + "string" + ] + }, + "colno": { + "description": "ColumnNumber of the frame.", + "type": [ + "null", + "integer" + ] + }, + "context_line": { + "description": "ContextLine is the line from the frame's file.", + "type": [ + "null", + "string" + ] + }, + "filename": { + "description": "Filename is the relative name of the frame's file.", + "type": [ + "null", + "string" + ] + }, + "function": { + "description": "Function represented by the frame.", + "type": [ + "null", + "string" + ] + }, + "library_frame": { + "description": "LibraryFrame indicates whether the frame is from a third party library.", + "type": [ + "null", + "boolean" + ] + }, + "lineno": { + "description": "LineNumber of the frame.", + "type": [ + "null", + "integer" + ] + }, + "module": { + "description": "Module to which the frame belongs to.", + "type": [ + "null", + "string" + ] + }, + "post_context": { + "description": "PostContext is a slice of code lines immediately before the line from the frame's file.", + "type": [ + "null", + "array" + ], + "items": { + "type": "string" + }, + "minItems": 0 + }, + "pre_context": { + "description": "PreContext is a slice of code lines immediately after the line from the frame's file.", + "type": [ + "null", + "array" + ], + "items": { + "type": "string" + }, + "minItems": 0 + }, + "vars": { + "description": "Vars is a flat mapping of local variables of the frame.", + "type": [ + "null", + "object" + ] + } + }, + "anyOf": [ + { + "properties": { + "classname": { + "type": "string" + } + }, + "required": [ + "classname" + ] + }, + { + "properties": { + "filename": { + "type": "string" + } + }, + "required": [ + "filename" + ] + } + ] + }, + "minItems": 0 + }, + "type": { + "description": "Type of the exception.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + }, + "anyOf": [ + { + "properties": { + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + { + "properties": { + "type": { + "type": "string" + } + }, + "required": [ + "type" + ] + } + ] + }, + "id": { + "description": "ID holds the hex encoded 128 random bits ID of the event.", + "type": "string", + "maxLength": 1024 + }, + "log": { + "description": "Log holds additional information added when the error is logged.", + "type": [ + "null", + "object" + ], + "properties": { + "level": { + "description": "Level represents the severity of the recorded log.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "logger_name": { + "description": "LoggerName holds the name of the used logger instance.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "message": { + "description": "Message of the logged error. In case a parameterized message is captured, Message should contain the same information, but with any placeholders being replaced.", + "type": "string" + }, + "param_message": { + "description": "ParamMessage should contain the same information as Message, but with placeholders where parameters were logged, e.g. 'error connecting to %s'. The string is not interpreted, allowing differnt placeholders per client languange. The information might be used to group errors together.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "stacktrace": { + "description": "Stacktrace information of the captured error.", + "type": [ + "null", + "array" + ], + "items": { + "type": "object", + "properties": { + "abs_path": { + "description": "AbsPath is the absolute path of the frame's file.", + "type": [ + "null", + "string" + ] + }, + "classname": { + "description": "Classname of the frame.", + "type": [ + "null", + "string" + ] + }, + "colno": { + "description": "ColumnNumber of the frame.", + "type": [ + "null", + "integer" + ] + }, + "context_line": { + "description": "ContextLine is the line from the frame's file.", + "type": [ + "null", + "string" + ] + }, + "filename": { + "description": "Filename is the relative name of the frame's file.", + "type": [ + "null", + "string" + ] + }, + "function": { + "description": "Function represented by the frame.", + "type": [ + "null", + "string" + ] + }, + "library_frame": { + "description": "LibraryFrame indicates whether the frame is from a third party library.", + "type": [ + "null", + "boolean" + ] + }, + "lineno": { + "description": "LineNumber of the frame.", + "type": [ + "null", + "integer" + ] + }, + "module": { + "description": "Module to which the frame belongs to.", + "type": [ + "null", + "string" + ] + }, + "post_context": { + "description": "PostContext is a slice of code lines immediately before the line from the frame's file.", + "type": [ + "null", + "array" + ], + "items": { + "type": "string" + }, + "minItems": 0 + }, + "pre_context": { + "description": "PreContext is a slice of code lines immediately after the line from the frame's file.", + "type": [ + "null", + "array" + ], + "items": { + "type": "string" + }, + "minItems": 0 + }, + "vars": { + "description": "Vars is a flat mapping of local variables of the frame.", + "type": [ + "null", + "object" + ] + } + }, + "anyOf": [ + { + "properties": { + "classname": { + "type": "string" + } + }, + "required": [ + "classname" + ] + }, + { + "properties": { + "filename": { + "type": "string" + } + }, + "required": [ + "filename" + ] + } + ] + }, + "minItems": 0 + } + }, + "required": [ + "message" + ] + }, + "parent_id": { + "description": "ParentID holds the hex encoded 64 random bits ID of the parent transaction or span.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "timestamp": { + "description": "Timestamp holds the recorded time of the event, UTC based and formatted as microseconds since Unix epoch.", + "type": [ + "null", + "integer" + ] + }, + "trace_id": { + "description": "TraceID holds the hex encoded 128 random bits ID of the correlated trace.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "transaction": { + "description": "Transaction holds information about the correlated transaction.", + "type": [ + "null", + "object" + ], + "properties": { + "sampled": { + "description": "Sampled indicates whether or not the full information for a transaction is captured. If a transaction is unsampled no spans and less context information will be reported.", + "type": [ + "null", + "boolean" + ] + }, + "type": { + "description": "Type expresses the correlated transaction's type as keyword that has specific relevance within the service's domain, eg: 'request', 'backgroundjob'.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "transaction_id": { + "description": "TransactionID holds the hex encoded 64 random bits ID of the correlated transaction.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + }, + "required": [ + "id" + ], + "allOf": [ + { + "if": { + "properties": { + "transaction_id": { + "type": "string" + } + }, + "required": [ + "transaction_id" + ] + }, + "then": { + "properties": { + "parent_id": { + "type": "string" + } + }, + "required": [ + "parent_id" + ] + } + }, + { + "if": { + "properties": { + "trace_id": { + "type": "string" + } + }, + "required": [ + "trace_id" + ] + }, + "then": { + "properties": { + "parent_id": { + "type": "string" + } + }, + "required": [ + "parent_id" + ] + } + }, + { + "if": { + "properties": { + "transaction_id": { + "type": "string" + } + }, + "required": [ + "transaction_id" + ] + }, + "then": { + "properties": { + "trace_id": { + "type": "string" + } + }, + "required": [ + "trace_id" + ] + } + }, + { + "if": { + "properties": { + "parent_id": { + "type": "string" + } + }, + "required": [ + "parent_id" + ] + }, + "then": { + "properties": { + "trace_id": { + "type": "string" + } + }, + "required": [ + "trace_id" + ] + } + } + ], + "anyOf": [ + { + "properties": { + "exception": { + "type": "object" + } + }, + "required": [ + "exception" + ] + }, + { + "properties": { + "log": { + "type": "object" + } + }, + "required": [ + "log" + ] + } + ] +} \ No newline at end of file diff --git a/internal/apmschema/jsonschema/errors/error.json b/internal/apmschema/jsonschema/errors/error.json deleted file mode 100644 index 4f2ee27b4..000000000 --- a/internal/apmschema/jsonschema/errors/error.json +++ /dev/null @@ -1,154 +0,0 @@ -{ - "$id": "docs/spec/errors/error.json", - "type": "object", - "description": "An error or a logged error message captured by an agent occurring in a monitored service", - "allOf": [ - { "$ref": "../timestamp_epoch.json" }, - { - "properties": { - "id": { - "type": ["string"], - "description": "Hex encoded 128 random bits ID of the error.", - "maxLength": 1024 - }, - "trace_id": { - "description": "Hex encoded 128 random bits ID of the correlated trace. Must be present if transaction_id and parent_id are set.", - "type": ["string", "null"], - "maxLength": 1024 - }, - "transaction_id": { - "type": ["string", "null"], - "description": "Hex encoded 64 random bits ID of the correlated transaction. Must be present if trace_id and parent_id are set.", - "maxLength": 1024 - }, - "parent_id": { - "description": "Hex encoded 64 random bits ID of the parent transaction or span. Must be present if trace_id and transaction_id are set.", - "type": ["string", "null"], - "maxLength": 1024 - }, - "transaction": { - "type": ["object", "null"], - "description": "Data for correlating errors with transactions", - "properties": { - "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." - }, - "type": { - "type": ["string", "null"], - "description": "Keyword of specific relevance in the service's domain (eg: 'request', 'backgroundjob', etc)", - "maxLength": 1024 - } - } - }, - "context": { - "$ref": "./../context.json" - }, - "culprit": { - "description": "Function call which was the primary perpetrator of this event.", - "type": ["string", "null"], - "maxLength": 1024 - }, - "exception": { - "description": "Information about the originally thrown error.", - "type": ["object", "null"], - "properties": { - "code": { - "type": ["string", "integer", "null"], - "maxLength": 1024, - "description": "The error code set when the error happened, e.g. database error code." - }, - "message": { - "description": "The original error message.", - "type": ["string", "null"] - }, - "module": { - "description": "Describes the exception type's module namespace.", - "type": ["string", "null"], - "maxLength": 1024 - }, - "attributes": { - "type": ["object", "null"] - }, - "stacktrace": { - "type": ["array", "null"], - "items": { - "$ref": "./../stacktrace_frame.json" - }, - "minItems": 0 - }, - "type": { - "type": ["string", "null"], - "maxLength": 1024 - }, - "handled": { - "type": ["boolean", "null"], - "description": "Indicator whether the error was caught somewhere in the code or not." - }, - "cause": { - "type": ["array", "null"], - "items": { - "type": ["object", "null"], - "description": "Recursive exception object" - }, - "minItems": 0, - "description": "Exception tree" - } - }, - "anyOf": [ - {"required": ["message"], "properties": {"message": {"type": "string"}}}, - {"required": ["type"], "properties": {"type": {"type": "string"}}} - ] - }, - "log": { - "type": ["object", "null"], - "description": "Additional information added when logging the error.", - "properties": { - "level": { - "description": "The severity of the record.", - "type": ["string", "null"], - "maxLength": 1024 - }, - "logger_name": { - "description": "The name of the logger instance used.", - "type": ["string", "null"], - "default": "default", - "maxLength": 1024 - }, - "message": { - "description": "The additionally logged error message.", - "type": "string" - }, - "param_message": { - "description": "A parametrized message. E.g. 'Could not connect to %s'. The property message is still required, and should be equal to the param_message, but with placeholders replaced. In some situations the param_message is used to group errors together. The string is not interpreted, so feel free to use whichever placeholders makes sense in the client languange.", - "type": ["string", "null"], - "maxLength": 1024 - - }, - "stacktrace": { - "type": ["array", "null"], - "items": { - "$ref": "./../stacktrace_frame.json" - }, - "minItems": 0 - } - }, - "required": ["message"] - } - }, - "allOf": [ - { "required": ["id"] }, - { "if": {"required": ["transaction_id"], "properties": {"transaction_id": { "type": "string" }}}, - "then": { "required": ["trace_id", "parent_id"], "properties": {"trace_id": { "type": "string" }, "parent_id": {"type": "string"}}}}, - { "if": {"required": ["trace_id"], "properties": {"trace_id": { "type": "string" }}}, - "then": { "required": ["parent_id"], "properties": {"parent_id": { "type": "string" }}} }, - { "if": {"required": ["parent_id"], "properties": {"parent_id": { "type": "string" }}}, - "then": { "required": ["trace_id"], "properties": {"trace_id": { "type": "string" }}} } - ], - "anyOf": [ - { "required": ["exception"], "properties": {"exception": { "type": "object" }} }, - { "required": ["log"], "properties": {"log": { "type": "object" }} } - ] - } - ] -} diff --git a/internal/apmschema/jsonschema/http_response.json b/internal/apmschema/jsonschema/http_response.json deleted file mode 100644 index 1bc5f6970..000000000 --- a/internal/apmschema/jsonschema/http_response.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "$id": "docs/spec/http_response.json", - "title": "HTTP response object", - "description": "HTTP response object, used by error, span and transction documents", - "type": ["object", "null"], - "properties": { - "status_code": { - "type": ["integer", "null"], - "description": "The status code of the http request." - }, - "transfer_size": { - "type": ["number", "null"], - "description": "Total size of the payload." - }, - "encoded_body_size": { - "type": ["number", "null"], - "description": "The encoded size of the payload." - }, - "decoded_body_size": { - "type": ["number", "null"], - "description": "The decoded size of the payload." - }, - "headers": { - "type": ["object", "null"], - "patternProperties": { - "[.*]*$": { - "type": ["string", "array", "null"], - "items": { - "type": ["string"] - } - } - } - } - } -} diff --git a/internal/apmschema/jsonschema/message.json b/internal/apmschema/jsonschema/message.json deleted file mode 100644 index 23217e2f8..000000000 --- a/internal/apmschema/jsonschema/message.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "$id": "docs/spec/message.json", - "title": "Message", - "description": "Details related to message receiving and publishing if the captured event integrates with a messaging system", - "type": ["object", "null"], - "properties": { - "queue": { - "type": ["object", "null"], - "properties": { - "name": { - "description": "Name of the message queue where the message is received.", - "type": ["string","null"], - "maxLength": 1024 - } - } - }, - "age": { - "type": ["object", "null"], - "properties": { - "ms": { - "description": "The age of the message in milliseconds. If the instrumented messaging framework provides a timestamp for the message, agents may use it. Otherwise, the sending agent can add a timestamp in milliseconds since the Unix epoch to the message's metadata to be retrieved by the receiving agent. If a timestamp is not available, agents should omit this field.", - "type": ["integer", "null"] - } - } - }, - "body": { - "description": "messsage body, similar to an http request body", - "type": ["string", "null"] - }, - "headers": { - "description": "messsage headers, similar to http request headers", - "type": ["object", "null"], - "patternProperties": { - "[.*]*$": { - "type": ["string", "array", "null"], - "items": { - "type": ["string"] - } - } - } - } - } -} diff --git a/internal/apmschema/jsonschema/metadata.json b/internal/apmschema/jsonschema/metadata.json index 08bea9472..7f164b12f 100644 --- a/internal/apmschema/jsonschema/metadata.json +++ b/internal/apmschema/jsonschema/metadata.json @@ -1,187 +1,503 @@ { - "$id": "docs/spec/metadata.json", - "title": "Metadata", - "description": "Metadata concerning the other objects in the stream.", - "type": "object", - "properties": { - "service": { - "type": [ - "object" - ], - "properties": { - "agent": { - "description": "Name and version of the Elastic APM agent", - "type": [ - "object" - ], - "properties": { - "name": { - "description": "Name of the Elastic APM agent, e.g. \"Python\"", - "type": [ - "string" - ], - "maxLength": 1024, - "minLength": 1 - }, - "version": { - "description": "Version of the Elastic APM agent, e.g.\"1.0.0\"", - "type": [ - "string" - ], - "maxLength": 1024 - }, - "ephemeral_id": { - "description": "Free format ID used for metrics correlation by some agents", - "type": [ - "string", - "null" - ], - "maxLength": 1024 - } - }, - "required": [ - "name", - "version" - ] - }, - "framework": { - "description": "Name and version of the web framework used", - "type": [ - "object", - "null" - ], - "properties": { - "name": { - "type": [ - "string", - "null" - ], - "maxLength": 1024 - }, - "version": { - "type": [ - "string", - "null" - ], - "maxLength": 1024 - } - } - }, - "language": { - "description": "Name and version of the programming language used", - "type": [ - "object", - "null" - ], - "properties": { - "name": { - "type": [ - "string" - ], - "maxLength": 1024 - }, - "version": { - "type": [ - "string", - "null" - ], - "maxLength": 1024 - } - }, - "required": [ - "name" - ] - }, - "name": { - "description": "Immutable name of the service emitting this event", - "type": [ - "string" - ], - "pattern": "^[a-zA-Z0-9 _-]+$", - "maxLength": 1024, - "minLength": 1 - }, - "environment": { - "description": "Environment name of the service, e.g. \"production\" or \"staging\"", - "type": [ - "string", - "null" - ], - "maxLength": 1024 - }, - "runtime": { - "description": "Name and version of the language runtime running this service", - "type": [ - "object", - "null" - ], - "properties": { - "name": { - "type": [ - "string" - ], - "maxLength": 1024 - }, - "version": { - "type": [ - "string" - ], - "maxLength": 1024 - } - }, - "required": [ - "name", - "version" - ] - }, - "version": { - "description": "Version of the service emitting this event", - "type": [ - "string", - "null" - ], - "maxLength": 1024 - }, - "node": { - "description": "Unique meaningful name of the service node.", - "type": [ - "object", - "null" - ], - "properties": { - "configured_name": { - "type": [ - "string", - "null" - ], - "maxLength": 1024 - } - } - } + "$id": "docs/spec/v2/metadata", + "type": "object", + "properties": { + "cloud": { + "description": "Cloud metadata about where the monitored service is running.", + "type": [ + "null", + "object" + ], + "properties": { + "account": { + "description": "Account where the monitored service is running.", + "type": [ + "null", + "object" + ], + "properties": { + "id": { + "description": "ID of the cloud account.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 }, - "required": [ - "name", - "agent" - ] + "name": { + "description": "Name of the cloud account.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } }, - "process": { - "$ref": "process.json" + "availability_zone": { + "description": "AvailabilityZone where the monitored service is running, e.g. us-east-1a", + "type": [ + "null", + "string" + ], + "maxLength": 1024 }, - "system": { - "$ref": "system.json" + "instance": { + "description": "Instance on which the monitored service is running.", + "type": [ + "null", + "object" + ], + "properties": { + "id": { + "description": "ID of the cloud instance.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "name": { + "description": "Name of the cloud instance.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } }, - "user": { - "description": "Describes the authenticated User for a request.", - "$ref": "user.json" + "machine": { + "description": "Machine on which the monitored service is running.", + "type": [ + "null", + "object" + ], + "properties": { + "type": { + "description": "ID of the cloud machine.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } }, - "cloud": { - "$ref": "cloud.json" + "project": { + "description": "Project in which the monitored service is running.", + "type": [ + "null", + "object" + ], + "properties": { + "id": { + "description": "ID of the cloud project.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "name": { + "description": "Name of the cloud project.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "provider": { + "description": "Provider that is used, e.g. aws, azure, gcp, digitalocean.", + "type": "string", + "maxLength": 1024 }, - "labels": { - "$ref": "tags.json" + "region": { + "description": "Region where the monitored service is running, e.g. us-east-1", + "type": [ + "null", + "string" + ], + "maxLength": 1024 } + }, + "required": [ + "provider" + ] + }, + "labels": { + "description": "Labels are a flat mapping of user-defined tags. Allowed value types are string, boolean and number values. Labels are indexed and searchable.", + "type": [ + "null", + "object" + ], + "additionalProperties": { + "type": [ + "null", + "string", + "boolean", + "number" + ], + "maxLength": 1024 + } }, - "required": [ - "service" - ] + "process": { + "description": "Process metadata about the monitored service.", + "type": [ + "null", + "object" + ], + "properties": { + "argv": { + "description": "Argv holds the command line arguments used to start this process.", + "type": [ + "null", + "array" + ], + "items": { + "type": "string" + }, + "minItems": 0 + }, + "pid": { + "description": "PID holds the process ID of the service.", + "type": "integer" + }, + "ppid": { + "description": "Ppid holds the parent process ID of the service.", + "type": [ + "null", + "integer" + ] + }, + "title": { + "description": "Title is the process title. It can be the same as process name.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + }, + "required": [ + "pid" + ] + }, + "service": { + "description": "Service metadata about the monitored service.", + "type": "object", + "properties": { + "agent": { + "description": "Agent holds information about the APM agent capturing the event.", + "type": "object", + "properties": { + "ephemeral_id": { + "description": "EphemeralID is a free format ID used for metrics correlation by agents", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "name": { + "description": "Name of the APM agent capturing information.", + "type": "string", + "maxLength": 1024, + "minLength": 1 + }, + "version": { + "description": "Version of the APM agent capturing information.", + "type": "string", + "maxLength": 1024 + } + }, + "required": [ + "name", + "version" + ] + }, + "environment": { + "description": "Environment in which the monitored service is running, e.g. `production` or `staging`.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "framework": { + "description": "Framework holds information about the framework used in the monitored service.", + "type": [ + "null", + "object" + ], + "properties": { + "name": { + "description": "Name of the used framework", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "version": { + "description": "Version of the used framework", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "language": { + "description": "Language holds information about the programming language of the monitored service.", + "type": [ + "null", + "object" + ], + "properties": { + "name": { + "description": "Name of the used programming language", + "type": "string", + "maxLength": 1024 + }, + "version": { + "description": "Version of the used programming language", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + }, + "required": [ + "name" + ] + }, + "name": { + "description": "Name of the monitored service.", + "type": "string", + "maxLength": 1024, + "minLength": 1, + "pattern": "^[a-zA-Z0-9 _-]+$" + }, + "node": { + "description": "Node must be a unique meaningful name of the service node.", + "type": [ + "null", + "object" + ], + "properties": { + "configured_name": { + "description": "Name of the service node", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "runtime": { + "description": "Runtime holds information about the language runtime running the monitored service", + "type": [ + "null", + "object" + ], + "properties": { + "name": { + "description": "Name of the language runtime", + "type": "string", + "maxLength": 1024 + }, + "version": { + "description": "Name of the language runtime", + "type": "string", + "maxLength": 1024 + } + }, + "required": [ + "name", + "version" + ] + }, + "version": { + "description": "Version of the monitored service.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + }, + "required": [ + "agent", + "name" + ] + }, + "system": { + "description": "System metadata", + "type": [ + "null", + "object" + ], + "properties": { + "architecture": { + "description": "Architecture of the system the monitored service is running on.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "configured_hostname": { + "description": "ConfiguredHostname is the configured name of the host the monitored service is running on. It should only be sent when configured by the user. If given, it is used as the event's hostname.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "container": { + "description": "Container holds the system's container ID if available.", + "type": [ + "null", + "object" + ], + "properties": { + "id": { + "description": "ID of the container the monitored service is running in.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "detected_hostname": { + "description": "DetectedHostname is the hostname detected by the APM agent. It usually contains what the hostname command returns on the host machine. It will be used as the event's hostname if ConfiguredHostname is not present.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "hostname": { + "description": "Deprecated: Use ConfiguredHostname and DetectedHostname instead. DeprecatedHostname is the host name of the system the service is running on. It does not distinguish between configured and detected hostname and therefore is deprecated and only used if no other hostname information is available.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "kubernetes": { + "description": "Kubernetes system information if the monitored service runs on Kubernetes.", + "type": [ + "null", + "object" + ], + "properties": { + "namespace": { + "description": "Namespace of the Kubernetes resource the monitored service is run on.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "node": { + "description": "Node related information", + "type": [ + "null", + "object" + ], + "properties": { + "name": { + "description": "Name of the Kubernetes Node", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "pod": { + "description": "Pod related information", + "type": [ + "null", + "object" + ], + "properties": { + "name": { + "description": "Name of the Kubernetes Pod", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "uid": { + "description": "UID is the system-generated string uniquely identifying the Pod.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + } + } + }, + "platform": { + "description": "Platform name of the system platform the monitored service is running on.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "user": { + "description": "User metadata, which can be overwritten on a per event basis.", + "type": [ + "null", + "object" + ], + "properties": { + "email": { + "description": "Email of the user.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "id": { + "description": "ID identifies the logged in user, e.g. can be the primary key of the user", + "type": [ + "null", + "string", + "integer" + ], + "maxLength": 1024 + }, + "username": { + "description": "Name of the user.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + } + }, + "required": [ + "service" + ] } \ No newline at end of file diff --git a/internal/apmschema/jsonschema/metricset.json b/internal/apmschema/jsonschema/metricset.json new file mode 100644 index 000000000..09adf1e0a --- /dev/null +++ b/internal/apmschema/jsonschema/metricset.json @@ -0,0 +1,104 @@ +{ + "$id": "docs/spec/v2/metricset", + "type": "object", + "properties": { + "samples": { + "description": "Samples hold application metrics collected from the agent.", + "type": "object", + "additionalProperties": false, + "patternProperties": { + "^[^*\"]*$": { + "type": [ + "null", + "object" + ], + "properties": { + "value": { + "description": "Value holds the value of a single metric sample.", + "type": "number" + } + }, + "required": [ + "value" + ] + } + } + }, + "span": { + "description": "Span holds selected information about the correlated transaction.", + "type": [ + "null", + "object" + ], + "properties": { + "subtype": { + "description": "Subtype is a further sub-division of the type (e.g. postgresql, elasticsearch)", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "type": { + "description": "Type expresses the correlated span's type as keyword that has specific relevance within the service's domain, eg: 'request', 'backgroundjob'.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "tags": { + "description": "Tags are a flat mapping of user-defined tags. Allowed value types are string, boolean and number values. Tags are indexed and searchable.", + "type": [ + "null", + "object" + ], + "additionalProperties": { + "type": [ + "null", + "string", + "boolean", + "number" + ], + "maxLength": 1024 + } + }, + "timestamp": { + "description": "Timestamp holds the recorded time of the event, UTC based and formatted as microseconds since Unix epoch", + "type": [ + "null", + "integer" + ] + }, + "transaction": { + "description": "Transaction holds selected information about the correlated transaction.", + "type": [ + "null", + "object" + ], + "properties": { + "name": { + "description": "Name of the correlated transaction.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "type": { + "description": "Type expresses the correlated transaction's type as keyword that has specific relevance within the service's domain, eg: 'request', 'backgroundjob'.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + } + }, + "required": [ + "samples" + ] +} \ No newline at end of file diff --git a/internal/apmschema/jsonschema/metricsets/metricset.json b/internal/apmschema/jsonschema/metricsets/metricset.json deleted file mode 100644 index 5216f3014..000000000 --- a/internal/apmschema/jsonschema/metricsets/metricset.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "$id": "docs/spec/metricsets/metricset.json", - "type": "object", - "description": "Data captured by an agent representing an event occurring in a monitored service", - "allOf": [ - { "$ref": "../timestamp_epoch.json"}, - { "$ref": "../span_type.json" }, - { "$ref": "../span_subtype.json" }, - { "$ref": "../transaction_name.json" }, - { "$ref": "../transaction_type.json" }, - { - "properties": { - "samples": { - "type": [ - "object" - ], - "description": "Sampled application metrics collected from the agent.", - "patternProperties": { - "^[^*\"]*$": { - "$ref": "sample.json" - } - }, - "additionalProperties": false - }, - "tags": { - "$ref": "../tags.json" - } - }, - "required": ["samples"] - } - ] -} diff --git a/internal/apmschema/jsonschema/metricsets/sample.json b/internal/apmschema/jsonschema/metricsets/sample.json deleted file mode 100644 index 8902d3bf2..000000000 --- a/internal/apmschema/jsonschema/metricsets/sample.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "$id": "docs/spec/metricsets/sample.json", - "type": ["object", "null"], - "description": "A single metric sample.", - "properties": { - "value": {"type": "number"} - }, - "required": ["value"] -} diff --git a/internal/apmschema/jsonschema/outcome.json b/internal/apmschema/jsonschema/outcome.json deleted file mode 100644 index 36231ee88..000000000 --- a/internal/apmschema/jsonschema/outcome.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$id": "docs/spec/outcome.json", - "title": "Outcome", - "type": ["string", "null"], - "enum": [null, "success", "failure", "unknown"], - "description": "The outcome of the transaction: success, failure, or unknown. This is similar to 'result', but has a limited set of permitted values describing the success or failure of the transaction from the service's perspective. This field can be used for calculating error rates." -} diff --git a/internal/apmschema/jsonschema/process.json b/internal/apmschema/jsonschema/process.json deleted file mode 100644 index e5d5a1a8b..000000000 --- a/internal/apmschema/jsonschema/process.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "$id": "docs/spec/process.json", - "title": "Process", - "type": ["object", "null"], - "properties": { - "pid": { - "description": "Process ID of the service", - "type": ["integer"] - }, - "ppid": { - "description": "Parent process ID of the service", - "type": ["integer", "null"] - }, - "title": { - "type": ["string", "null"], - "maxLength": 1024 - }, - "argv": { - "description": "Command line arguments used to start this process", - "type": ["array", "null"], - "minItems": 0, - "items": { - "type": "string" - } - } - }, - "required": ["pid"] -} diff --git a/internal/apmschema/jsonschema/request.json b/internal/apmschema/jsonschema/request.json deleted file mode 100644 index e116e9ab3..000000000 --- a/internal/apmschema/jsonschema/request.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "$id": "docs/spec/request.json", - "title": "Request", - "description": "If a log record was generated as a result of a http request, the http interface can be used to collect this information.", - "type": ["object", "null"], - "properties": { - "body": { - "description": "Data should only contain the request body (not the query string). It can either be a dictionary (for standard HTTP requests) or a raw request body.", - "type": ["object", "string", "null"] - }, - "env": { - "description": "The env variable is a compounded of environment information passed from the webserver.", - "type": ["object", "null"], - "properties": {} - }, - "headers": { - "description": "Should include any headers sent by the requester. Cookies will be taken by headers if supplied.", - "type": ["object", "null"], - "patternProperties": { - "[.*]*$": { - "type": ["string", "array", "null"], - "items": { - "type": ["string"] - } - } - } - }, - "http_version": { - "description": "HTTP version.", - "type": ["string", "null"], - "maxLength": 1024 - }, - "method": { - "description": "HTTP method.", - "type": "string", - "maxLength": 1024 - }, - "socket": { - "type": ["object", "null"], - "properties": { - "encrypted": { - "description": "Indicates whether request was sent as SSL/HTTPS request.", - "type": ["boolean", "null"] - }, - "remote_address": { - "description": "The network address sending the request. Should be obtained through standard APIs and not parsed from any headers like 'Forwarded'.", - "type": ["string", "null"] - } - } - }, - "url": { - "description": "A complete Url, with scheme, host and path.", - "type": "object", - "properties": { - "raw": { - "type": ["string", "null"], - "description": "The raw, unparsed URL of the HTTP request line, e.g https://example.com:443/search?q=elasticsearch. This URL may be absolute or relative. For more details, see https://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2.", - "maxLength": 1024 - }, - "protocol": { - "type": ["string", "null"], - "description": "The protocol of the request, e.g. 'https:'.", - "maxLength": 1024 - }, - "full": { - "type": ["string", "null"], - "description": "The full, possibly agent-assembled URL of the request, e.g https://example.com:443/search?q=elasticsearch#top.", - "maxLength": 1024 - }, - "hostname": { - "type": ["string", "null"], - "description": "The hostname of the request, e.g. 'example.com'.", - "maxLength": 1024 - }, - "port": { - "type": ["string", "integer","null"], - "description": "The port of the request, e.g. '443'", - "maxLength": 1024 - }, - "pathname": { - "type": ["string", "null"], - "description": "The path of the request, e.g. '/search'", - "maxLength": 1024 - }, - "search": { - "description": "The search describes the query string of the request. It is expected to have values delimited by ampersands.", - "type": ["string", "null"], - "maxLength": 1024 - }, - "hash": { - "type": ["string", "null"], - "description": "The hash of the request URL, e.g. 'top'", - "maxLength": 1024 - } - } - }, - "cookies": { - "description": "A parsed key-value object of cookies", - "type": ["object", "null"] - } - }, - "required": ["url", "method"] -} diff --git a/internal/apmschema/jsonschema/rum_experience.json b/internal/apmschema/jsonschema/rum_experience.json deleted file mode 100644 index 2296ace75..000000000 --- a/internal/apmschema/jsonschema/rum_experience.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "$id": "docs/spec/rum_experience.json", - "title": "RUM Experience Metrics", - "description": "Metrics for measuring real user (browser) experience", - "type": ["object", "null"], - "properties": { - "cls": { - "type": ["number", "null"], - "description": "The Cumulative Layout Shift metric", - "minimum": 0 - }, - "tbt": { - "type": ["number", "null"], - "description": "The Total Blocking Time metric", - "minimum": 0 - }, - "fid": { - "type": ["number", "null"], - "description": "The First Input Delay metric", - "minimum": 0 - } - } -} diff --git a/internal/apmschema/jsonschema/service.json b/internal/apmschema/jsonschema/service.json deleted file mode 100644 index 163d31993..000000000 --- a/internal/apmschema/jsonschema/service.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "$id": "docs/spec/service.json", - "title": "Service", - "type": ["object", "null"], - "properties": { - "agent": { - "description": "Name and version of the Elastic APM agent", - "type": ["object", "null"], - "properties": { - "name": { - "description": "Name of the Elastic APM agent, e.g. \"Python\"", - "type": ["string", "null"], - "maxLength": 1024 - }, - "version": { - "description": "Version of the Elastic APM agent, e.g.\"1.0.0\"", - "type": ["string", "null"], - "maxLength": 1024 - }, - "ephemeral_id": { - "description": "Free format ID used for metrics correlation by some agents", - "type": ["string", "null"], - "maxLength": 1024 - } - } - }, - "framework": { - "description": "Name and version of the web framework used", - "type": ["object", "null"], - "properties": { - "name": { - "type": ["string", "null"], - "maxLength": 1024 - }, - "version": { - "type": ["string", "null"], - "maxLength": 1024 - } - } - }, - "language": { - "description": "Name and version of the programming language used", - "type": ["object", "null"], - "properties": { - "name": { - "type": ["string", "null"], - "maxLength": 1024 - }, - "version": { - "type": ["string", "null"], - "maxLength": 1024 - } - } - }, - "name": { - "description": "Immutable name of the service emitting this event", - "type": ["string", "null"], - "pattern": "^[a-zA-Z0-9 _-]+$", - "maxLength": 1024 - }, - "environment": { - "description": "Environment name of the service, e.g. \"production\" or \"staging\"", - "type": ["string", "null"], - "maxLength": 1024 - }, - "runtime": { - "description": "Name and version of the language runtime running this service", - "type": ["object", "null"], - "properties": { - "name": { - "type": ["string", "null"], - "maxLength": 1024 - }, - "version": { - "type": ["string", "null"], - "maxLength": 1024 - } - } - }, - "version": { - "description": "Version of the service emitting this event", - "type": ["string", "null"], - "maxLength": 1024 - }, - "node": { - "description": "Unique meaningful name of the service node.", - "type": ["object", "null"], - "properties": { - "configured_name": { - "type": ["string", "null"], - "maxLength": 1024 - } - } - } - } -} diff --git a/internal/apmschema/jsonschema/sourcemaps/payload.json b/internal/apmschema/jsonschema/sourcemaps/payload.json deleted file mode 100644 index f1a57945b..000000000 --- a/internal/apmschema/jsonschema/sourcemaps/payload.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "$id": "docs/spec/sourcemaps/sourcemap-metadata.json", - "title": "Sourcemap Metadata", - "description": "Sourcemap Metadata", - "type": "object", - "properties": { - "bundle_filepath": { - "description": "relative path of the minified bundle file", - "type": "string", - "maxLength": 1024, - "minLength": 1 - }, - "service_version": { - "description": "Version of the service emitting this event", - "type": "string", - "maxLength": 1024, - "minLength": 1 - }, - "service_name": { - "description": "Immutable name of the service emitting this event", - "type": "string", - "pattern": "^[a-zA-Z0-9 _-]+$", - "maxLength": 1024, - "minLength": 1 - } - }, - "required": ["bundle_filepath", "service_name", "service_version"] -} diff --git a/internal/apmschema/jsonschema/span.json b/internal/apmschema/jsonschema/span.json new file mode 100644 index 000000000..24a1e5c4d --- /dev/null +++ b/internal/apmschema/jsonschema/span.json @@ -0,0 +1,719 @@ +{ + "$id": "docs/spec/v2/span", + "type": "object", + "properties": { + "action": { + "description": "Action holds the specific kind of event within the sub-type represented by the span (e.g. query, connect)", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "child_ids": { + "description": "ChildIDs holds a list of successor transactions and/or spans.", + "type": [ + "null", + "array" + ], + "items": { + "type": "string", + "maxLength": 1024 + }, + "minItems": 0 + }, + "context": { + "description": "Context holds arbitrary contextual information for the event.", + "type": [ + "null", + "object" + ], + "properties": { + "db": { + "description": "Database contains contextual data for database spans", + "type": [ + "null", + "object" + ], + "properties": { + "instance": { + "description": "Instance name of the database.", + "type": [ + "null", + "string" + ] + }, + "link": { + "description": "Link to the database server.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "rows_affected": { + "description": "RowsAffected shows the number of rows affected by the statement.", + "type": [ + "null", + "integer" + ] + }, + "statement": { + "description": "Statement of the recorded database event, e.g. query.", + "type": [ + "null", + "string" + ] + }, + "type": { + "description": "Type of the recorded database event., e.g. sql, cassandra, hbase, redis.", + "type": [ + "null", + "string" + ] + }, + "user": { + "description": "User is the username with which the database is accessed.", + "type": [ + "null", + "string" + ] + } + } + }, + "destination": { + "description": "Destination contains contextual data about the destination of spans", + "type": [ + "null", + "object" + ], + "properties": { + "address": { + "description": "Address is the destination network address: hostname (e.g. 'localhost'), FQDN (e.g. 'elastic.co'), IPv4 (e.g. '127.0.0.1') IPv6 (e.g. '::1')", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "port": { + "description": "Port is the destination network port (e.g. 443)", + "type": [ + "null", + "integer" + ] + }, + "service": { + "description": "Service describes the destination service", + "type": [ + "null", + "object" + ], + "properties": { + "name": { + "description": "Name is the identifier for the destination service, e.g. 'http://elastic.co', 'elasticsearch', 'rabbitmq'", + "type": "string", + "maxLength": 1024 + }, + "resource": { + "description": "Resource identifies the destination service resource being operated on e.g. 'http://elastic.co:80', 'elasticsearch', 'rabbitmq/queue_name'", + "type": "string", + "maxLength": 1024 + }, + "type": { + "description": "Type of the destination service, e.g. db, elasticsearch. Should typically be the same as span.type.", + "type": "string", + "maxLength": 1024 + } + }, + "required": [ + "name", + "resource", + "type" + ] + } + } + }, + "experimental": { + "description": "Experimental information is only processed when APM Server is started in development mode and should only be used by APM agent developers implementing new, unreleased features. The format is unspecified." + }, + "http": { + "description": "HTTP contains contextual information when the span concerns an HTTP request.", + "type": [ + "null", + "object" + ], + "properties": { + "method": { + "description": "Method holds information about the method of the HTTP request.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "response": { + "description": "Response describes the HTTP response information in case the event was created as a result of an HTTP request.", + "type": [ + "null", + "object" + ], + "properties": { + "decoded_body_size": { + "description": "DecodedBodySize holds the size of the decoded payload.", + "type": [ + "null", + "number" + ] + }, + "encoded_body_size": { + "description": "EncodedBodySize holds the size of the encoded payload.", + "type": [ + "null", + "number" + ] + }, + "headers": { + "description": "Headers holds the http headers sent in the http response.", + "type": [ + "null", + "object" + ], + "additionalProperties": false, + "patternProperties": { + "[.*]*$": { + "type": [ + "null", + "array", + "string" + ], + "items": { + "type": "string" + } + } + } + }, + "status_code": { + "description": "StatusCode sent in the http response.", + "type": [ + "null", + "integer" + ] + }, + "transfer_size": { + "description": "TransferSize holds the total size of the payload.", + "type": [ + "null", + "number" + ] + } + } + }, + "status_code": { + "description": "Deprecated: Use Response.StatusCode instead. StatusCode sent in the http response.", + "type": [ + "null", + "integer" + ] + }, + "url": { + "description": "URL is the raw url of the correlating HTTP request.", + "type": [ + "null", + "string" + ] + } + } + }, + "message": { + "description": "Message holds details related to message receiving and publishing if the captured event integrates with a messaging system", + "type": [ + "null", + "object" + ], + "properties": { + "age": { + "description": "Age of the message. If the monitored messaging framework provides a timestamp for the message, agents may use it. Otherwise, the sending agent can add a timestamp in milliseconds since the Unix epoch to the message's metadata to be retrieved by the receiving agent. If a timestamp is not available, agents should omit this field.", + "type": [ + "null", + "object" + ], + "properties": { + "ms": { + "description": "Age of the message in milliseconds.", + "type": [ + "null", + "integer" + ] + } + } + }, + "body": { + "description": "Body of the received message, similar to an HTTP request body", + "type": [ + "null", + "string" + ] + }, + "headers": { + "description": "Headers received with the message, similar to HTTP request headers.", + "type": [ + "null", + "object" + ], + "additionalProperties": false, + "patternProperties": { + "[.*]*$": { + "type": [ + "null", + "array", + "string" + ], + "items": { + "type": "string" + } + } + } + }, + "queue": { + "description": "Queue holds information about the message queue where the message is received.", + "type": [ + "null", + "object" + ], + "properties": { + "name": { + "description": "Name holds the name of the message queue where the message is received.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + } + } + }, + "service": { + "description": "Service related information can be sent per span. Information provided here will override the more generic information retrieved from metadata, missing service fields will be retrieved from the metadata information.", + "type": [ + "null", + "object" + ], + "properties": { + "agent": { + "description": "Agent holds information about the APM agent capturing the event.", + "type": [ + "null", + "object" + ], + "properties": { + "ephemeral_id": { + "description": "EphemeralID is a free format ID used for metrics correlation by agents", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "name": { + "description": "Name of the APM agent capturing information.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "version": { + "description": "Version of the APM agent capturing information.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "environment": { + "description": "Environment in which the monitored service is running, e.g. `production` or `staging`.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "framework": { + "description": "Framework holds information about the framework used in the monitored service.", + "type": [ + "null", + "object" + ], + "properties": { + "name": { + "description": "Name of the used framework", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "version": { + "description": "Version of the used framework", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "language": { + "description": "Language holds information about the programming language of the monitored service.", + "type": [ + "null", + "object" + ], + "properties": { + "name": { + "description": "Name of the used programming language", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "version": { + "description": "Version of the used programming language", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "name": { + "description": "Name of the monitored service.", + "type": [ + "null", + "string" + ], + "maxLength": 1024, + "pattern": "^[a-zA-Z0-9 _-]+$" + }, + "node": { + "description": "Node must be a unique meaningful name of the service node.", + "type": [ + "null", + "object" + ], + "properties": { + "configured_name": { + "description": "Name of the service node", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "runtime": { + "description": "Runtime holds information about the language runtime running the monitored service", + "type": [ + "null", + "object" + ], + "properties": { + "name": { + "description": "Name of the language runtime", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "version": { + "description": "Version of the language runtime", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "version": { + "description": "Version of the monitored service.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "tags": { + "description": "Tags are a flat mapping of user-defined tags. Allowed value types are string, boolean and number values. Tags are indexed and searchable.", + "type": [ + "null", + "object" + ], + "additionalProperties": { + "type": [ + "null", + "string", + "boolean", + "number" + ], + "maxLength": 1024 + } + } + } + }, + "duration": { + "description": "Duration of the span in milliseconds", + "type": "number", + "minimum": 0 + }, + "id": { + "description": "ID holds the hex encoded 64 random bits ID of the event.", + "type": "string", + "maxLength": 1024 + }, + "name": { + "description": "Name is the generic designation of a span in the scope of a transaction.", + "type": "string", + "maxLength": 1024 + }, + "outcome": { + "description": "Outcome of the span: success, failure, or unknown. Outcome may be one of a limited set of permitted values describing the success or failure of the span. It can be used for calculating error rates for outgoing requests.", + "type": [ + "null", + "string" + ], + "enum": [ + "success", + "failure", + "unknown", + null + ] + }, + "parent_id": { + "description": "ParentID holds the hex encoded 64 random bits ID of the parent transaction or span.", + "type": "string", + "maxLength": 1024 + }, + "sample_rate": { + "description": "SampleRate applied to the monitored service at the time where this span was recorded.", + "type": [ + "null", + "number" + ] + }, + "stacktrace": { + "description": "Stacktrace connected to this span event.", + "type": [ + "null", + "array" + ], + "items": { + "type": "object", + "properties": { + "abs_path": { + "description": "AbsPath is the absolute path of the frame's file.", + "type": [ + "null", + "string" + ] + }, + "classname": { + "description": "Classname of the frame.", + "type": [ + "null", + "string" + ] + }, + "colno": { + "description": "ColumnNumber of the frame.", + "type": [ + "null", + "integer" + ] + }, + "context_line": { + "description": "ContextLine is the line from the frame's file.", + "type": [ + "null", + "string" + ] + }, + "filename": { + "description": "Filename is the relative name of the frame's file.", + "type": [ + "null", + "string" + ] + }, + "function": { + "description": "Function represented by the frame.", + "type": [ + "null", + "string" + ] + }, + "library_frame": { + "description": "LibraryFrame indicates whether the frame is from a third party library.", + "type": [ + "null", + "boolean" + ] + }, + "lineno": { + "description": "LineNumber of the frame.", + "type": [ + "null", + "integer" + ] + }, + "module": { + "description": "Module to which the frame belongs to.", + "type": [ + "null", + "string" + ] + }, + "post_context": { + "description": "PostContext is a slice of code lines immediately before the line from the frame's file.", + "type": [ + "null", + "array" + ], + "items": { + "type": "string" + }, + "minItems": 0 + }, + "pre_context": { + "description": "PreContext is a slice of code lines immediately after the line from the frame's file.", + "type": [ + "null", + "array" + ], + "items": { + "type": "string" + }, + "minItems": 0 + }, + "vars": { + "description": "Vars is a flat mapping of local variables of the frame.", + "type": [ + "null", + "object" + ] + } + }, + "anyOf": [ + { + "properties": { + "classname": { + "type": "string" + } + }, + "required": [ + "classname" + ] + }, + { + "properties": { + "filename": { + "type": "string" + } + }, + "required": [ + "filename" + ] + } + ] + }, + "minItems": 0 + }, + "start": { + "description": "Start is the offset relative to the transaction's timestamp identifying the start of the span, in milliseconds.", + "type": [ + "null", + "number" + ] + }, + "subtype": { + "description": "Subtype is a further sub-division of the type (e.g. postgresql, elasticsearch)", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "sync": { + "description": "Sync indicates whether the span was executed synchronously or asynchronously.", + "type": [ + "null", + "boolean" + ] + }, + "timestamp": { + "description": "Timestamp holds the recorded time of the event, UTC based and formatted as microseconds since Unix epoch", + "type": [ + "null", + "integer" + ] + }, + "trace_id": { + "description": "TraceID holds the hex encoded 128 random bits ID of the correlated trace.", + "type": "string", + "maxLength": 1024 + }, + "transaction_id": { + "description": "TransactionID holds the hex encoded 64 random bits ID of the correlated transaction.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "type": { + "description": "Type holds the span's type, and can have specific keywords within the service's domain (eg: 'request', 'backgroundjob', etc)", + "type": "string", + "maxLength": 1024 + } + }, + "required": [ + "duration", + "id", + "name", + "parent_id", + "trace_id", + "type" + ], + "anyOf": [ + { + "properties": { + "start": { + "type": "number" + } + }, + "required": [ + "start" + ] + }, + { + "properties": { + "timestamp": { + "type": "integer" + } + }, + "required": [ + "timestamp" + ] + } + ] +} \ No newline at end of file diff --git a/internal/apmschema/jsonschema/span_subtype.json b/internal/apmschema/jsonschema/span_subtype.json deleted file mode 100644 index 93fc45947..000000000 --- a/internal/apmschema/jsonschema/span_subtype.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "$id": "docs/spec/span_subtype.json", - "title": "Span Subtype", - "type": ["object"], - "properties": { - "subtype": { - "type": ["string", "null"], - "description": "A further sub-division of the type (e.g. postgresql, elasticsearch)", - "maxLength": 1024 - } - } -} diff --git a/internal/apmschema/jsonschema/span_type.json b/internal/apmschema/jsonschema/span_type.json deleted file mode 100644 index 772058add..000000000 --- a/internal/apmschema/jsonschema/span_type.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "$id": "docs/spec/span_type.json", - "title": "Span Type", - "type": ["object"], - "properties": { - "type": { - "type": "string", - "description": "Keyword of specific relevance in the service's domain (eg: 'db.postgresql.query', 'template.erb', etc)", - "maxLength": 1024 - } - } -} diff --git a/internal/apmschema/jsonschema/spans/span.json b/internal/apmschema/jsonschema/spans/span.json deleted file mode 100644 index 9db6bea9c..000000000 --- a/internal/apmschema/jsonschema/spans/span.json +++ /dev/null @@ -1,235 +0,0 @@ -{ - "$id": "docs/spec/spans/span.json", - "type": "object", - "description": "An event captured by an agent occurring in a monitored service", - "allOf": [ - { "$ref": "../timestamp_epoch.json" }, - { "$ref": "../span_type.json" }, - { "$ref": "../span_subtype.json" }, - { - "properties": { - "id": { - "description": "Hex encoded 64 random bits ID of the span.", - "type": "string", - "maxLength": 1024 - }, - "transaction_id": { - "type": ["string", "null"], - "description": "Hex encoded 64 random bits ID of the correlated 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.", - "type": "string", - "maxLength": 1024 - }, - "child_ids": { - "description": "List of successor transactions and/or spans.", - "type": ["array", "null"], - "minItems": 0, - "maxLength": 1024, - "items": { - "type": "string", - "maxLength": 1024 - } - }, - "start": { - "type": ["number", "null"], - "description": "Offset relative to the transaction's timestamp identifying the start of the span, in milliseconds" - }, - "sample_rate": { - "description": "Sampling rate", - "type": ["number", "null"] - }, - "action": { - "type": ["string", "null"], - "description": "The specific kind of event within the sub-type represented by the span (e.g. query, connect)", - "maxLength": 1024 - }, - "outcome": { - "$ref": "../outcome.json", - "description": "The outcome of the span: success, failure, or unknown. Outcome may be one of a limited set of permitted values describing the success or failure of the span. This field can be used for calculating error rates for outgoing requests." - }, - "context": { - "type": ["object", "null"], - "description": "Any other arbitrary data captured by the agent, optionally provided by the user", - "properties": { - "destination": { - "type": ["object", "null"], - "description": "An object containing contextual data about the destination for spans", - "properties": { - "address": { - "type": ["string", "null"], - "description": "Destination network address: hostname (e.g. 'localhost'), FQDN (e.g. 'elastic.co'), IPv4 (e.g. '127.0.0.1') or IPv6 (e.g. '::1')", - "maxLength": 1024 - }, - "port": { - "type": ["integer", "null"], - "description": "Destination network port (e.g. 443)" - }, - "service": { - "description": "Destination service context", - "type": ["object", "null"], - "properties": { - "type": { - "description": "Type of the destination service (e.g. 'db', 'elasticsearch'). Should typically be the same as span.type.", - "type": ["string", "null"], - "maxLength": 1024 - }, - "name": { - "description": "Identifier for the destination service (e.g. 'http://elastic.co', 'elasticsearch', 'rabbitmq')", - "type": ["string", "null"], - "maxLength": 1024 - }, - "resource": { - "description": "Identifier for the destination service resource being operated on (e.g. 'http://elastic.co:80', 'elasticsearch', 'rabbitmq/queue_name')", - "type": ["string", "null"], - "maxLength": 1024 - } - }, - "required": ["type", "name", "resource"] - } - } - }, - "db": { - "type": ["object", "null"], - "description": "An object containing contextual data for database spans", - "properties": { - "instance": { - "type": ["string", "null"], - "description": "Database instance name" - }, - "link": { - "type": ["string", "null"], - "maxLength": 1024, - "description": "Database link" - }, - "statement": { - "type": ["string", "null"], - "description": "A database statement (e.g. query) for the given database type" - }, - "type": { - "type": ["string", "null"], - "description": "Database type. For any SQL database, \"sql\". For others, the lower-case database category, e.g. \"cassandra\", \"hbase\", or \"redis\"" - }, - "user": { - "type": ["string", "null"], - "description": "Username for accessing database" - }, - "rows_affected": { - "type": ["integer", "null"], - "description": "Number of rows affected by the SQL statement (if applicable)" - } - } - }, - "http": { - "type": ["object", "null"], - "description": "An object containing contextual data of the related http request.", - "properties": { - "url": { - "type": ["string", "null"], - "description": "The raw url of the correlating http request." - }, - "status_code": { - "type": ["integer", "null"], - "description": "Deprecated: Use span.context.http.response.status_code instead." - }, - "method": { - "type": ["string", "null"], - "maxLength": 1024, - "description": "The method of the http request." - }, - "response": { - "$ref": "../http_response.json" - } - } - }, - "tags": { - "$ref": "../tags.json" - }, - "service": { - "description": "Service related information can be sent per event. Provided information will override the more generic information from metadata, non provided fields will be set according to the metadata information.", - "properties": { - "agent": { - "description": "Name and version of the Elastic APM agent", - "type": [ - "object", - "null" - ], - "properties": { - "name": { - "description": "Name of the Elastic APM agent, e.g. \"Python\"", - "type": [ - "string", - "null" - ], - "maxLength": 1024 - }, - "version": { - "description": "Version of the Elastic APM agent, e.g.\"1.0.0\"", - "type": [ - "string", - "null" - ], - "maxLength": 1024 - }, - "ephemeral_id": { - "description": "Free format ID used for metrics correlation by some agents", - "type": ["string", "null"], - "maxLength": 1024 - } - } - }, - "name": { - "description": "Immutable name of the service emitting this event", - "type": [ - "string", - "null" - ], - "pattern": "^[a-zA-Z0-9 _-]+$", - "maxLength": 1024 - } - } - }, - "message": { - "$ref": "../message.json" - } - } - }, - "duration": { - "type": "number", - "description": "Duration of the span in milliseconds", - "minimum": 0 - }, - "name": { - "type": "string", - "description": "Generic designation of a span in the scope of a transaction", - "maxLength": 1024 - }, - "stacktrace": { - "type": ["array", "null"], - "description": "List of stack frames with variable attributes (eg: lineno, filename, etc)", - "items": { - "$ref": "../stacktrace_frame.json" - }, - "minItems": 0 - }, - "sync": { - "type": ["boolean", "null"], - "description": "Indicates whether the span was executed synchronously or asynchronously." - } - }, - "required": ["duration", "name", "type", "id","trace_id", "parent_id"] - }, - { "anyOf":[ - {"required": ["timestamp"], "properties": {"timestamp": { "type": "integer" }}}, - {"required": ["start"], "properties": {"start": { "type": "number" }}} - ] - } - ] -} diff --git a/internal/apmschema/jsonschema/stacktrace_frame.json b/internal/apmschema/jsonschema/stacktrace_frame.json deleted file mode 100644 index 59772329b..000000000 --- a/internal/apmschema/jsonschema/stacktrace_frame.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "$id": "docs/spec/stacktrace_frame.json", - "title": "Stacktrace", - "type": "object", - "description": "A stacktrace frame, contains various bits (most optional) describing the context of the frame", - "properties": { - "abs_path": { - "description": "The absolute path of the file involved in the stack frame", - "type": ["string", "null"] - }, - "colno": { - "description": "Column number", - "type": ["integer", "null"] - }, - "context_line": { - "description": "The line of code part of the stack frame", - "type": ["string", "null"] - }, - "filename": { - "description": "The relative filename of the code involved in the stack frame, used e.g. to do error checksumming", - "type": ["string", "null"] - }, - "classname": { - "description": "The classname of the code involved in the stack frame", - "type": ["string", "null"] - }, - "function": { - "description": "The function involved in the stack frame", - "type": ["string", "null"] - }, - "library_frame": { - "description": "A boolean, indicating if this frame is from a library or user code", - "type": ["boolean", "null"] - }, - "lineno": { - "description": "The line number of code part of the stack frame, used e.g. to do error checksumming", - "type": ["integer", "null"] - }, - "module": { - "description": "The module to which frame belongs to", - "type": ["string", "null"] - }, - "post_context": { - "description": "The lines of code after the stack frame", - "type": ["array", "null"], - "minItems": 0, - "items": { - "type": "string" - } - }, - "pre_context": { - "description": "The lines of code before the stack frame", - "type": ["array", "null"], - "minItems": 0, - "items": { - "type": "string" - } - }, - "vars": { - "description": "Local variables for this stack frame", - "type": ["object", "null"], - "properties": {} - } - }, - "anyOf": [ - { "required": ["filename"], "properties": {"filename": { "type": "string" }} }, - { "required": ["classname"], "properties": {"classname": { "type": "string" }} } - ] -} diff --git a/internal/apmschema/jsonschema/system.json b/internal/apmschema/jsonschema/system.json deleted file mode 100644 index 892cc9e99..000000000 --- a/internal/apmschema/jsonschema/system.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "$id": "docs/spec/system.json", - "title": "System", - "type": ["object", "null"], - "properties": { - "architecture": { - "description": "Architecture of the system the agent is running on.", - "type": ["string", "null"], - "maxLength": 1024 - }, - "hostname": { - "description": "Deprecated. Hostname of the system the agent is running on. Will be ignored if kubernetes information is set.", - "type": ["string", "null"], - "maxLength": 1024 - }, - "detected_hostname": { - "description": "Hostname of the host the monitored service is running on. It normally contains what the hostname command returns on the host machine. Will be ignored if kubernetes information is set, otherwise should always be set.", - "type": ["string", "null"], - "maxLength": 1024 - }, - "configured_hostname": { - "description": "Name of the host the monitored service is running on. It should only be set when configured by the user. If empty, will be set to detected_hostname or derived from kubernetes information if provided.", - "type": ["string", "null"], - "maxLength": 1024 - }, - "platform": { - "description": "Name of the system platform the agent is running on.", - "type": ["string", "null"], - "maxLength": 1024 - }, - "container": { - "properties": { - "id" : { - "description": "Container ID", - "type": ["string"], - "maxLength": 1024 - } - }, - "required": ["id"] - }, - "kubernetes": { - "properties": { - "namespace": { - "description": "Kubernetes namespace", - "type": ["string", "null"], - "maxLength": 1024 - }, - "pod":{ - "properties": { - "name": { - "description": "Kubernetes pod name", - "type": ["string", "null"], - "maxLength": 1024 - }, - "uid": { - "description": "Kubernetes pod uid", - "type": ["string", "null"], - "maxLength": 1024 - } - } - }, - "node":{ - "properties": { - "name": { - "description": "Kubernetes node name", - "type": ["string", "null"], - "maxLength": 1024 - } - } - } - } - } - } -} diff --git a/internal/apmschema/jsonschema/tags.json b/internal/apmschema/jsonschema/tags.json deleted file mode 100644 index ead09da3f..000000000 --- a/internal/apmschema/jsonschema/tags.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "$id": "docs/spec/tags.json", - "title": "Tags", - "type": ["object", "null"], - "description": "A flat mapping of user-defined tags with string, boolean or number values.", - "patternProperties": { - "^[^.*\"]*$": { - "type": ["string", "boolean", "number", "null"], - "maxLength": 1024 - } - }, - "additionalProperties": false -} diff --git a/internal/apmschema/jsonschema/timestamp_epoch.json b/internal/apmschema/jsonschema/timestamp_epoch.json deleted file mode 100644 index 7e6aea39d..000000000 --- a/internal/apmschema/jsonschema/timestamp_epoch.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "$id": "docs/spec/timestamp_epoch.json", - "title": "Timestamp Epoch", - "description": "Object with 'timestamp' property.", - "type": ["object"], - "properties": { - "timestamp": { - "description": "Recorded time of the event, UTC based and formatted as microseconds since Unix epoch", - "type": ["integer", "null"] - } - } -} diff --git a/internal/apmschema/jsonschema/transaction.json b/internal/apmschema/jsonschema/transaction.json new file mode 100644 index 000000000..0d02d3d73 --- /dev/null +++ b/internal/apmschema/jsonschema/transaction.json @@ -0,0 +1,747 @@ +{ + "$id": "docs/spec/v2/transaction", + "type": "object", + "properties": { + "context": { + "description": "Context holds arbitrary contextual information for the event.", + "type": [ + "null", + "object" + ], + "properties": { + "custom": { + "description": "Custom can contain additional metadata to be stored with the event. The format is unspecified and can be deeply nested objects. The information will not be indexed or searchable in Elasticsearch.", + "type": [ + "null", + "object" + ] + }, + "experimental": { + "description": "Experimental information is only processed when APM Server is started in development mode and should only be used by APM agent developers implementing new, unreleased features. The format is unspecified." + }, + "message": { + "description": "Message holds details related to message receiving and publishing if the captured event integrates with a messaging system", + "type": [ + "null", + "object" + ], + "properties": { + "age": { + "description": "Age of the message. If the monitored messaging framework provides a timestamp for the message, agents may use it. Otherwise, the sending agent can add a timestamp in milliseconds since the Unix epoch to the message's metadata to be retrieved by the receiving agent. If a timestamp is not available, agents should omit this field.", + "type": [ + "null", + "object" + ], + "properties": { + "ms": { + "description": "Age of the message in milliseconds.", + "type": [ + "null", + "integer" + ] + } + } + }, + "body": { + "description": "Body of the received message, similar to an HTTP request body", + "type": [ + "null", + "string" + ] + }, + "headers": { + "description": "Headers received with the message, similar to HTTP request headers.", + "type": [ + "null", + "object" + ], + "additionalProperties": false, + "patternProperties": { + "[.*]*$": { + "type": [ + "null", + "array", + "string" + ], + "items": { + "type": "string" + } + } + } + }, + "queue": { + "description": "Queue holds information about the message queue where the message is received.", + "type": [ + "null", + "object" + ], + "properties": { + "name": { + "description": "Name holds the name of the message queue where the message is received.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + } + } + }, + "page": { + "description": "Page holds information related to the current page and page referers. It is only sent from RUM agents.", + "type": [ + "null", + "object" + ], + "properties": { + "referer": { + "description": "Referer holds the URL of the page that 'linked' to the current page.", + "type": [ + "null", + "string" + ] + }, + "url": { + "description": "URL of the current page", + "type": [ + "null", + "string" + ] + } + } + }, + "request": { + "description": "Request describes the HTTP request information in case the event was created as a result of an HTTP request.", + "type": [ + "null", + "object" + ], + "properties": { + "body": { + "description": "Body only contais the request bod, not the query string information. It can either be a dictionary (for standard HTTP requests) or a raw request body.", + "type": [ + "null", + "string", + "object" + ] + }, + "cookies": { + "description": "Cookies used by the request, parsed as key-value objects.", + "type": [ + "null", + "object" + ] + }, + "env": { + "description": "Env holds environment variable information passed to the monitored service.", + "type": [ + "null", + "object" + ] + }, + "headers": { + "description": "Headers includes any HTTP headers sent by the requester. Cookies will be taken by headers if supplied.", + "type": [ + "null", + "object" + ], + "additionalProperties": false, + "patternProperties": { + "[.*]*$": { + "type": [ + "null", + "array", + "string" + ], + "items": { + "type": "string" + } + } + } + }, + "http_version": { + "description": "HTTPVersion holds information about the used HTTP version.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "method": { + "description": "Method holds information about the method of the HTTP request.", + "type": "string", + "maxLength": 1024 + }, + "socket": { + "description": "Socket holds information related to the recorded request, such as whether or not data were encrypted and the remote address.", + "type": [ + "null", + "object" + ], + "properties": { + "encrypted": { + "description": "Encrypted indicates whether a request was sent as TLS/HTTPS request.", + "type": [ + "null", + "boolean" + ] + }, + "remote_address": { + "description": "RemoteAddress holds the network address sending the request. It should be obtained through standard APIs and not be parsed from any headers like 'Forwarded'.", + "type": [ + "null", + "string" + ] + } + } + }, + "url": { + "description": "URL holds information sucha as the raw URL, scheme, host and path.", + "type": [ + "null", + "object" + ], + "properties": { + "full": { + "description": "Full, possibly agent-assembled URL of the request, e.g. https://example.com:443/search?q=elasticsearch#top.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "hash": { + "description": "Hash of the request URL, e.g. 'top'", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "hostname": { + "description": "Hostname information of the request, e.g. 'example.com'.\"", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "pathname": { + "description": "Path of the request, e.g. '/search'", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "port": { + "description": "Port of the request, e.g. '443'. Can be sent as string or int.", + "type": [ + "null", + "string", + "integer" + ], + "maxLength": 1024 + }, + "protocol": { + "description": "Protocol information for the recorded request, e.g. 'https:'.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "raw": { + "description": "Raw unparsed URL of the HTTP request line, e.g https://example.com:443/search?q=elasticsearch. This URL may be absolute or relative. For more details, see https://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "search": { + "description": "Search contains the query string information of the request. It is expected to have values delimited by ampersands.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + } + }, + "required": [ + "method" + ] + }, + "response": { + "description": "Response describes the HTTP response information in case the event was created as a result of an HTTP request.", + "type": [ + "null", + "object" + ], + "properties": { + "decoded_body_size": { + "description": "DecodedBodySize holds the size of the decoded payload.", + "type": [ + "null", + "number" + ] + }, + "encoded_body_size": { + "description": "EncodedBodySize holds the size of the encoded payload.", + "type": [ + "null", + "number" + ] + }, + "finished": { + "description": "Finished indicates whether the response was finished or not.", + "type": [ + "null", + "boolean" + ] + }, + "headers": { + "description": "Headers holds the http headers sent in the http response.", + "type": [ + "null", + "object" + ], + "additionalProperties": false, + "patternProperties": { + "[.*]*$": { + "type": [ + "null", + "array", + "string" + ], + "items": { + "type": "string" + } + } + } + }, + "headers_sent": { + "description": "HeadersSent indicates whether http headers were sent.", + "type": [ + "null", + "boolean" + ] + }, + "status_code": { + "description": "StatusCode sent in the http response.", + "type": [ + "null", + "integer" + ] + }, + "transfer_size": { + "description": "TransferSize holds the total size of the payload.", + "type": [ + "null", + "number" + ] + } + } + }, + "service": { + "description": "Service related information can be sent per event. Information provided here will override the more generic information retrieved from metadata, missing service fields will be retrieved from the metadata information.", + "type": [ + "null", + "object" + ], + "properties": { + "agent": { + "description": "Agent holds information about the APM agent capturing the event.", + "type": [ + "null", + "object" + ], + "properties": { + "ephemeral_id": { + "description": "EphemeralID is a free format ID used for metrics correlation by agents", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "name": { + "description": "Name of the APM agent capturing information.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "version": { + "description": "Version of the APM agent capturing information.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "environment": { + "description": "Environment in which the monitored service is running, e.g. `production` or `staging`.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "framework": { + "description": "Framework holds information about the framework used in the monitored service.", + "type": [ + "null", + "object" + ], + "properties": { + "name": { + "description": "Name of the used framework", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "version": { + "description": "Version of the used framework", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "language": { + "description": "Language holds information about the programming language of the monitored service.", + "type": [ + "null", + "object" + ], + "properties": { + "name": { + "description": "Name of the used programming language", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "version": { + "description": "Version of the used programming language", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "name": { + "description": "Name of the monitored service.", + "type": [ + "null", + "string" + ], + "maxLength": 1024, + "pattern": "^[a-zA-Z0-9 _-]+$" + }, + "node": { + "description": "Node must be a unique meaningful name of the service node.", + "type": [ + "null", + "object" + ], + "properties": { + "configured_name": { + "description": "Name of the service node", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "runtime": { + "description": "Runtime holds information about the language runtime running the monitored service", + "type": [ + "null", + "object" + ], + "properties": { + "name": { + "description": "Name of the language runtime", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "version": { + "description": "Version of the language runtime", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "version": { + "description": "Version of the monitored service.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + }, + "tags": { + "description": "Tags are a flat mapping of user-defined tags. Allowed value types are string, boolean and number values. Tags are indexed and searchable.", + "type": [ + "null", + "object" + ], + "additionalProperties": { + "type": [ + "null", + "string", + "boolean", + "number" + ], + "maxLength": 1024 + } + }, + "user": { + "description": "User holds information about the correlated user for this event. If user data are provided here, all user related information from metadata is ignored, otherwise the metadata's user information will be stored with the event.", + "type": [ + "null", + "object" + ], + "properties": { + "email": { + "description": "Email of the user.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "id": { + "description": "ID identifies the logged in user, e.g. can be the primary key of the user", + "type": [ + "null", + "string", + "integer" + ], + "maxLength": 1024 + }, + "username": { + "description": "Name of the user.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + } + } + } + } + }, + "duration": { + "description": "Duration how long the transaction took to complete, in milliseconds with 3 decimal points.", + "type": "number", + "minimum": 0 + }, + "experience": { + "description": "UserExperience holds metrics for measuring real user experience. This information is only sent by RUM agents.", + "type": [ + "null", + "object" + ], + "properties": { + "cls": { + "description": "CumulativeLayoutShift holds the Cumulative Layout Shift (CLS) metric value, or a negative value if CLS is unknown. See https://web.dev/cls/", + "type": [ + "null", + "number" + ], + "minimum": 0 + }, + "fid": { + "description": "FirstInputDelay holds the First Input Delay (FID) metric value, or a negative value if FID is unknown. See https://web.dev/fid/", + "type": [ + "null", + "number" + ], + "minimum": 0 + }, + "longtask": { + "description": "Longtask holds longtask duration/count metrics.", + "type": [ + "null", + "object" + ], + "properties": { + "count": { + "description": "Count is the total number of of longtasks.", + "type": "integer", + "minimum": 0 + }, + "max": { + "description": "Max longtask duration", + "type": "number", + "minimum": 0 + }, + "sum": { + "description": "Sum of longtask durations", + "type": "number", + "minimum": 0 + } + }, + "required": [ + "count", + "max", + "sum" + ] + }, + "tbt": { + "description": "TotalBlockingTime holds the Total Blocking Time (TBT) metric value, or a negative value if TBT is unknown. See https://web.dev/tbt/", + "type": [ + "null", + "number" + ], + "minimum": 0 + } + } + }, + "id": { + "description": "ID holds the hex encoded 64 random bits ID of the event.", + "type": "string", + "maxLength": 1024 + }, + "marks": { + "description": "Marks capture 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. Marks are only reported by RUM agents.", + "type": [ + "null", + "object" + ], + "additionalProperties": { + "type": [ + "null", + "object" + ], + "additionalProperties": { + "type": [ + "null", + "number" + ] + } + } + }, + "name": { + "description": "Name is the generic designation of a transaction in the scope of a single service, eg: 'GET /users/:id'.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "outcome": { + "description": "Outcome of the transaction with a limited set of permitted values, describing the success or failure of the transaction from the service's perspective. It is used for calculating error rates for incoming requests. Permitted values: success, failure, unknown.", + "type": [ + "null", + "string" + ], + "enum": [ + "success", + "failure", + "unknown", + null + ] + }, + "parent_id": { + "description": "ParentID holds the hex encoded 64 random bits ID of the parent transaction or span.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "result": { + "description": "Result of the transaction. For HTTP-related transactions, this should be the status code formatted like 'HTTP 2xx'.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, + "sample_rate": { + "description": "SampleRate applied to the monitored service at the time where this transaction was recorded. Allowed values are [0..1]. A SampleRate \u003c1 indicates that not all spans are recorded.", + "type": [ + "null", + "number" + ] + }, + "sampled": { + "description": "Sampled indicates whether or not the full information for a transaction is captured. If a transaction is unsampled no spans and less context information will be reported.", + "type": [ + "null", + "boolean" + ] + }, + "span_count": { + "description": "SpanCount counts correlated spans.", + "type": "object", + "properties": { + "dropped": { + "description": "Dropped is the number of correlated spans that have been dropped by the APM agent recording the transaction.", + "type": [ + "null", + "integer" + ] + }, + "started": { + "description": "Started is the number of correlated spans that are recorded.", + "type": "integer" + } + }, + "required": [ + "started" + ] + }, + "timestamp": { + "description": "Timestamp holds the recorded time of the event, UTC based and formatted as microseconds since Unix epoch", + "type": [ + "null", + "integer" + ] + }, + "trace_id": { + "description": "TraceID holds the hex encoded 128 random bits ID of the correlated trace.", + "type": "string", + "maxLength": 1024 + }, + "type": { + "description": "Type expresses the transaction's type as keyword that has specific relevance within the service's domain, eg: 'request', 'backgroundjob'.", + "type": "string", + "maxLength": 1024 + } + }, + "required": [ + "duration", + "id", + "span_count", + "trace_id", + "type" + ] +} \ No newline at end of file diff --git a/internal/apmschema/jsonschema/transaction_name.json b/internal/apmschema/jsonschema/transaction_name.json deleted file mode 100644 index 2ecb30e79..000000000 --- a/internal/apmschema/jsonschema/transaction_name.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "$id": "docs/spec/transaction_name.json", - "title": "Transaction Name", - "type": ["object"], - "properties": { - "name": { - "type": ["string","null"], - "description": "Generic designation of a transaction in the scope of a single service (eg: 'GET /users/:id')", - "maxLength": 1024 - } - } -} diff --git a/internal/apmschema/jsonschema/transaction_type.json b/internal/apmschema/jsonschema/transaction_type.json deleted file mode 100644 index c1de2586b..000000000 --- a/internal/apmschema/jsonschema/transaction_type.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "$id": "docs/spec/transaction_type.json", - "title": "Transaction Type", - "type": ["object"], - "properties": { - "type": { - "type": "string", - "description": "Keyword of specific relevance in the service's domain (eg: 'request', 'backgroundjob', etc)", - "maxLength": 1024 - } - } -} diff --git a/internal/apmschema/jsonschema/transactions/mark.json b/internal/apmschema/jsonschema/transactions/mark.json deleted file mode 100644 index deee295be..000000000 --- a/internal/apmschema/jsonschema/transactions/mark.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "$id": "docs/spec/transactions/mark.json", - "type": ["object", "null"], - "description": "A mark captures the timing in milliseconds of a significant event during the lifetime of a transaction. Every mark is a simple key value pair, where the value has to be a number, and can be set by the user or the agent.", - "patternProperties": { - "^[^.*\"]*$": { - "type": ["number", "null"] - } - }, - "additionalProperties": false -} diff --git a/internal/apmschema/jsonschema/transactions/transaction.json b/internal/apmschema/jsonschema/transactions/transaction.json deleted file mode 100644 index c481133d6..000000000 --- a/internal/apmschema/jsonschema/transactions/transaction.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "$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 - }, - "sample_rate": { - "description": "Sampling rate", - "type": ["number", "null"] - }, - "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", - "minimum": 0 - }, - "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 - }, - "outcome": { - "$ref": "../outcome.json", - "description": "The outcome of the transaction: success, failure, or unknown. This is similar to 'result', but has a limited set of permitted values describing the success or failure of the transaction from the service's perspective. This field can be used for calculating error rates for incoming requests." - }, - "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." - }, - "experience": { - "$ref": "../rum_experience.json" - } - }, - "required": ["id", "trace_id", "span_count", "duration", "type"] - } - ] -} diff --git a/internal/apmschema/jsonschema/user.json b/internal/apmschema/jsonschema/user.json deleted file mode 100644 index b122d7eee..000000000 --- a/internal/apmschema/jsonschema/user.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "$id": "docs/spec/user.json", - "title": "User", - "type": ["object", "null"], - "properties": { - "id": { - "description": "Identifier of the logged in user, e.g. the primary key of the user", - "type": ["string", "integer", "null"], - "maxLength": 1024 - }, - "email": { - "description": "Email of the logged in user", - "type": ["string", "null"], - "maxLength": 1024 - }, - "username": { - "description": "The username of the logged in user", - "type": ["string", "null"], - "maxLength": 1024 - } - } -} diff --git a/internal/apmschema/schema.go b/internal/apmschema/schema.go index 412c84988..efcf2af79 100644 --- a/internal/apmschema/schema.go +++ b/internal/apmschema/schema.go @@ -61,9 +61,9 @@ func init() { } *out = schema } - compile("errors/error.json", &Error) + compile("error.json", &Error) compile("metadata.json", &Metadata) - compile("metricsets/metricset.json", &MetricSet) - compile("spans/span.json", &Span) - compile("transactions/transaction.json", &Transaction) + compile("metricset.json", &MetricSet) + compile("span.json", &Span) + compile("transaction.json", &Transaction) } diff --git a/internal/apmschema/update.sh b/internal/apmschema/update.sh index 72527bcd5..dfbef2ca0 100755 --- a/internal/apmschema/update.sh +++ b/internal/apmschema/update.sh @@ -5,37 +5,14 @@ set -ex BRANCH=master FILES=( \ - "errors/error.json" \ - "sourcemaps/payload.json" \ - "spans/span.json" \ - "transactions/mark.json" \ - "transactions/transaction.json" \ - "metricsets/metricset.json" \ - "metricsets/sample.json" \ - "context.json" \ - "cloud.json" \ - "http_response.json" \ - "message.json" \ + "error.json" \ "metadata.json" \ - "outcome.json" \ - "process.json" \ - "request.json" \ - "rum_experience.json" \ - "service.json" \ - "span_subtype.json" \ - "span_type.json" \ - "stacktrace_frame.json" \ - "system.json" \ - "tags.json" \ - "timestamp_epoch.json" \ - "transaction_name.json" \ - "transaction_type.json" \ - "user.json" \ + "metricset.json" \ + "span.json" \ + "transaction.json" \ ) -mkdir -p jsonschema/errors jsonschema/transactions jsonschema/sourcemaps jsonschema/spans jsonschema/metricsets - for i in "${FILES[@]}"; do o=jsonschema/$i - curl -sf https://raw.githubusercontent.com/elastic/apm-server/${BRANCH}/docs/spec/${i} --compressed -o $o + curl -sf https://raw.githubusercontent.com/elastic/apm-server/${BRANCH}/docs/spec/v2/${i} --compressed -o $o done