Skip to content

Latest commit

 

History

History
272 lines (240 loc) · 18.2 KB

File metadata and controls

272 lines (240 loc) · 18.2 KB
description
This page details the types and organization of information recorded by Gravitee reporters

Formats

Supported formats

The same payload can be sent to any of the Gravitee reporters to write the record of events to a particular output. Payload data can be converted to JSON, CSV, or Elasticsearch format, depending on the reporter type:

ReporterJSONCSVElasticsearch
Elasticsearchfalsefalsetrue
Filetruetruetrue
TCPtruetruetrue
Datadogfalsefalsefalse

Expected output

Each reporter writes particular payload data to files that share a common naming convention and structure, regardless of output format. JSON, CSV, and Elasticsearch formats each generate the following files, which pertain to different Gravitee execution engines:

{% tabs %} {% tab title="Common" %} The following file is common to both the legacy and reactive execution engines:

File nameDescription
monitor.json
(or monitor.csv)
Reports the state of a Gravitee node (Gateway, APIM)
{% endtab %}

{% tab title="Legacy" %} The following files pertain to the legacy execution engine only:

File nameDescription
endpoint-status.json
(or endpoint-status.csv)
Pushed as the result of an API healthcheck
metrics.json
(or metrics.csv)
Common metrics related to a specific HTTP request
log.json
(or log.csv)
An in-depth report of an HTTP request, where the body can be appended to the data structure. This file content is configured from the UI (in the logs => configure logging section).
{% endtab %}

{% tab title="Reactive" %} The following files pertain to the reactive execution engine only:

File nameDescription
metrics.json
(or metrics.csv)
Common metrics related to a specific HTTP request
log.json
(or log.csv)
An in-depth report of an HTTP request, where the body can be appended to the data structure. This file content is configured from the UI (in the logs => configure logging section).
message-metrics.json
(or message-metrics.csv)
Same as metrics.json but for an event-driven API
message-log.json
(or message-log.csv)
Same as log.json but for an event-driven API
{% endtab %} {% endtabs %}

Metrics

The metrics recorded for a given payload are similar for all reporters and formats. Below are the metrics for a sample payload in JSON, CSV, and Elasticsearch formats:

{% tabs %} {% tab title="JSON" %} Sample contents of metrics.json:

{% code title="Reactive engine" %}

{
  "timestamp": 1692359213844,
  "requestId": "076aea69-6024-4590-aaea-6960247590a0",
  "transactionId": "076aea69-6024-4590-aaea-6960247590a0",
  "apiId": "5f67b38f-0700-4557-a7b3-8f0700855779",
  "apiType": "proxy",
  "planId": "8463511c-fbed-4ca9-a351-1cfbed9ca99d",
  "applicationId": "91f077b0-1204-49e4-b077-b0120419e4f6",
  "subscriptionId": "318e47e5-349c-4fa4-8e47-e5349c3fa444",
  "clientIdentifier": "318e47e5-349c-4fa4-8e47-e5349c3fa444",
  "httpMethod": "GET",
  "localAddress": "127.0.0.1",
  "remoteAddress": "127.0.0.1",
  "host": "localhost:8082",
  "uri": "/test-v4",
  "pathInfo": "",
  "userAgent": "curl/7.88.1",
  "requestContentLength": -1,
  "requestEnded": true,
  "endpoint": "https://api.gravitee.io/echo",
  "endpointResponseTimeMs": 137,
  "status": 200,
  "responseContentLength": 274,
  "gatewayResponseTimeMs": 144,
  "gatewayLatencyMs": 7
}

{% endcode %}

{% code title="Legacy engine" %}

{
  "timestamp": 1692357381941,
  "proxyResponseTimeMs": 150,
  "proxyLatencyMs": 6,
  "apiResponseTimeMs": 144,
  "requestId": "13f5ae30-068b-4e2d-b5ae-30068bae2d2d",
  "api": "ff3c6c48-53e0-41d6-bc6c-4853e011d656",
  "application": "91f077b0-1204-49e4-b077-b0120419e4f6",
  "transactionId": "13f5ae30-068b-4e2d-b5ae-30068bae2d2d",
  "plan": "e115ea63-7cef-4646-95ea-637cef7646ec",
  "localAddress": "127.0.0.1",
  "remoteAddress": "127.0.0.1",
  "httpMethod": "GET",
  "host": "localhost:8082",
  "uri": "/test",
  "requestContentLength": 0,
  "responseContentLength": 275,
  "status": 200,
  "endpoint": "https://api.gravitee.io/echo",
  "path": "",
  "userAgent": "curl/7.88.1",
  "securityType": "API_KEY",
  "securityToken": "21b560b2-59b8-4a4b-921a-32b3731fdec4",
  "subscription": "04975880-f147-43bc-9758-80f147e3bcbb",
  "customMetrics": {
    "zone": "europe-north1-a"
  }
}

{% endcode %} {% endtab %}

{% tab title="CSV" %} Sample contents of metrics.csv:

{% code title="Reactive engine" %}

"076aea69-6024-4590-aaea-6960247590a0";
"076aea69-6024-4590-aaea-6960247590a0";
1692359213844;
"127.0.0.1";
"127.0.0.1";
"5f67b38f-0700-4557-a7b3-8f0700855779";
"91f077b0-1204-49e4-b077-b0120419e4f6";
"8463511c-fbed-4ca9-a351-1cfbed9ca99d";
"318e47e5-349c-4fa4-8e47-e5349c3fa444";
"";
"";
"/test-v4";
"";
"";
"GET";
200;
"https://api.gravitee.io/echo";
"";
"";
"curl/7.88.1";
"localhost:8082";
-1;
274;
137;
144;
7;
"";
""

{% endcode %}

{% code title="Legacy engine" %}

"13f5ae30-068b-4e2d-b5ae-30068bae2d2d";
"13f5ae30-068b-4e2d-b5ae-30068bae2d2d";
1692357381941;
"127.0.0.1";
"127.0.0.1";
"ff3c6c48-53e0-41d6-bc6c-4853e011d656";
"91f077b0-1204-49e4-b077-b0120419e4f6";
"e115ea63-7cef-4646-95ea-637cef7646ec";
"04975880-f147-43bc-9758-80f147e3bcbb";
"";
"";
"/test";
"";
"";
"GET";
200;
"https://api.gravitee.io/echo";
"";
"";
"curl/7.88.1";
"localhost:8082";
0;
275;
144;
150;
6;
"API_KEY";
"ff3c6c48-53e0-41d6-bc6c-4853e011d656";
"europe-north1-a"

{% endcode %} {% endtab %}

{% tab title="Elasticsearch" %} Sample contents of metrics.json:

{% code title="Reactive engine" %}

{
  "type": "v4-metrics",
  "date": "2023.08.18",
  "_id": "076aea69-6024-4590-aaea-6960247590a0",
  "gateway": "gateway-id",
  "@timestamp": "2023-08-18T11:46:53.844Z",
  "request-id": "076aea69-6024-4590-aaea-6960247590a0",
  "client-identifier": "318e47e5-349c-4fa4-8e47-e5349c3fa444",
  "transaction-id": "076aea69-6024-4590-aaea-6960247590a0",
  "api-id": "5f67b38f-0700-4557-a7b3-8f0700855779",
  "plan-id": "8463511c-fbed-4ca9-a351-1cfbed9ca99d",
  "application-id": "91f077b0-1204-49e4-b077-b0120419e4f6",
  "subscription-id": "318e47e5-349c-4fa4-8e47-e5349c3fa444",
  "http-method": 3,
  "local-address": "127.0.0.1",
  "remote-address": "127.0.0.1",
  "host": "localhost:8082",
  "uri": "/test-v4",
  "path-info": "",
  "user-agent": "",
  "request-ended": "true",
  "endpoint": "https://api.gravitee.io/echo",
  "endpoint-response-time-ms": 137,
  "status": 200,
  "response-content-length": 274,
  "gateway-response-time-ms": 144,
  "gateway-latency-ms": 7
}

{% endcode %}

{% code title="Legacy engine" %}

{
  "gateway": "gateway-id",
  "@timestamp": "2023-08-18T11:16:21.941Z",
  "type": "request",
  "date": "2023.08.18",
  "_id": "13f5ae30-068b-4e2d-b5ae-30068bae2d2d",
  "transaction": "13f5ae30-068b-4e2d-b5ae-30068bae2d2d",
  "method": 3,
  "uri": "/test",
  "status": 200,
  "response-time": 150,
  "api-response-time": 144,
  "proxy-latency": 6,
  "request-content-length": 0,
  "response-content-length": 275,
  "plan": "e115ea63-7cef-4646-95ea-637cef7646ec",
  "api": "ff3c6c48-53e0-41d6-bc6c-4853e011d656",
  "application": "91f077b0-1204-49e4-b077-b0120419e4f6",
  "local-address": "127.0.0.1",
  "remote-address": "127.0.0.1",
  "endpoint": "https://api.gravitee.io/echo",
  "path": "",
  "host": "localhost:8082",
  "user-agent": "",
  "security-type": "API_KEY",
  "security-token": "21b560b2-59b8-4a4b-921a-32b3731fdec4",
  "subscription": "04975880-f147-43bc-9758-80f147e3bcbb",
  "custom": {
    "zone": "europe-north1-a"
  }
}

{% endcode %} {% endtab %} {% endtabs %}

Depending on which execution engine is used, equivalent fields observe slightly different naming conventions. The number of fields also differs slightly due to differences in execution engine.

Field definitions

The following table maps field names between JSON and Elasticsearch formats and provides a description for each.

Naming conventions are consistent within a certain format. Although there is significant overlap, the specific fields that are generated depend on which execution engine and format are used. The table below compares data recorded with the reactive engine.

JSONElasticsearchDescription
timestamp@timestampThe timestamp of the transaction in milliseconds. Elasticsearch formats the @timestamp field as an ISO 8601 string.
dateThis field is only added if the Elasticsearch format is used with the TCP or file reporter. It enables building the index name in your ingest pipeline (e.g., when using Logstash).
typeThis field is only added if the Elasticsearch format is used with the TCP or file reporter. It enables building the index name in your ingest pipeline (e.g., when using Logstash).
requestIDrequest-idUniversally Unique Identifier (UUID) identifying the request.
_idIf you are using Elasticsearch format, the content of the _id and request-id fields will be identical.
transactionIDtransaction-idThis ID can be used to track end-to-end transactions spanning across multiple HTTP requests. The Gateway configuration allows defining an expected correlation ID header passed by a client request. If this header is set, the content of this field will be set to the value of the header. If no correlation header has been passed, the content of this field will be the same as the content of the request ID. This value will be propagated to the upstream service using the correlation header defined in the configuration (the default header is X-Gravitee-Transaction-Id).
apiIDapi-idThe API ID.
apiTypetypeThe API type (can be either "proxy" or "message").
planIDplan-idThe plan ID.
applicationIDapplication-idThe application ID. For a keyless plan, this value is "1".
subscriptionIDsubscription-idThe subscription ID. For a keyless plan, this value will be the same as the value of the remote address field.
useruserThe authenticated user, if any type of security was used when processing the request.
securityTypesecurity-typeThe security type, if security was used when processing the request (can be either API_KEY, OAUTH2 or JWT).
securityTokensecurity-tokenThe security token, if any type of security was used when processing the request.
clientIdentifierclient-identifierThis field identifies the client of the request. It is either the subscription ID (if any) or, for a keyless plan, a hash of the remote address. The Client-Identifier can be provided by the client using the header X-Gravitee-Client-Identifier; in this case, the value used by Gravitee will be the original inferred value suffixed with the overridden value.
httpMethodhttp-methodThe HTTP method used to perform the client request.
localAddresslocal-addressThe address used as a destination when the incoming request was issued by the client.
remoteAddressremote-addressThe remote address used as a source when the incoming request was issued by the client.
hosthostThe content of the Host header, passed when the incoming request was issued by the client.
uriuriThe URI used by the client to perform its request (this includes the context path of the request and query parameters).
path-infopath-infoThe path used to perform the client request (starting from the context path of the API).
mappedPathmapped-pathIf a path mapping has been defined to group requests in your analytics, this is the value of your mapping.
userAgentuser-agentThe content of the User-Agent header, passed by the client when the incoming request was issued.
requestContentLengthThe size of the body, in bytes, of the incoming request issued by the Gateway client.
requestEndedrequest-endedFlag to indicate if the request completed.
endpointendpointThe URL used by the proxy to forward the request to the upstream service.
endpointResponseTimeMsendpoint-response-time-msThe time (ms) it takes the upstream service to respond to the Gateway proxy.
statusstatusThe HTTP status code of the transaction.
responseContentLengthresponse-content-lengthThe size of the body, in bytes, of the response received by the Gateway client.
gatewayResponseTimeMsgateway-response-time-msThe time (ms) it takes the Gateway to respond to the client (this includes the roundtrip between the Gateway and the upstream service).
gatewayLatencyMsgateway-latency-msThe overhead added by the Gateway when forwarding the request upstream and the response back to the client.
gatewayA UUID identifying the Gateway instance handling the request.
errorKeyerror-keyIf the policy chain was interrupted by an error, this key identifies the error type.
errorMessageerror-messageA more detailed explanation of the error associated with the error key (if any).
customcustomCustom metrics defined via the assign-metrics policy will be added to this dictionary.

CSV format

Files formatted as CSV do not include a key. Use the following table to map the offset of metrics data recorded with the reactive engine to the corresponding field:

OffsetFieldSample value
0transactionID076aea69-6024-4590-aaea-6960247590a0
1requestID076aea69-6024-4590-aaea-6960247590a0
2timestamp1692359213844
3remoteAddress127.0.0.1
4localAddress127.0.0.1
5apiID5f67b38f-0700-4557-a7b3-8f0700855779
6applicationID91f077b0-1204-49e4-b077-b0120419e4f6
7planID8463511c-fbed-4ca9-a351-1cfbed9ca99d
8subscriptionID318e47e5-349c-4fa4-8e47-e5349c3fa444
9user5f2dd42f-610b-4719-ae39-8ccf7243047e
10tenant
11uri/test-v4
12path/
13mappedPath/:anyPath
14httpMethodGET
15status200
16endpointhttps://api.gravitee.io/echo
17errorKeyGATEWAY_OAUTH2_ACCESS_DENIED
18errorMessage
19userAgentcurl/7.88.1
20hostapi.example.com
21requestContent-1
22responseContent274
23endpointResponseTimeMs137
24gatewayResponseTimeMs144
25gatewayLatencyMs7
26securityTypeOAUTH2
27securityToken6d8772c9-3336-4ede-8ffd-4852cfb85f95
28customMetrics[0]