mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[APM] Remove v1 and make required ECS changes (#28068)
* [APM] ECS changes * Remove ambient types for idx * Update `observer.listening` * Added type safety to property config * More ECS updates * Juan fixes for ECS
This commit is contained in:
parent
5b6ecbc4c9
commit
9d33143ff9
79 changed files with 816 additions and 1401 deletions
|
@ -91,7 +91,7 @@ export function onPremInstructions(apmIndexPattern) {
|
|||
bool: {
|
||||
filter: {
|
||||
exists: {
|
||||
field: 'listening',
|
||||
field: 'observer.listening',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -182,7 +182,6 @@
|
|||
"history-extra": "^4.0.2",
|
||||
"humps": "2.0.1",
|
||||
"icalendar": "0.7.1",
|
||||
"idx": "^2.5.2",
|
||||
"inline-style": "^2.0.0",
|
||||
"intl": "^1.2.5",
|
||||
"io-ts": "^1.4.2",
|
||||
|
|
|
@ -1,361 +1,217 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Error v2 ERROR_CULPRIT 1`] = `"handleOopsie"`;
|
||||
exports[`Error ERROR_CULPRIT 1`] = `"handleOopsie"`;
|
||||
|
||||
exports[`Error v2 ERROR_EXC_HANDLED 1`] = `false`;
|
||||
exports[`Error ERROR_EXC_HANDLED 1`] = `false`;
|
||||
|
||||
exports[`Error v2 ERROR_EXC_MESSAGE 1`] = `"sonic boom"`;
|
||||
exports[`Error ERROR_EXC_MESSAGE 1`] = `"sonic boom"`;
|
||||
|
||||
exports[`Error v2 ERROR_EXC_STACKTRACE 1`] = `undefined`;
|
||||
exports[`Error ERROR_EXC_STACKTRACE 1`] = `undefined`;
|
||||
|
||||
exports[`Error v2 ERROR_GROUP_ID 1`] = `"grouping key"`;
|
||||
exports[`Error ERROR_GROUP_ID 1`] = `"grouping key"`;
|
||||
|
||||
exports[`Error v2 ERROR_LOG_MESSAGE 1`] = `undefined`;
|
||||
exports[`Error ERROR_LOG_MESSAGE 1`] = `undefined`;
|
||||
|
||||
exports[`Error v2 ERROR_LOG_STACKTRACE 1`] = `undefined`;
|
||||
exports[`Error ERROR_LOG_STACKTRACE 1`] = `undefined`;
|
||||
|
||||
exports[`Error v2 METRIC_PROCESS_CPU_PERCENT 1`] = `undefined`;
|
||||
exports[`Error METRIC_PROCESS_CPU_PERCENT 1`] = `undefined`;
|
||||
|
||||
exports[`Error v2 METRIC_PROCESS_MEMORY_RSS 1`] = `undefined`;
|
||||
exports[`Error METRIC_PROCESS_MEMORY_RSS 1`] = `undefined`;
|
||||
|
||||
exports[`Error v2 METRIC_PROCESS_MEMORY_SIZE 1`] = `undefined`;
|
||||
exports[`Error METRIC_PROCESS_MEMORY_SIZE 1`] = `undefined`;
|
||||
|
||||
exports[`Error v2 METRIC_SYSTEM_CPU_PERCENT 1`] = `undefined`;
|
||||
exports[`Error METRIC_SYSTEM_CPU_PERCENT 1`] = `undefined`;
|
||||
|
||||
exports[`Error v2 METRIC_SYSTEM_FREE_MEMORY 1`] = `undefined`;
|
||||
exports[`Error METRIC_SYSTEM_FREE_MEMORY 1`] = `undefined`;
|
||||
|
||||
exports[`Error v2 METRIC_SYSTEM_TOTAL_MEMORY 1`] = `undefined`;
|
||||
exports[`Error METRIC_SYSTEM_TOTAL_MEMORY 1`] = `undefined`;
|
||||
|
||||
exports[`Error v2 PARENT_ID 1`] = `"parentId"`;
|
||||
exports[`Error OBSERVER_LISTENING 1`] = `undefined`;
|
||||
|
||||
exports[`Error v2 PROCESSOR_EVENT 1`] = `"error"`;
|
||||
exports[`Error PARENT_ID 1`] = `"parentId"`;
|
||||
|
||||
exports[`Error v2 PROCESSOR_NAME 1`] = `"error"`;
|
||||
exports[`Error PROCESSOR_EVENT 1`] = `"error"`;
|
||||
|
||||
exports[`Error v2 REQUEST_METHOD 1`] = `undefined`;
|
||||
exports[`Error PROCESSOR_NAME 1`] = `"error"`;
|
||||
|
||||
exports[`Error v2 REQUEST_URL_FULL 1`] = `undefined`;
|
||||
exports[`Error REQUEST_METHOD 1`] = `undefined`;
|
||||
|
||||
exports[`Error v2 SERVICE_AGENT_NAME 1`] = `"agent name"`;
|
||||
exports[`Error REQUEST_URL_FULL 1`] = `undefined`;
|
||||
|
||||
exports[`Error v2 SERVICE_LANGUAGE_NAME 1`] = `"nodejs"`;
|
||||
exports[`Error SERVICE_AGENT_NAME 1`] = `"agent name"`;
|
||||
|
||||
exports[`Error v2 SERVICE_NAME 1`] = `"service name"`;
|
||||
exports[`Error SERVICE_LANGUAGE_NAME 1`] = `"nodejs"`;
|
||||
|
||||
exports[`Error v2 SPAN_DURATION 1`] = `undefined`;
|
||||
exports[`Error SERVICE_NAME 1`] = `"service name"`;
|
||||
|
||||
exports[`Error v2 SPAN_HEX_ID 1`] = `undefined`;
|
||||
exports[`Error SPAN_DURATION 1`] = `undefined`;
|
||||
|
||||
exports[`Error v2 SPAN_ID 1`] = `undefined`;
|
||||
exports[`Error SPAN_ID 1`] = `undefined`;
|
||||
|
||||
exports[`Error v2 SPAN_NAME 1`] = `undefined`;
|
||||
exports[`Error SPAN_NAME 1`] = `undefined`;
|
||||
|
||||
exports[`Error v2 SPAN_SQL 1`] = `undefined`;
|
||||
exports[`Error SPAN_SQL 1`] = `undefined`;
|
||||
|
||||
exports[`Error v2 SPAN_START 1`] = `undefined`;
|
||||
exports[`Error SPAN_START 1`] = `undefined`;
|
||||
|
||||
exports[`Error v2 SPAN_TYPE 1`] = `undefined`;
|
||||
exports[`Error SPAN_TYPE 1`] = `undefined`;
|
||||
|
||||
exports[`Error v2 TRACE_ID 1`] = `"trace id"`;
|
||||
exports[`Error TRACE_ID 1`] = `"trace id"`;
|
||||
|
||||
exports[`Error v2 TRANSACTION_DURATION 1`] = `undefined`;
|
||||
exports[`Error TRANSACTION_DURATION 1`] = `undefined`;
|
||||
|
||||
exports[`Error v2 TRANSACTION_ID 1`] = `"transaction id"`;
|
||||
exports[`Error TRANSACTION_ID 1`] = `"transaction id"`;
|
||||
|
||||
exports[`Error v2 TRANSACTION_NAME 1`] = `undefined`;
|
||||
exports[`Error TRANSACTION_NAME 1`] = `undefined`;
|
||||
|
||||
exports[`Error v2 TRANSACTION_RESULT 1`] = `undefined`;
|
||||
exports[`Error TRANSACTION_RESULT 1`] = `undefined`;
|
||||
|
||||
exports[`Error v2 TRANSACTION_SAMPLED 1`] = `undefined`;
|
||||
exports[`Error TRANSACTION_SAMPLED 1`] = `undefined`;
|
||||
|
||||
exports[`Error v2 TRANSACTION_TYPE 1`] = `undefined`;
|
||||
exports[`Error TRANSACTION_TYPE 1`] = `undefined`;
|
||||
|
||||
exports[`Error v2 USER_ID 1`] = `undefined`;
|
||||
exports[`Error USER_ID 1`] = `undefined`;
|
||||
|
||||
exports[`Span v1 ERROR_CULPRIT 1`] = `undefined`;
|
||||
exports[`Span ERROR_CULPRIT 1`] = `undefined`;
|
||||
|
||||
exports[`Span v1 ERROR_EXC_HANDLED 1`] = `undefined`;
|
||||
exports[`Span ERROR_EXC_HANDLED 1`] = `undefined`;
|
||||
|
||||
exports[`Span v1 ERROR_EXC_MESSAGE 1`] = `undefined`;
|
||||
exports[`Span ERROR_EXC_MESSAGE 1`] = `undefined`;
|
||||
|
||||
exports[`Span v1 ERROR_EXC_STACKTRACE 1`] = `undefined`;
|
||||
exports[`Span ERROR_EXC_STACKTRACE 1`] = `undefined`;
|
||||
|
||||
exports[`Span v1 ERROR_GROUP_ID 1`] = `undefined`;
|
||||
exports[`Span ERROR_GROUP_ID 1`] = `undefined`;
|
||||
|
||||
exports[`Span v1 ERROR_LOG_MESSAGE 1`] = `undefined`;
|
||||
exports[`Span ERROR_LOG_MESSAGE 1`] = `undefined`;
|
||||
|
||||
exports[`Span v1 ERROR_LOG_STACKTRACE 1`] = `undefined`;
|
||||
exports[`Span ERROR_LOG_STACKTRACE 1`] = `undefined`;
|
||||
|
||||
exports[`Span v1 METRIC_PROCESS_CPU_PERCENT 1`] = `undefined`;
|
||||
exports[`Span METRIC_PROCESS_CPU_PERCENT 1`] = `undefined`;
|
||||
|
||||
exports[`Span v1 METRIC_PROCESS_MEMORY_RSS 1`] = `undefined`;
|
||||
exports[`Span METRIC_PROCESS_MEMORY_RSS 1`] = `undefined`;
|
||||
|
||||
exports[`Span v1 METRIC_PROCESS_MEMORY_SIZE 1`] = `undefined`;
|
||||
exports[`Span METRIC_PROCESS_MEMORY_SIZE 1`] = `undefined`;
|
||||
|
||||
exports[`Span v1 METRIC_SYSTEM_CPU_PERCENT 1`] = `undefined`;
|
||||
exports[`Span METRIC_SYSTEM_CPU_PERCENT 1`] = `undefined`;
|
||||
|
||||
exports[`Span v1 METRIC_SYSTEM_FREE_MEMORY 1`] = `undefined`;
|
||||
exports[`Span METRIC_SYSTEM_FREE_MEMORY 1`] = `undefined`;
|
||||
|
||||
exports[`Span v1 METRIC_SYSTEM_TOTAL_MEMORY 1`] = `undefined`;
|
||||
exports[`Span METRIC_SYSTEM_TOTAL_MEMORY 1`] = `undefined`;
|
||||
|
||||
exports[`Span v1 PARENT_ID 1`] = `undefined`;
|
||||
exports[`Span OBSERVER_LISTENING 1`] = `undefined`;
|
||||
|
||||
exports[`Span v1 PROCESSOR_EVENT 1`] = `"span"`;
|
||||
exports[`Span PARENT_ID 1`] = `"parentId"`;
|
||||
|
||||
exports[`Span v1 PROCESSOR_NAME 1`] = `"transaction"`;
|
||||
exports[`Span PROCESSOR_EVENT 1`] = `"span"`;
|
||||
|
||||
exports[`Span v1 REQUEST_METHOD 1`] = `undefined`;
|
||||
exports[`Span PROCESSOR_NAME 1`] = `"transaction"`;
|
||||
|
||||
exports[`Span v1 REQUEST_URL_FULL 1`] = `undefined`;
|
||||
exports[`Span REQUEST_METHOD 1`] = `undefined`;
|
||||
|
||||
exports[`Span v1 SERVICE_AGENT_NAME 1`] = `"agent name"`;
|
||||
exports[`Span REQUEST_URL_FULL 1`] = `undefined`;
|
||||
|
||||
exports[`Span v1 SERVICE_LANGUAGE_NAME 1`] = `"nodejs"`;
|
||||
exports[`Span SERVICE_AGENT_NAME 1`] = `"agent name"`;
|
||||
|
||||
exports[`Span v1 SERVICE_NAME 1`] = `"service name"`;
|
||||
exports[`Span SERVICE_LANGUAGE_NAME 1`] = `undefined`;
|
||||
|
||||
exports[`Span v1 SPAN_DURATION 1`] = `1337`;
|
||||
exports[`Span SERVICE_NAME 1`] = `"service name"`;
|
||||
|
||||
exports[`Span v1 SPAN_HEX_ID 1`] = `undefined`;
|
||||
exports[`Span SPAN_DURATION 1`] = `1337`;
|
||||
|
||||
exports[`Span v1 SPAN_ID 1`] = `1337`;
|
||||
exports[`Span SPAN_ID 1`] = `"span id"`;
|
||||
|
||||
exports[`Span v1 SPAN_NAME 1`] = `"span name"`;
|
||||
exports[`Span SPAN_NAME 1`] = `"span name"`;
|
||||
|
||||
exports[`Span v1 SPAN_SQL 1`] = `"db statement"`;
|
||||
exports[`Span SPAN_SQL 1`] = `"db statement"`;
|
||||
|
||||
exports[`Span v1 SPAN_START 1`] = `1337`;
|
||||
exports[`Span SPAN_START 1`] = `undefined`;
|
||||
|
||||
exports[`Span v1 SPAN_TYPE 1`] = `"span type"`;
|
||||
exports[`Span SPAN_TYPE 1`] = `"span type"`;
|
||||
|
||||
exports[`Span v1 TRACE_ID 1`] = `undefined`;
|
||||
exports[`Span TRACE_ID 1`] = `"trace id"`;
|
||||
|
||||
exports[`Span v1 TRANSACTION_DURATION 1`] = `undefined`;
|
||||
exports[`Span TRANSACTION_DURATION 1`] = `undefined`;
|
||||
|
||||
exports[`Span v1 TRANSACTION_ID 1`] = `"transaction id"`;
|
||||
exports[`Span TRANSACTION_ID 1`] = `"transaction id"`;
|
||||
|
||||
exports[`Span v1 TRANSACTION_NAME 1`] = `undefined`;
|
||||
exports[`Span TRANSACTION_NAME 1`] = `undefined`;
|
||||
|
||||
exports[`Span v1 TRANSACTION_RESULT 1`] = `undefined`;
|
||||
exports[`Span TRANSACTION_RESULT 1`] = `undefined`;
|
||||
|
||||
exports[`Span v1 TRANSACTION_SAMPLED 1`] = `undefined`;
|
||||
exports[`Span TRANSACTION_SAMPLED 1`] = `undefined`;
|
||||
|
||||
exports[`Span v1 TRANSACTION_TYPE 1`] = `undefined`;
|
||||
exports[`Span TRANSACTION_TYPE 1`] = `undefined`;
|
||||
|
||||
exports[`Span v1 USER_ID 1`] = `undefined`;
|
||||
exports[`Span USER_ID 1`] = `undefined`;
|
||||
|
||||
exports[`Span v2 ERROR_CULPRIT 1`] = `undefined`;
|
||||
exports[`Transaction ERROR_CULPRIT 1`] = `undefined`;
|
||||
|
||||
exports[`Span v2 ERROR_EXC_HANDLED 1`] = `undefined`;
|
||||
exports[`Transaction ERROR_EXC_HANDLED 1`] = `undefined`;
|
||||
|
||||
exports[`Span v2 ERROR_EXC_MESSAGE 1`] = `undefined`;
|
||||
exports[`Transaction ERROR_EXC_MESSAGE 1`] = `undefined`;
|
||||
|
||||
exports[`Span v2 ERROR_EXC_STACKTRACE 1`] = `undefined`;
|
||||
exports[`Transaction ERROR_EXC_STACKTRACE 1`] = `undefined`;
|
||||
|
||||
exports[`Span v2 ERROR_GROUP_ID 1`] = `undefined`;
|
||||
exports[`Transaction ERROR_GROUP_ID 1`] = `undefined`;
|
||||
|
||||
exports[`Span v2 ERROR_LOG_MESSAGE 1`] = `undefined`;
|
||||
exports[`Transaction ERROR_LOG_MESSAGE 1`] = `undefined`;
|
||||
|
||||
exports[`Span v2 ERROR_LOG_STACKTRACE 1`] = `undefined`;
|
||||
exports[`Transaction ERROR_LOG_STACKTRACE 1`] = `undefined`;
|
||||
|
||||
exports[`Span v2 METRIC_PROCESS_CPU_PERCENT 1`] = `undefined`;
|
||||
exports[`Transaction METRIC_PROCESS_CPU_PERCENT 1`] = `undefined`;
|
||||
|
||||
exports[`Span v2 METRIC_PROCESS_MEMORY_RSS 1`] = `undefined`;
|
||||
exports[`Transaction METRIC_PROCESS_MEMORY_RSS 1`] = `undefined`;
|
||||
|
||||
exports[`Span v2 METRIC_PROCESS_MEMORY_SIZE 1`] = `undefined`;
|
||||
exports[`Transaction METRIC_PROCESS_MEMORY_SIZE 1`] = `undefined`;
|
||||
|
||||
exports[`Span v2 METRIC_SYSTEM_CPU_PERCENT 1`] = `undefined`;
|
||||
exports[`Transaction METRIC_SYSTEM_CPU_PERCENT 1`] = `undefined`;
|
||||
|
||||
exports[`Span v2 METRIC_SYSTEM_FREE_MEMORY 1`] = `undefined`;
|
||||
exports[`Transaction METRIC_SYSTEM_FREE_MEMORY 1`] = `undefined`;
|
||||
|
||||
exports[`Span v2 METRIC_SYSTEM_TOTAL_MEMORY 1`] = `undefined`;
|
||||
exports[`Transaction METRIC_SYSTEM_TOTAL_MEMORY 1`] = `undefined`;
|
||||
|
||||
exports[`Span v2 PARENT_ID 1`] = `"parentId"`;
|
||||
exports[`Transaction OBSERVER_LISTENING 1`] = `undefined`;
|
||||
|
||||
exports[`Span v2 PROCESSOR_EVENT 1`] = `"span"`;
|
||||
exports[`Transaction PARENT_ID 1`] = `"parentId"`;
|
||||
|
||||
exports[`Span v2 PROCESSOR_NAME 1`] = `"transaction"`;
|
||||
exports[`Transaction PROCESSOR_EVENT 1`] = `"transaction"`;
|
||||
|
||||
exports[`Span v2 REQUEST_METHOD 1`] = `undefined`;
|
||||
exports[`Transaction PROCESSOR_NAME 1`] = `"transaction"`;
|
||||
|
||||
exports[`Span v2 REQUEST_URL_FULL 1`] = `undefined`;
|
||||
exports[`Transaction REQUEST_METHOD 1`] = `"GET"`;
|
||||
|
||||
exports[`Span v2 SERVICE_AGENT_NAME 1`] = `"agent name"`;
|
||||
exports[`Transaction REQUEST_URL_FULL 1`] = `"http://www.elastic.co"`;
|
||||
|
||||
exports[`Span v2 SERVICE_LANGUAGE_NAME 1`] = `"nodejs"`;
|
||||
exports[`Transaction SERVICE_AGENT_NAME 1`] = `"agent name"`;
|
||||
|
||||
exports[`Span v2 SERVICE_NAME 1`] = `"service name"`;
|
||||
exports[`Transaction SERVICE_LANGUAGE_NAME 1`] = `"nodejs"`;
|
||||
|
||||
exports[`Span v2 SPAN_DURATION 1`] = `1337`;
|
||||
exports[`Transaction SERVICE_NAME 1`] = `"service name"`;
|
||||
|
||||
exports[`Span v2 SPAN_HEX_ID 1`] = `"hex id"`;
|
||||
exports[`Transaction SPAN_DURATION 1`] = `undefined`;
|
||||
|
||||
exports[`Span v2 SPAN_ID 1`] = `1337`;
|
||||
exports[`Transaction SPAN_ID 1`] = `undefined`;
|
||||
|
||||
exports[`Span v2 SPAN_NAME 1`] = `"span name"`;
|
||||
exports[`Transaction SPAN_NAME 1`] = `undefined`;
|
||||
|
||||
exports[`Span v2 SPAN_SQL 1`] = `"db statement"`;
|
||||
exports[`Transaction SPAN_SQL 1`] = `undefined`;
|
||||
|
||||
exports[`Span v2 SPAN_START 1`] = `undefined`;
|
||||
exports[`Transaction SPAN_START 1`] = `undefined`;
|
||||
|
||||
exports[`Span v2 SPAN_TYPE 1`] = `"span type"`;
|
||||
exports[`Transaction SPAN_TYPE 1`] = `undefined`;
|
||||
|
||||
exports[`Span v2 TRACE_ID 1`] = `"trace id"`;
|
||||
exports[`Transaction TRACE_ID 1`] = `"trace id"`;
|
||||
|
||||
exports[`Span v2 TRANSACTION_DURATION 1`] = `undefined`;
|
||||
exports[`Transaction TRANSACTION_DURATION 1`] = `1337`;
|
||||
|
||||
exports[`Span v2 TRANSACTION_ID 1`] = `"transaction id"`;
|
||||
exports[`Transaction TRANSACTION_ID 1`] = `"transaction id"`;
|
||||
|
||||
exports[`Span v2 TRANSACTION_NAME 1`] = `undefined`;
|
||||
exports[`Transaction TRANSACTION_NAME 1`] = `"transaction name"`;
|
||||
|
||||
exports[`Span v2 TRANSACTION_RESULT 1`] = `undefined`;
|
||||
exports[`Transaction TRANSACTION_RESULT 1`] = `"transaction result"`;
|
||||
|
||||
exports[`Span v2 TRANSACTION_SAMPLED 1`] = `undefined`;
|
||||
exports[`Transaction TRANSACTION_SAMPLED 1`] = `true`;
|
||||
|
||||
exports[`Span v2 TRANSACTION_TYPE 1`] = `undefined`;
|
||||
exports[`Transaction TRANSACTION_TYPE 1`] = `"transaction type"`;
|
||||
|
||||
exports[`Span v2 USER_ID 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v1: ERROR_CULPRIT 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v1: ERROR_EXC_HANDLED 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v1: ERROR_EXC_MESSAGE 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v1: ERROR_EXC_STACKTRACE 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v1: ERROR_GROUP_ID 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v1: ERROR_LOG_MESSAGE 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v1: ERROR_LOG_STACKTRACE 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v1: METRIC_PROCESS_CPU_PERCENT 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v1: METRIC_PROCESS_MEMORY_RSS 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v1: METRIC_PROCESS_MEMORY_SIZE 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v1: METRIC_SYSTEM_CPU_PERCENT 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v1: METRIC_SYSTEM_FREE_MEMORY 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v1: METRIC_SYSTEM_TOTAL_MEMORY 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v1: PARENT_ID 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v1: PROCESSOR_EVENT 1`] = `"transaction"`;
|
||||
|
||||
exports[`Transaction v1: PROCESSOR_NAME 1`] = `"transaction"`;
|
||||
|
||||
exports[`Transaction v1: REQUEST_METHOD 1`] = `"GET"`;
|
||||
|
||||
exports[`Transaction v1: REQUEST_URL_FULL 1`] = `"http://www.elastic.co"`;
|
||||
|
||||
exports[`Transaction v1: SERVICE_AGENT_NAME 1`] = `"agent name"`;
|
||||
|
||||
exports[`Transaction v1: SERVICE_LANGUAGE_NAME 1`] = `"nodejs"`;
|
||||
|
||||
exports[`Transaction v1: SERVICE_NAME 1`] = `"service name"`;
|
||||
|
||||
exports[`Transaction v1: SPAN_DURATION 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v1: SPAN_HEX_ID 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v1: SPAN_ID 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v1: SPAN_NAME 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v1: SPAN_SQL 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v1: SPAN_START 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v1: SPAN_TYPE 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v1: TRACE_ID 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v1: TRANSACTION_DURATION 1`] = `1337`;
|
||||
|
||||
exports[`Transaction v1: TRANSACTION_ID 1`] = `"transaction id"`;
|
||||
|
||||
exports[`Transaction v1: TRANSACTION_NAME 1`] = `"transaction name"`;
|
||||
|
||||
exports[`Transaction v1: TRANSACTION_RESULT 1`] = `"transaction result"`;
|
||||
|
||||
exports[`Transaction v1: TRANSACTION_SAMPLED 1`] = `true`;
|
||||
|
||||
exports[`Transaction v1: TRANSACTION_TYPE 1`] = `"transaction type"`;
|
||||
|
||||
exports[`Transaction v1: USER_ID 1`] = `"1337"`;
|
||||
|
||||
exports[`Transaction v2 ERROR_CULPRIT 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v2 ERROR_EXC_HANDLED 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v2 ERROR_EXC_MESSAGE 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v2 ERROR_EXC_STACKTRACE 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v2 ERROR_GROUP_ID 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v2 ERROR_LOG_MESSAGE 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v2 ERROR_LOG_STACKTRACE 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v2 METRIC_PROCESS_CPU_PERCENT 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v2 METRIC_PROCESS_MEMORY_RSS 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v2 METRIC_PROCESS_MEMORY_SIZE 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v2 METRIC_SYSTEM_CPU_PERCENT 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v2 METRIC_SYSTEM_FREE_MEMORY 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v2 METRIC_SYSTEM_TOTAL_MEMORY 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v2 PARENT_ID 1`] = `"parentId"`;
|
||||
|
||||
exports[`Transaction v2 PROCESSOR_EVENT 1`] = `"transaction"`;
|
||||
|
||||
exports[`Transaction v2 PROCESSOR_NAME 1`] = `"transaction"`;
|
||||
|
||||
exports[`Transaction v2 REQUEST_METHOD 1`] = `"GET"`;
|
||||
|
||||
exports[`Transaction v2 REQUEST_URL_FULL 1`] = `"http://www.elastic.co"`;
|
||||
|
||||
exports[`Transaction v2 SERVICE_AGENT_NAME 1`] = `"agent name"`;
|
||||
|
||||
exports[`Transaction v2 SERVICE_LANGUAGE_NAME 1`] = `"nodejs"`;
|
||||
|
||||
exports[`Transaction v2 SERVICE_NAME 1`] = `"service name"`;
|
||||
|
||||
exports[`Transaction v2 SPAN_DURATION 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v2 SPAN_HEX_ID 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v2 SPAN_ID 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v2 SPAN_NAME 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v2 SPAN_SQL 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v2 SPAN_START 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v2 SPAN_TYPE 1`] = `undefined`;
|
||||
|
||||
exports[`Transaction v2 TRACE_ID 1`] = `"trace id"`;
|
||||
|
||||
exports[`Transaction v2 TRANSACTION_DURATION 1`] = `1337`;
|
||||
|
||||
exports[`Transaction v2 TRANSACTION_ID 1`] = `"transaction id"`;
|
||||
|
||||
exports[`Transaction v2 TRANSACTION_NAME 1`] = `"transaction name"`;
|
||||
|
||||
exports[`Transaction v2 TRANSACTION_RESULT 1`] = `"transaction result"`;
|
||||
|
||||
exports[`Transaction v2 TRANSACTION_SAMPLED 1`] = `true`;
|
||||
|
||||
exports[`Transaction v2 TRANSACTION_TYPE 1`] = `"transaction type"`;
|
||||
|
||||
exports[`Transaction v2 USER_ID 1`] = `"1337"`;
|
||||
exports[`Transaction USER_ID 1`] = `"1337"`;
|
||||
|
|
|
@ -10,93 +10,27 @@ import { Span } from '../typings/es_schemas/Span';
|
|||
import { Transaction } from '../typings/es_schemas/Transaction';
|
||||
import * as constants from './constants';
|
||||
|
||||
describe('Transaction v1:', () => {
|
||||
describe('Transaction', () => {
|
||||
const transaction: Transaction = {
|
||||
version: 'v1',
|
||||
'@timestamp': new Date().toString(),
|
||||
beat: {
|
||||
hostname: 'beat hostname',
|
||||
name: 'beat name',
|
||||
version: 'beat version'
|
||||
agent: {
|
||||
name: 'agent name',
|
||||
version: 'agent version'
|
||||
},
|
||||
host: {
|
||||
name: 'my hostname'
|
||||
http: {
|
||||
request: { method: 'GET' },
|
||||
response: { status_code: 200 }
|
||||
},
|
||||
processor: {
|
||||
name: 'transaction',
|
||||
event: 'transaction'
|
||||
url: { full: 'http://www.elastic.co' },
|
||||
service: {
|
||||
name: 'service name',
|
||||
language: { name: 'nodejs', version: 'v1337' }
|
||||
},
|
||||
context: {
|
||||
system: {
|
||||
architecture: 'x86',
|
||||
hostname: 'some-host',
|
||||
ip: '111.0.2.3',
|
||||
platform: 'linux'
|
||||
},
|
||||
service: {
|
||||
name: 'service name',
|
||||
agent: {
|
||||
name: 'agent name',
|
||||
version: 'v1337'
|
||||
},
|
||||
language: {
|
||||
name: 'nodejs',
|
||||
version: 'v1337'
|
||||
}
|
||||
},
|
||||
user: {
|
||||
id: '1337'
|
||||
},
|
||||
request: {
|
||||
url: {
|
||||
full: 'http://www.elastic.co'
|
||||
},
|
||||
method: 'GET'
|
||||
}
|
||||
},
|
||||
transaction: {
|
||||
duration: {
|
||||
us: 1337
|
||||
},
|
||||
id: 'transaction id',
|
||||
name: 'transaction name',
|
||||
result: 'transaction result',
|
||||
sampled: true,
|
||||
type: 'transaction type'
|
||||
}
|
||||
};
|
||||
|
||||
matchSnapshot(transaction);
|
||||
});
|
||||
|
||||
describe('Transaction v2', () => {
|
||||
const transaction: Transaction = {
|
||||
version: 'v2',
|
||||
'@timestamp': new Date().toString(),
|
||||
beat: {
|
||||
hostname: 'beat hostname',
|
||||
name: 'beat name',
|
||||
version: 'beat version'
|
||||
},
|
||||
host: { name: 'my hostname' },
|
||||
host: { hostname: 'my hostname' },
|
||||
processor: { name: 'transaction', event: 'transaction' },
|
||||
timestamp: { us: 1337 },
|
||||
trace: { id: 'trace id' },
|
||||
context: {
|
||||
system: {
|
||||
architecture: 'x86',
|
||||
hostname: 'some-host',
|
||||
ip: '111.0.2.3',
|
||||
platform: 'linux'
|
||||
},
|
||||
service: {
|
||||
name: 'service name',
|
||||
agent: { name: 'agent name', version: 'v1337' },
|
||||
language: { name: 'nodejs', version: 'v1337' }
|
||||
},
|
||||
user: { id: '1337' },
|
||||
request: { url: { full: 'http://www.elastic.co' }, method: 'GET' }
|
||||
},
|
||||
user: { id: '1337' },
|
||||
parent: {
|
||||
id: 'parentId'
|
||||
},
|
||||
|
@ -121,68 +55,12 @@ describe('Transaction v2', () => {
|
|||
matchSnapshot(transaction);
|
||||
});
|
||||
|
||||
describe('Span v1', () => {
|
||||
describe('Span', () => {
|
||||
const span: Span = {
|
||||
version: 'v1',
|
||||
'@timestamp': new Date().toString(),
|
||||
beat: {
|
||||
hostname: 'beat hostname',
|
||||
name: 'beat name',
|
||||
version: 'beat version'
|
||||
},
|
||||
host: {
|
||||
name: 'my hostname'
|
||||
},
|
||||
processor: {
|
||||
name: 'transaction',
|
||||
event: 'span'
|
||||
},
|
||||
context: {
|
||||
db: {
|
||||
statement: 'db statement'
|
||||
},
|
||||
service: {
|
||||
name: 'service name',
|
||||
agent: {
|
||||
name: 'agent name',
|
||||
version: 'v1337'
|
||||
},
|
||||
language: {
|
||||
name: 'nodejs',
|
||||
version: 'v1337'
|
||||
}
|
||||
}
|
||||
},
|
||||
span: {
|
||||
duration: {
|
||||
us: 1337
|
||||
},
|
||||
start: {
|
||||
us: 1337
|
||||
},
|
||||
name: 'span name',
|
||||
type: 'span type',
|
||||
id: 1337
|
||||
},
|
||||
transaction: {
|
||||
id: 'transaction id'
|
||||
}
|
||||
};
|
||||
|
||||
matchSnapshot(span);
|
||||
});
|
||||
|
||||
describe('Span v2', () => {
|
||||
const span: Span = {
|
||||
version: 'v2',
|
||||
'@timestamp': new Date().toString(),
|
||||
beat: {
|
||||
hostname: 'beat hostname',
|
||||
name: 'beat name',
|
||||
version: 'beat version'
|
||||
},
|
||||
host: {
|
||||
name: 'my hostname'
|
||||
agent: {
|
||||
name: 'agent name',
|
||||
version: 'agent version'
|
||||
},
|
||||
processor: {
|
||||
name: 'transaction',
|
||||
|
@ -194,33 +72,25 @@ describe('Span v2', () => {
|
|||
trace: {
|
||||
id: 'trace id'
|
||||
},
|
||||
service: {
|
||||
name: 'service name'
|
||||
},
|
||||
context: {
|
||||
db: {
|
||||
statement: 'db statement'
|
||||
},
|
||||
service: {
|
||||
name: 'service name',
|
||||
agent: {
|
||||
name: 'agent name',
|
||||
version: 'v1337'
|
||||
},
|
||||
language: {
|
||||
name: 'nodejs',
|
||||
version: 'v1337'
|
||||
}
|
||||
}
|
||||
},
|
||||
parent: {
|
||||
id: 'parentId'
|
||||
},
|
||||
span: {
|
||||
duration: {
|
||||
us: 1337
|
||||
},
|
||||
action: 'my action',
|
||||
duration: { us: 1337 },
|
||||
id: 'span id',
|
||||
name: 'span name',
|
||||
type: 'span type',
|
||||
id: 1337,
|
||||
hex_id: 'hex id'
|
||||
subtype: 'my subtype',
|
||||
sync: false,
|
||||
type: 'span type'
|
||||
},
|
||||
transaction: {
|
||||
id: 'transaction id'
|
||||
|
@ -230,12 +100,11 @@ describe('Span v2', () => {
|
|||
matchSnapshot(span);
|
||||
});
|
||||
|
||||
describe('Error v2', () => {
|
||||
describe('Error', () => {
|
||||
const errorDoc: APMError = {
|
||||
agent: {
|
||||
hostname: 'agent hostname',
|
||||
type: 'apm-server',
|
||||
version: '7.0.0'
|
||||
name: 'agent name',
|
||||
version: 'agent version'
|
||||
},
|
||||
error: {
|
||||
exception: {
|
||||
|
@ -248,15 +117,9 @@ describe('Error v2', () => {
|
|||
id: 'error id',
|
||||
grouping_key: 'grouping key'
|
||||
},
|
||||
version: 'v2',
|
||||
'@timestamp': new Date().toString(),
|
||||
beat: {
|
||||
hostname: 'beat hostname',
|
||||
name: 'beat name',
|
||||
version: 'beat version'
|
||||
},
|
||||
host: {
|
||||
name: 'my hostname'
|
||||
hostname: 'my hostname'
|
||||
},
|
||||
processor: {
|
||||
name: 'error',
|
||||
|
@ -268,19 +131,14 @@ describe('Error v2', () => {
|
|||
trace: {
|
||||
id: 'trace id'
|
||||
},
|
||||
context: {
|
||||
service: {
|
||||
name: 'service name',
|
||||
agent: {
|
||||
name: 'agent name',
|
||||
version: 'v1337'
|
||||
},
|
||||
language: {
|
||||
name: 'nodejs',
|
||||
version: 'v1337'
|
||||
}
|
||||
service: {
|
||||
name: 'service name',
|
||||
language: {
|
||||
name: 'nodejs',
|
||||
version: 'v1337'
|
||||
}
|
||||
},
|
||||
context: {},
|
||||
parent: {
|
||||
id: 'parentId'
|
||||
},
|
||||
|
|
|
@ -3,12 +3,14 @@
|
|||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
export const SERVICE_NAME = 'context.service.name';
|
||||
export const SERVICE_AGENT_NAME = 'context.service.agent.name';
|
||||
export const SERVICE_LANGUAGE_NAME = 'context.service.language.name';
|
||||
export const REQUEST_URL_FULL = 'context.request.url.full';
|
||||
export const REQUEST_METHOD = 'context.request.method';
|
||||
export const USER_ID = 'context.user.id';
|
||||
export const SERVICE_NAME = 'service.name';
|
||||
export const SERVICE_AGENT_NAME = 'agent.name';
|
||||
export const SERVICE_LANGUAGE_NAME = 'service.language.name';
|
||||
export const REQUEST_URL_FULL = 'url.full';
|
||||
export const REQUEST_METHOD = 'http.request.method';
|
||||
export const USER_ID = 'user.id';
|
||||
|
||||
export const OBSERVER_LISTENING = 'observer.listening';
|
||||
|
||||
export const PROCESSOR_NAME = 'processor.name';
|
||||
export const PROCESSOR_EVENT = 'processor.event';
|
||||
|
@ -28,7 +30,6 @@ export const SPAN_TYPE = 'span.type';
|
|||
export const SPAN_NAME = 'span.name';
|
||||
export const SPAN_ID = 'span.id';
|
||||
export const SPAN_SQL = 'context.db.statement';
|
||||
export const SPAN_HEX_ID = 'span.hex_id';
|
||||
|
||||
// Parent ID for a transaction or span
|
||||
export const PARENT_ID = 'parent.id';
|
||||
|
|
51
x-pack/plugins/apm/common/idx.ts
Normal file
51
x-pack/plugins/apm/common/idx.ts
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DeepRequiredArray
|
||||
* Nested array condition handler
|
||||
*/
|
||||
interface DeepRequiredArray<T> extends Array<DeepRequired<T>> {}
|
||||
|
||||
/**
|
||||
* DeepRequiredObject
|
||||
* Nested object condition handler
|
||||
*/
|
||||
type DeepRequiredObject<T> = { [P in keyof T]-?: DeepRequired<T[P]> };
|
||||
|
||||
/**
|
||||
* Function that has deeply required return type
|
||||
*/
|
||||
type FunctionWithRequiredReturnType<
|
||||
T extends (...args: any[]) => any
|
||||
> = T extends (...args: infer A) => infer R
|
||||
? (...args: A) => DeepRequired<R>
|
||||
: never;
|
||||
|
||||
/**
|
||||
* DeepRequired
|
||||
* Required that works for deeply nested structure
|
||||
*/
|
||||
type DeepRequired<T> = NonNullable<T> extends never
|
||||
? T
|
||||
: T extends any[]
|
||||
? DeepRequiredArray<T[number]>
|
||||
: T extends (...args: any[]) => any
|
||||
? FunctionWithRequiredReturnType<T>
|
||||
: NonNullable<T> extends object
|
||||
? DeepRequiredObject<NonNullable<T>>
|
||||
: T;
|
||||
|
||||
export function idx<T1, T2>(
|
||||
input: T1,
|
||||
accessor: (input: NonNullable<DeepRequired<T1>>) => T2
|
||||
): T2 | undefined {
|
||||
try {
|
||||
return accessor(input as NonNullable<DeepRequired<T1>>);
|
||||
} catch (error) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
|
@ -40,11 +40,10 @@ describe('DetailView', () => {
|
|||
occurrencesCount: 10,
|
||||
error: ({
|
||||
'@timestamp': 'myTimestamp',
|
||||
context: {
|
||||
service: { name: 'myService' },
|
||||
user: { id: 'myUserId' },
|
||||
request: { method: 'GET', url: { full: 'myUrl' } }
|
||||
},
|
||||
http: { request: { method: 'GET' } },
|
||||
url: { full: 'myUrl' },
|
||||
service: { name: 'myService' },
|
||||
user: { id: 'myUserId' },
|
||||
error: { exception: { handled: true } },
|
||||
transaction: { id: 'myTransactionId', sampled: true }
|
||||
} as unknown) as APMError
|
||||
|
@ -69,25 +68,23 @@ describe('DetailView', () => {
|
|||
data: {
|
||||
occurrencesCount: 10,
|
||||
transaction: ({
|
||||
http: { request: { method: 'GET' } },
|
||||
url: { full: 'myUrl' },
|
||||
trace: { id: 'traceId' },
|
||||
transaction: {
|
||||
type: 'myTransactionType',
|
||||
name: 'myTransactionName',
|
||||
id: 'myTransactionName'
|
||||
},
|
||||
context: {
|
||||
service: { name: 'myService' },
|
||||
user: { id: 'myUserId' },
|
||||
request: { method: 'GET', url: { full: 'myUrl' } }
|
||||
}
|
||||
service: { name: 'myService' },
|
||||
user: { id: 'myUserId' }
|
||||
} as unknown) as Transaction,
|
||||
error: ({
|
||||
'@timestamp': 'myTimestamp',
|
||||
context: {
|
||||
service: { name: 'myService' },
|
||||
user: { id: 'myUserId' },
|
||||
request: { method: 'GET', url: { full: 'myUrl' } }
|
||||
},
|
||||
http: { request: { method: 'GET' } },
|
||||
url: { full: 'myUrl' },
|
||||
service: { name: 'myService' },
|
||||
user: { id: 'myUserId' },
|
||||
error: { exception: { handled: true } },
|
||||
transaction: { id: 'myTransactionId', sampled: true }
|
||||
} as unknown) as APMError
|
||||
|
@ -113,7 +110,8 @@ describe('DetailView', () => {
|
|||
occurrencesCount: 10,
|
||||
error: ({
|
||||
'@timestamp': 'myTimestamp',
|
||||
context: { service: {}, user: {}, request: {} }
|
||||
service: {},
|
||||
user: {}
|
||||
} as unknown) as APMError
|
||||
}
|
||||
};
|
||||
|
|
|
@ -5,29 +5,29 @@ exports[`DetailView should render Discover button 1`] = `
|
|||
error={
|
||||
Object {
|
||||
"@timestamp": "myTimestamp",
|
||||
"context": Object {
|
||||
"request": Object {
|
||||
"method": "GET",
|
||||
"url": Object {
|
||||
"full": "myUrl",
|
||||
},
|
||||
},
|
||||
"service": Object {
|
||||
"name": "myService",
|
||||
},
|
||||
"user": Object {
|
||||
"id": "myUserId",
|
||||
},
|
||||
},
|
||||
"error": Object {
|
||||
"exception": Object {
|
||||
"handled": true,
|
||||
},
|
||||
},
|
||||
"http": Object {
|
||||
"request": Object {
|
||||
"method": "GET",
|
||||
},
|
||||
},
|
||||
"service": Object {
|
||||
"name": "myService",
|
||||
},
|
||||
"transaction": Object {
|
||||
"id": "myTransactionId",
|
||||
"sampled": true,
|
||||
},
|
||||
"url": Object {
|
||||
"full": "myUrl",
|
||||
},
|
||||
"user": Object {
|
||||
"id": "myUserId",
|
||||
},
|
||||
}
|
||||
}
|
||||
>
|
||||
|
@ -53,14 +53,14 @@ exports[`DetailView should render StickyProperties 1`] = `
|
|||
"width": "50%",
|
||||
},
|
||||
Object {
|
||||
"fieldName": "context.request.url.full",
|
||||
"fieldName": "url.full",
|
||||
"label": "URL",
|
||||
"truncated": true,
|
||||
"val": "myUrl",
|
||||
"width": "50%",
|
||||
},
|
||||
Object {
|
||||
"fieldName": "context.request.method",
|
||||
"fieldName": "http.request.method",
|
||||
"label": "Request method",
|
||||
"val": "GET",
|
||||
"width": "25%",
|
||||
|
@ -88,7 +88,7 @@ exports[`DetailView should render StickyProperties 1`] = `
|
|||
"width": "25%",
|
||||
},
|
||||
Object {
|
||||
"fieldName": "context.user.id",
|
||||
"fieldName": "user.id",
|
||||
"label": "User ID",
|
||||
"val": "myUserId",
|
||||
"width": "25%",
|
||||
|
@ -128,14 +128,6 @@ exports[`DetailView should render tabs 1`] = `
|
|||
>
|
||||
Exception stacktrace
|
||||
</EuiTab>
|
||||
<EuiTab
|
||||
disabled={false}
|
||||
isSelected={false}
|
||||
key="request"
|
||||
onClick={[Function]}
|
||||
>
|
||||
Request
|
||||
</EuiTab>
|
||||
<EuiTab
|
||||
disabled={false}
|
||||
isSelected={false}
|
||||
|
@ -155,18 +147,10 @@ exports[`DetailView should render tabs 1`] = `
|
|||
<EuiTab
|
||||
disabled={false}
|
||||
isSelected={false}
|
||||
key="tags"
|
||||
key="labels"
|
||||
onClick={[Function]}
|
||||
>
|
||||
Tags
|
||||
</EuiTab>
|
||||
<EuiTab
|
||||
disabled={false}
|
||||
isSelected={false}
|
||||
key="custom"
|
||||
onClick={[Function]}
|
||||
>
|
||||
Custom
|
||||
Labels
|
||||
</EuiTab>
|
||||
</EuiTabs>
|
||||
`;
|
||||
|
|
|
@ -13,7 +13,6 @@ import {
|
|||
} from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { Location } from 'history';
|
||||
import idx from 'idx';
|
||||
import { first, get } from 'lodash';
|
||||
import React from 'react';
|
||||
import { RRRRenderResponse } from 'react-redux-request';
|
||||
|
@ -22,6 +21,7 @@ import {
|
|||
ERROR_EXC_STACKTRACE,
|
||||
ERROR_LOG_STACKTRACE
|
||||
} from 'x-pack/plugins/apm/common/constants';
|
||||
import { idx } from 'x-pack/plugins/apm/common/idx';
|
||||
import { KibanaLink } from 'x-pack/plugins/apm/public/components/shared/Links/KibanaLink';
|
||||
import { legacyEncodeURIComponent } from 'x-pack/plugins/apm/public/components/shared/Links/url_helpers';
|
||||
import {
|
||||
|
@ -33,7 +33,7 @@ import { NOT_AVAILABLE_LABEL } from 'x-pack/plugins/apm/public/constants';
|
|||
import { IUrlParams } from 'x-pack/plugins/apm/public/store/urlParams';
|
||||
import { ErrorGroupAPIResponse } from 'x-pack/plugins/apm/server/lib/errors/get_error_group';
|
||||
import { APMError } from 'x-pack/plugins/apm/typings/es_schemas/Error';
|
||||
import { IStackframe } from 'x-pack/plugins/apm/typings/es_schemas/Stackframe';
|
||||
import { IStackframe } from 'x-pack/plugins/apm/typings/es_schemas/fields/Stackframe';
|
||||
import { Transaction } from 'x-pack/plugins/apm/typings/es_schemas/Transaction';
|
||||
import {
|
||||
ERROR_EXC_HANDLED,
|
||||
|
@ -54,9 +54,9 @@ import {
|
|||
import { DiscoverErrorLink } from '../../../shared/Links/DiscoverLinks/DiscoverErrorLink';
|
||||
import {
|
||||
getPropertyTabNames,
|
||||
PropertiesTable,
|
||||
Tab
|
||||
PropertiesTable
|
||||
} from '../../../shared/PropertiesTable';
|
||||
import { Tab } from '../../../shared/PropertiesTable/propertyConfig';
|
||||
import { Stacktrace } from '../../../shared/Stacktrace';
|
||||
import { StickyProperties } from '../../../shared/StickyProperties';
|
||||
|
||||
|
@ -126,7 +126,7 @@ export function DetailView({ errorGroup, urlParams, location }: Props) {
|
|||
label: 'URL',
|
||||
val:
|
||||
idx(error, _ => _.context.page.url) ||
|
||||
idx(transaction, _ => _.context.request.url.full) ||
|
||||
idx(transaction, _ => _.url.full) ||
|
||||
NOT_AVAILABLE_LABEL,
|
||||
truncated: true,
|
||||
width: '50%'
|
||||
|
@ -239,7 +239,7 @@ function getTransactionLink(error: APMError, transaction?: Transaction) {
|
|||
}
|
||||
|
||||
const path = `/${
|
||||
transaction.context.service.name
|
||||
transaction.service.name
|
||||
}/transactions/${legacyEncodeURIComponent(
|
||||
transaction.transaction.type
|
||||
)}/${legacyEncodeURIComponent(transaction.transaction.name)}`;
|
||||
|
@ -266,8 +266,8 @@ export function TabContent({
|
|||
error: APMError;
|
||||
currentTab: Tab;
|
||||
}) {
|
||||
const codeLanguage = error.context.service.name;
|
||||
const agentName = error.context.service.agent.name;
|
||||
const codeLanguage = error.service.name;
|
||||
const agentName = error.agent.name;
|
||||
const excStackframes: MaybeStackframes = get(error, ERROR_EXC_STACKTRACE);
|
||||
const logStackframes: MaybeStackframes = get(error, ERROR_LOG_STACKTRACE);
|
||||
|
||||
|
@ -281,7 +281,7 @@ export function TabContent({
|
|||
<Stacktrace stackframes={excStackframes} codeLanguage={codeLanguage} />
|
||||
);
|
||||
default:
|
||||
const propData = error.context[currentTab.key] as any;
|
||||
const propData = get(error, currentTab);
|
||||
return (
|
||||
<PropertiesTable
|
||||
propData={propData}
|
||||
|
@ -300,11 +300,9 @@ export function getCurrentTab(tabs: Tab[] = [], selectedTabKey?: string) {
|
|||
|
||||
export function getTabs(error: APMError) {
|
||||
const hasLogStacktrace = get(error, ERROR_LOG_STACKTRACE, []).length > 0;
|
||||
const contextKeys = Object.keys(error.context);
|
||||
|
||||
return [
|
||||
...(hasLogStacktrace ? [logStacktraceTab] : []),
|
||||
exceptionStacktraceTab,
|
||||
...getPropertyTabNames(contextKeys)
|
||||
...getPropertyTabNames(error)
|
||||
];
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ Object {
|
|||
"filter": Array [
|
||||
Object {
|
||||
"term": Object {
|
||||
"context.service.name": "opbeans-node",
|
||||
"service.name": "opbeans-node",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
|
|
|
@ -44,7 +44,7 @@ const traceListColumns: ITableColumn[] = [
|
|||
)
|
||||
},
|
||||
{
|
||||
field: 'sample.context.service.name',
|
||||
field: 'sample.service.name',
|
||||
name: i18n.translate(
|
||||
'xpack.apm.tracesTable.originatingServiceColumnLabel',
|
||||
{
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import idx from 'idx';
|
||||
import { get } from 'lodash';
|
||||
import React from 'react';
|
||||
import { idx } from 'x-pack/plugins/apm/common/idx';
|
||||
import {
|
||||
REQUEST_URL_FULL,
|
||||
TRANSACTION_DURATION,
|
||||
|
@ -34,7 +34,7 @@ export function StickyTransactionProperties({
|
|||
const timestamp = transaction['@timestamp'];
|
||||
const url =
|
||||
idx(transaction, _ => _.context.page.url) ||
|
||||
idx(transaction, _ => _.context.request.url.full) ||
|
||||
idx(transaction, _ => _.url.full) ||
|
||||
NOT_AVAILABLE_LABEL;
|
||||
const duration = transaction.transaction.duration.us;
|
||||
const stickyProperties: IStickyProperty[] = [
|
||||
|
|
|
@ -20,9 +20,9 @@ import { IUrlParams } from '../../../../store/urlParams';
|
|||
import { px, units } from '../../../../style/variables';
|
||||
import {
|
||||
getPropertyTabNames,
|
||||
PropertiesTable,
|
||||
Tab
|
||||
PropertiesTable
|
||||
} from '../../../shared/PropertiesTable';
|
||||
import { Tab } from '../../../shared/PropertiesTable/propertyConfig';
|
||||
import { WaterfallContainer } from './WaterfallContainer';
|
||||
import { IWaterfall } from './WaterfallContainer/Waterfall/waterfall_helpers/waterfall_helpers';
|
||||
|
||||
|
@ -44,9 +44,8 @@ const timelineTab = {
|
|||
})
|
||||
};
|
||||
|
||||
function getTabs(transactionData: Transaction) {
|
||||
const dynamicProps = Object.keys(transactionData.context || {});
|
||||
return [timelineTab, ...getPropertyTabNames(dynamicProps)];
|
||||
function getTabs(transaction: Transaction) {
|
||||
return [timelineTab, ...getPropertyTabNames(transaction)];
|
||||
}
|
||||
|
||||
interface TransactionPropertiesTableProps {
|
||||
|
@ -64,7 +63,8 @@ export function TransactionPropertiesTable({
|
|||
}: TransactionPropertiesTableProps) {
|
||||
const tabs = getTabs(transaction);
|
||||
const currentTab = getCurrentTab(tabs, urlParams.detailTab);
|
||||
const agentName = transaction.context.service.agent.name;
|
||||
const agentName = transaction.agent.name;
|
||||
const isTimelineTab = currentTab.key === timelineTab.key;
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
@ -92,19 +92,17 @@ export function TransactionPropertiesTable({
|
|||
|
||||
<EuiSpacer />
|
||||
|
||||
{currentTab.key === timelineTab.key && (
|
||||
{isTimelineTab ? (
|
||||
<WaterfallContainer
|
||||
transaction={transaction}
|
||||
location={location}
|
||||
urlParams={urlParams}
|
||||
waterfall={waterfall}
|
||||
/>
|
||||
)}
|
||||
|
||||
{currentTab.key !== timelineTab.key && (
|
||||
) : (
|
||||
<TableContainer>
|
||||
<PropertiesTable
|
||||
propData={get(transaction.context, currentTab.key)}
|
||||
propData={get(transaction, currentTab.key)}
|
||||
propKey={currentTab.key}
|
||||
agentName={agentName}
|
||||
/>
|
||||
|
|
|
@ -17,9 +17,9 @@ import { Transaction } from '../../../../../typings/es_schemas/Transaction';
|
|||
import { IUrlParams } from '../../../../store/urlParams';
|
||||
import {
|
||||
getPropertyTabNames,
|
||||
PropertiesTable,
|
||||
Tab
|
||||
PropertiesTable
|
||||
} from '../../../shared/PropertiesTable';
|
||||
import { Tab } from '../../../shared/PropertiesTable/propertyConfig';
|
||||
|
||||
// Ensure the selected tab exists or use the first
|
||||
function getCurrentTab(tabs: Tab[] = [], selectedTabKey?: string) {
|
||||
|
@ -27,9 +27,8 @@ function getCurrentTab(tabs: Tab[] = [], selectedTabKey?: string) {
|
|||
return selectedTab ? selectedTab : first(tabs) || {};
|
||||
}
|
||||
|
||||
function getTabs(transactionData: Transaction) {
|
||||
const dynamicProps = Object.keys(transactionData.context || {});
|
||||
return getPropertyTabNames(dynamicProps);
|
||||
function getTabs(transaction: Transaction) {
|
||||
return getPropertyTabNames(transaction);
|
||||
}
|
||||
|
||||
interface Props {
|
||||
|
@ -45,7 +44,7 @@ export const TransactionPropertiesTableForFlyout: React.SFC<Props> = ({
|
|||
}) => {
|
||||
const tabs = getTabs(transaction);
|
||||
const currentTab = getCurrentTab(tabs, urlParams.flyoutDetailTab);
|
||||
const agentName = transaction.context.service.agent.name;
|
||||
const agentName = transaction.agent.name;
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
@ -72,7 +71,7 @@ export const TransactionPropertiesTableForFlyout: React.SFC<Props> = ({
|
|||
</EuiTabs>
|
||||
<EuiSpacer />
|
||||
<PropertiesTable
|
||||
propData={get(transaction.context, currentTab.key)}
|
||||
propData={get(transaction, currentTab.key)}
|
||||
propKey={currentTab.key}
|
||||
agentName={agentName}
|
||||
/>
|
||||
|
|
|
@ -31,8 +31,8 @@ export function FlyoutTopLevelProperties({ transaction }: Props) {
|
|||
}),
|
||||
fieldName: SERVICE_NAME,
|
||||
val: (
|
||||
<KibanaLink hash={`/${transaction.context.service.name}`}>
|
||||
{transaction.context.service.name}
|
||||
<KibanaLink hash={`/${transaction.service.name}`}>
|
||||
{transaction.service.name}
|
||||
</KibanaLink>
|
||||
),
|
||||
width: '50%'
|
||||
|
|
|
@ -16,7 +16,7 @@ import SyntaxHighlighter, {
|
|||
// @ts-ignore
|
||||
import { xcode } from 'react-syntax-highlighter/dist/styles';
|
||||
import styled from 'styled-components';
|
||||
import { DbContext } from '../../../../../../../../typings/es_schemas/Span';
|
||||
import { Span } from 'x-pack/plugins/apm/typings/es_schemas/Span';
|
||||
import {
|
||||
borderRadius,
|
||||
colors,
|
||||
|
@ -37,7 +37,7 @@ const DatabaseStatement = styled.div`
|
|||
`;
|
||||
|
||||
interface Props {
|
||||
dbContext?: DbContext;
|
||||
dbContext?: NonNullable<Span['context']>['db'];
|
||||
}
|
||||
|
||||
export function DatabaseContext({ dbContext }: Props) {
|
||||
|
|
|
@ -27,7 +27,7 @@ const ContextUrl = styled.div`
|
|||
`;
|
||||
|
||||
interface Props {
|
||||
httpContext: Span['context']['http'];
|
||||
httpContext: NonNullable<Span['context']>['http'];
|
||||
}
|
||||
|
||||
export function HttpContext({ httpContext }: Props) {
|
||||
|
|
|
@ -22,18 +22,16 @@ import { i18n } from '@kbn/i18n';
|
|||
import { get, keys } from 'lodash';
|
||||
import React, { Fragment } from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { SERVICE_LANGUAGE_NAME } from '../../../../../../../../common/constants';
|
||||
|
||||
import { DatabaseContext } from './DatabaseContext';
|
||||
import { HttpContext } from './HttpContext';
|
||||
import { StickySpanProperties } from './StickySpanProperties';
|
||||
|
||||
import { idx } from 'x-pack/plugins/apm/common/idx';
|
||||
import { DiscoverSpanLink } from 'x-pack/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverSpanLink';
|
||||
import { Stacktrace } from 'x-pack/plugins/apm/public/components/shared/Stacktrace';
|
||||
import { Transaction } from 'x-pack/plugins/apm/typings/es_schemas/Transaction';
|
||||
import { SERVICE_LANGUAGE_NAME } from '../../../../../../../../common/constants';
|
||||
import { Span } from '../../../../../../../../typings/es_schemas/Span';
|
||||
import { FlyoutTopLevelProperties } from '../FlyoutTopLevelProperties';
|
||||
import { DatabaseContext } from './DatabaseContext';
|
||||
import { HttpContext } from './HttpContext';
|
||||
import { StickySpanProperties } from './StickySpanProperties';
|
||||
|
||||
const TagName = styled.div`
|
||||
font-weight: bold;
|
||||
|
@ -55,14 +53,15 @@ export function SpanFlyout({
|
|||
if (!span) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const stackframes = span.span.stacktrace;
|
||||
const codeLanguage: string = get(span, SERVICE_LANGUAGE_NAME);
|
||||
const dbContext = span.context.db;
|
||||
const httpContext = span.context.http;
|
||||
const tagContext = span.context.tags;
|
||||
const tags = keys(tagContext).map(key => ({
|
||||
const dbContext = idx(span, _ => _.context.db);
|
||||
const httpContext = idx(span, _ => _.context.http);
|
||||
const labels = span.labels;
|
||||
const tags = keys(labels).map(key => ({
|
||||
key,
|
||||
value: get(tagContext, key)
|
||||
value: get(labels, key)
|
||||
}));
|
||||
|
||||
return (
|
||||
|
|
|
@ -18,9 +18,9 @@ import {
|
|||
} from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { Location } from 'history';
|
||||
import { get } from 'lodash';
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { idx } from 'x-pack/plugins/apm/common/idx';
|
||||
import { TransactionActionMenu } from 'x-pack/plugins/apm/public/components/shared/TransactionActionMenu/TransactionActionMenu';
|
||||
import { IUrlParams } from 'x-pack/plugins/apm/public/store/urlParams';
|
||||
import { DROPPED_SPANS_DOCS } from 'x-pack/plugins/apm/public/utils/documentation/apm-get-started';
|
||||
|
@ -63,13 +63,8 @@ function DroppedSpansWarning({
|
|||
}: {
|
||||
transactionDoc: Transaction;
|
||||
}) {
|
||||
const dropped: number = get(
|
||||
transactionDoc,
|
||||
'transaction.span_count.dropped.total',
|
||||
0
|
||||
);
|
||||
|
||||
if (dropped === 0) {
|
||||
const dropped = idx(transactionDoc, _ => _.transaction.span_count.dropped);
|
||||
if (!dropped) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ function PrefixIcon({ item }: { item: IWaterfallItem }) {
|
|||
}
|
||||
|
||||
// icon for RUM agent transactions
|
||||
const isRumAgent = item.transaction.context.service.agent.name === 'js-base';
|
||||
const isRumAgent = item.transaction.agent.name === 'js-base';
|
||||
if (isRumAgent) {
|
||||
return <EuiIcon type="globe" />;
|
||||
}
|
||||
|
|
|
@ -16,23 +16,23 @@
|
|||
"duration": {
|
||||
"us": 1380
|
||||
},
|
||||
"hex_id": "8143a38f3367fd97"
|
||||
"id": "8143a38f3367fd97"
|
||||
},
|
||||
"transaction": {
|
||||
"id": "e070bc3c732087f8"
|
||||
},
|
||||
"service": {
|
||||
"name": "opbeans-java",
|
||||
"agent": {
|
||||
"version": "0.7.0-SNAPSHOT",
|
||||
"name": "java"
|
||||
}
|
||||
},
|
||||
"context": {
|
||||
"db": {
|
||||
"statement": "select order0_.id as col_0_0_, order0_.created_at as col_1_0_, customer1_.full_name as col_2_0_ from orders order0_ left outer join customers customer1_ on order0_.customer_id=customer1_.id",
|
||||
"type": "sql",
|
||||
"user": "SA"
|
||||
},
|
||||
"service": {
|
||||
"name": "opbeans-java",
|
||||
"agent": {
|
||||
"version": "0.7.0-SNAPSHOT",
|
||||
"name": "java"
|
||||
}
|
||||
}
|
||||
},
|
||||
"beat": {
|
||||
|
@ -41,7 +41,7 @@
|
|||
"hostname": "361022bff072"
|
||||
},
|
||||
"host": {
|
||||
"name": "361022bff072"
|
||||
"hostname": "361022bff072"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
@ -14,13 +14,31 @@
|
|||
"sampled": true,
|
||||
"span_count": {
|
||||
"started": 1,
|
||||
"dropped": {
|
||||
"total": 0
|
||||
}
|
||||
"dropped": 0
|
||||
},
|
||||
"id": "e070bc3c732087f8",
|
||||
"name": "APIRestController#orders"
|
||||
},
|
||||
"service": {
|
||||
"language": {
|
||||
"version": "10.0.2",
|
||||
"name": "Java"
|
||||
},
|
||||
"runtime": {
|
||||
"name": "Java",
|
||||
"version": "10.0.2"
|
||||
},
|
||||
"name": "opbeans-java",
|
||||
"agent": {
|
||||
"name": "java",
|
||||
"version": "0.7.0-SNAPSHOT"
|
||||
}
|
||||
},
|
||||
"process": {
|
||||
"ppid": 10060,
|
||||
"title": "/Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home/bin/java",
|
||||
"pid": 10069
|
||||
},
|
||||
"context": {
|
||||
"request": {
|
||||
"url": {
|
||||
|
@ -60,26 +78,6 @@
|
|||
"platform": "Srens-MacBook-Pro.local",
|
||||
"ip": "172.18.0.1",
|
||||
"hostname": "Mac OS X"
|
||||
},
|
||||
"process": {
|
||||
"ppid": 10060,
|
||||
"title": "/Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home/bin/java",
|
||||
"pid": 10069
|
||||
},
|
||||
"service": {
|
||||
"language": {
|
||||
"version": "10.0.2",
|
||||
"name": "Java"
|
||||
},
|
||||
"runtime": {
|
||||
"name": "Java",
|
||||
"version": "10.0.2"
|
||||
},
|
||||
"name": "opbeans-java",
|
||||
"agent": {
|
||||
"name": "java",
|
||||
"version": "0.7.0-SNAPSHOT"
|
||||
}
|
||||
}
|
||||
},
|
||||
"beat": {
|
||||
|
@ -88,6 +86,6 @@
|
|||
"hostname": "361022bff072"
|
||||
},
|
||||
"host": {
|
||||
"name": "361022bff072"
|
||||
"hostname": "361022bff072"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,24 +84,10 @@ export type IWaterfallItem = IWaterfallItemSpan | IWaterfallItemTransaction;
|
|||
function getTransactionItem(
|
||||
transaction: Transaction
|
||||
): IWaterfallItemTransaction {
|
||||
if (transaction.version === 'v1') {
|
||||
return {
|
||||
id: transaction.transaction.id,
|
||||
serviceName: transaction.context.service.name,
|
||||
name: transaction.transaction.name,
|
||||
duration: transaction.transaction.duration.us,
|
||||
timestamp: new Date(transaction['@timestamp']).getTime() * 1000,
|
||||
offset: 0,
|
||||
skew: 0,
|
||||
docType: 'transaction',
|
||||
transaction
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
id: transaction.transaction.id,
|
||||
parentId: transaction.parent && transaction.parent.id,
|
||||
serviceName: transaction.context.service.name,
|
||||
serviceName: transaction.service.name,
|
||||
name: transaction.transaction.name,
|
||||
duration: transaction.transaction.duration.us,
|
||||
timestamp: transaction.timestamp.us,
|
||||
|
@ -113,26 +99,10 @@ function getTransactionItem(
|
|||
}
|
||||
|
||||
function getSpanItem(span: Span): IWaterfallItemSpan {
|
||||
if (span.version === 'v1') {
|
||||
return {
|
||||
id: span.span.id,
|
||||
parentId: span.span.parent || span.transaction.id,
|
||||
serviceName: span.context.service.name,
|
||||
name: span.span.name,
|
||||
duration: span.span.duration.us,
|
||||
timestamp:
|
||||
new Date(span['@timestamp']).getTime() * 1000 + span.span.start.us,
|
||||
offset: 0,
|
||||
skew: 0,
|
||||
docType: 'span',
|
||||
span
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
id: span.span.hex_id,
|
||||
id: span.span.id,
|
||||
parentId: span.parent && span.parent.id,
|
||||
serviceName: span.context.service.name,
|
||||
serviceName: span.service.name,
|
||||
name: span.span.name,
|
||||
duration: span.span.duration.us,
|
||||
timestamp: span.timestamp.us,
|
||||
|
|
|
@ -13,7 +13,7 @@ import { APMError } from 'x-pack/plugins/apm/typings/es_schemas/Error';
|
|||
import { DiscoverLink } from './DiscoverLink';
|
||||
|
||||
function getDiscoverQuery(error: APMError, kuery?: string) {
|
||||
const serviceName = error.context.service.name;
|
||||
const serviceName = error.service.name;
|
||||
const groupId = error.error.grouping_key;
|
||||
let query = `${SERVICE_NAME}:"${serviceName}" AND ${ERROR_GROUP_ID}:"${groupId}"`;
|
||||
if (kuery) {
|
||||
|
|
|
@ -5,16 +5,12 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { SPAN_HEX_ID, SPAN_ID } from 'x-pack/plugins/apm/common/constants';
|
||||
import { SPAN_ID } from 'x-pack/plugins/apm/common/constants';
|
||||
import { Span } from 'x-pack/plugins/apm/typings/es_schemas/Span';
|
||||
import { DiscoverLink } from './DiscoverLink';
|
||||
|
||||
function getDiscoverQuery(span: Span) {
|
||||
const query =
|
||||
span.version === 'v2'
|
||||
? `${SPAN_HEX_ID}:"${span.span.hex_id}"`
|
||||
: `${SPAN_ID}:"${span.span.id}"`;
|
||||
|
||||
const query = `${SPAN_ID}:"${span.span.id}"`;
|
||||
return {
|
||||
_a: {
|
||||
interval: 'auto',
|
||||
|
|
|
@ -15,8 +15,7 @@ import { DiscoverLink } from './DiscoverLink';
|
|||
|
||||
export function getDiscoverQuery(transaction: Transaction) {
|
||||
const transactionId = transaction.transaction.id;
|
||||
const traceId =
|
||||
transaction.version === 'v2' ? transaction.trace.id : undefined;
|
||||
const traceId = transaction.trace.id;
|
||||
|
||||
let query = `${PROCESSOR_EVENT}:"transaction" AND ${TRANSACTION_ID}:"${transactionId}"`;
|
||||
if (traceId) {
|
||||
|
|
|
@ -14,7 +14,7 @@ describe('DiscoverErrorLink without kuery', () => {
|
|||
let wrapper: ShallowWrapper;
|
||||
beforeEach(() => {
|
||||
const error = {
|
||||
context: { service: { name: 'myServiceName' } },
|
||||
service: { name: 'myServiceName' },
|
||||
error: { grouping_key: 'myGroupingKey' }
|
||||
} as APMError;
|
||||
|
||||
|
@ -24,7 +24,7 @@ describe('DiscoverErrorLink without kuery', () => {
|
|||
it('should have correct query', () => {
|
||||
const queryProp = wrapper.prop('query') as any;
|
||||
expect(queryProp._a.query.query).toEqual(
|
||||
'context.service.name:"myServiceName" AND error.grouping_key:"myGroupingKey"'
|
||||
'service.name:"myServiceName" AND error.grouping_key:"myGroupingKey"'
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -37,7 +37,7 @@ describe('DiscoverErrorLink with kuery', () => {
|
|||
let wrapper: ShallowWrapper;
|
||||
beforeEach(() => {
|
||||
const error = {
|
||||
context: { service: { name: 'myServiceName' } },
|
||||
service: { name: 'myServiceName' },
|
||||
error: { grouping_key: 'myGroupingKey' }
|
||||
} as APMError;
|
||||
|
||||
|
@ -49,7 +49,7 @@ describe('DiscoverErrorLink with kuery', () => {
|
|||
it('should have correct query', () => {
|
||||
const queryProp = wrapper.prop('query') as any;
|
||||
expect(queryProp._a.query.query).toEqual(
|
||||
'context.service.name:"myServiceName" AND error.grouping_key:"myGroupingKey" AND transaction.sampled: true'
|
||||
'service.name:"myServiceName" AND error.grouping_key:"myGroupingKey" AND transaction.sampled: true'
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ exports[`DiscoverErrorLink with kuery should match snapshot 1`] = `
|
|||
"interval": "auto",
|
||||
"query": Object {
|
||||
"language": "lucene",
|
||||
"query": "context.service.name:\\"myServiceName\\" AND error.grouping_key:\\"myGroupingKey\\" AND transaction.sampled: true",
|
||||
"query": "service.name:\\"myServiceName\\" AND error.grouping_key:\\"myGroupingKey\\" AND transaction.sampled: true",
|
||||
},
|
||||
"sort": Object {
|
||||
"@timestamp": "desc",
|
||||
|
@ -27,7 +27,7 @@ exports[`DiscoverErrorLink without kuery should match snapshot 1`] = `
|
|||
"interval": "auto",
|
||||
"query": Object {
|
||||
"language": "lucene",
|
||||
"query": "context.service.name:\\"myServiceName\\" AND error.grouping_key:\\"myGroupingKey\\"",
|
||||
"query": "service.name:\\"myServiceName\\" AND error.grouping_key:\\"myGroupingKey\\"",
|
||||
},
|
||||
"sort": Object {
|
||||
"@timestamp": "desc",
|
||||
|
|
|
@ -13,7 +13,38 @@
|
|||
},
|
||||
"@timestamp": "2018-12-18T00:14:30.952Z",
|
||||
"host": {
|
||||
"name": "227453131a17"
|
||||
"hostname": "227453131a17"
|
||||
},
|
||||
"service": {
|
||||
"agent": {
|
||||
"name": "go",
|
||||
"version": "1.1.1"
|
||||
},
|
||||
"framework": {
|
||||
"name": "gin",
|
||||
"version": "v1.4.0-dev"
|
||||
},
|
||||
"name": "opbeans-go",
|
||||
"runtime": {
|
||||
"name": "gc",
|
||||
"version": "go1.10.6"
|
||||
},
|
||||
"language": {
|
||||
"name": "go",
|
||||
"version": "go1.10.6"
|
||||
}
|
||||
},
|
||||
"process": {
|
||||
"pid": 1,
|
||||
"title": "opbeans-go",
|
||||
"argv": [
|
||||
"/opbeans-go",
|
||||
"-listen=:3000",
|
||||
"-frontend=/opbeans-frontend",
|
||||
"-db=postgres:",
|
||||
"-cache=redis://redis:6379"
|
||||
],
|
||||
"ppid": 0
|
||||
},
|
||||
"context": {
|
||||
"request": {
|
||||
|
@ -35,18 +66,6 @@
|
|||
"pathname": "/api/products/3/customers"
|
||||
}
|
||||
},
|
||||
"process": {
|
||||
"pid": 1,
|
||||
"title": "opbeans-go",
|
||||
"argv": [
|
||||
"/opbeans-go",
|
||||
"-listen=:3000",
|
||||
"-frontend=/opbeans-frontend",
|
||||
"-db=postgres:",
|
||||
"-cache=redis://redis:6379"
|
||||
],
|
||||
"ppid": 0
|
||||
},
|
||||
"system": {
|
||||
"hostname": "8acb9c1a71f3",
|
||||
"ip": "172.18.0.7",
|
||||
|
@ -63,25 +82,6 @@
|
|||
"Content-Type": "application/json; charset=utf-8"
|
||||
},
|
||||
"status_code": 200
|
||||
},
|
||||
"service": {
|
||||
"agent": {
|
||||
"name": "go",
|
||||
"version": "1.1.1"
|
||||
},
|
||||
"framework": {
|
||||
"name": "gin",
|
||||
"version": "v1.4.0-dev"
|
||||
},
|
||||
"name": "opbeans-go",
|
||||
"runtime": {
|
||||
"name": "gc",
|
||||
"version": "go1.10.6"
|
||||
},
|
||||
"language": {
|
||||
"name": "go",
|
||||
"version": "go1.10.6"
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction": {
|
||||
|
@ -110,6 +110,5 @@
|
|||
},
|
||||
"timestamp": {
|
||||
"us": 1545092070952472
|
||||
},
|
||||
"version": "v2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,9 @@ describe('PropertiesTable', () => {
|
|||
label: 'requiredPropertyLabel'
|
||||
}
|
||||
];
|
||||
expect(getPropertyTabNames(['testProperty'])).toEqual(expectedTabsConfig);
|
||||
expect(getPropertyTabNames({ testProperty: {} } as any)).toEqual(
|
||||
expectedTabsConfig
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@ import { i18n } from '@kbn/i18n';
|
|||
import { get, indexBy, uniq } from 'lodash';
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { APMError } from 'x-pack/plugins/apm/typings/es_schemas/Error';
|
||||
import { Transaction } from 'x-pack/plugins/apm/typings/es_schemas/Transaction';
|
||||
import { StringMap } from '../../../../typings/common';
|
||||
import {
|
||||
colors,
|
||||
|
@ -44,14 +46,9 @@ const EuiIconWithSpace = styled(EuiIcon)`
|
|||
margin-right: ${px(units.half)};
|
||||
`;
|
||||
|
||||
export interface Tab {
|
||||
key: string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
export function getPropertyTabNames(selected: string[]): Tab[] {
|
||||
export function getPropertyTabNames(obj: Transaction | APMError) {
|
||||
return PROPERTY_CONFIG.filter(
|
||||
({ key, required }) => required || selected.includes(key)
|
||||
({ key, required }) => required || obj.hasOwnProperty(key)
|
||||
).map(({ key, label }) => ({ key, label }));
|
||||
}
|
||||
|
||||
|
|
|
@ -5,39 +5,53 @@
|
|||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { APMError } from 'x-pack/plugins/apm/typings/es_schemas/Error';
|
||||
import { Transaction } from 'x-pack/plugins/apm/typings/es_schemas/Transaction';
|
||||
|
||||
export interface Tab {
|
||||
key: string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
type AllKeys = keyof NonNullable<Transaction> | keyof NonNullable<APMError>;
|
||||
interface ConfigItem<T extends AllKeys> {
|
||||
key: T;
|
||||
label: string;
|
||||
required: boolean;
|
||||
presortedKeys: Array<
|
||||
T extends keyof Transaction
|
||||
? keyof NonNullable<Transaction[T]>
|
||||
: T extends keyof APMError
|
||||
? keyof NonNullable<APMError[T]>
|
||||
: never
|
||||
>;
|
||||
}
|
||||
|
||||
export const PROPERTY_CONFIG = [
|
||||
{
|
||||
key: 'request',
|
||||
label: i18n.translate('xpack.apm.propertiesTable.tabs.requestLabel', {
|
||||
defaultMessage: 'Request'
|
||||
key: 'url',
|
||||
label: i18n.translate('xpack.apm.propertiesTable.tabs.urlLabel', {
|
||||
defaultMessage: 'Url'
|
||||
}),
|
||||
required: false,
|
||||
presortedKeys: [
|
||||
'http_version',
|
||||
'method',
|
||||
'url',
|
||||
'socket',
|
||||
'headers',
|
||||
'body'
|
||||
]
|
||||
},
|
||||
presortedKeys: []
|
||||
} as ConfigItem<'url'>,
|
||||
{
|
||||
key: 'response',
|
||||
label: i18n.translate('xpack.apm.propertiesTable.tabs.responseLabel', {
|
||||
defaultMessage: 'Response'
|
||||
key: 'http',
|
||||
label: i18n.translate('xpack.apm.propertiesTable.tabs.httpLabel', {
|
||||
defaultMessage: 'HTTP'
|
||||
}),
|
||||
required: false,
|
||||
presortedKeys: ['status_code', 'headers', 'headers_sent', 'finished']
|
||||
},
|
||||
presortedKeys: []
|
||||
} as ConfigItem<'http'>,
|
||||
{
|
||||
key: 'system',
|
||||
label: i18n.translate('xpack.apm.propertiesTable.tabs.systemLabel', {
|
||||
defaultMessage: 'System'
|
||||
key: 'host',
|
||||
label: i18n.translate('xpack.apm.propertiesTable.tabs.hostLabel', {
|
||||
defaultMessage: 'Host'
|
||||
}),
|
||||
required: false,
|
||||
presortedKeys: ['hostname', 'architecture', 'platform']
|
||||
},
|
||||
} as ConfigItem<'host'>,
|
||||
{
|
||||
key: 'service',
|
||||
label: i18n.translate('xpack.apm.propertiesTable.tabs.serviceLabel', {
|
||||
|
@ -45,15 +59,15 @@ export const PROPERTY_CONFIG = [
|
|||
}),
|
||||
required: false,
|
||||
presortedKeys: ['runtime', 'framework', 'agent', 'version']
|
||||
},
|
||||
} as ConfigItem<'service'>,
|
||||
{
|
||||
key: 'process',
|
||||
label: i18n.translate('xpack.apm.propertiesTable.tabs.processLabel', {
|
||||
defaultMessage: 'Process'
|
||||
}),
|
||||
required: false,
|
||||
presortedKeys: ['pid', 'title', 'argv']
|
||||
},
|
||||
presortedKeys: ['pid', 'title', 'args']
|
||||
} as ConfigItem<'process'>,
|
||||
{
|
||||
key: 'user',
|
||||
label: i18n.translate('xpack.apm.propertiesTable.tabs.userLabel', {
|
||||
|
@ -61,21 +75,13 @@ export const PROPERTY_CONFIG = [
|
|||
}),
|
||||
required: true,
|
||||
presortedKeys: ['id', 'username', 'email']
|
||||
},
|
||||
} as ConfigItem<'user'>,
|
||||
{
|
||||
key: 'tags',
|
||||
label: i18n.translate('xpack.apm.propertiesTable.tabs.tagsLabel', {
|
||||
defaultMessage: 'Tags'
|
||||
key: 'labels',
|
||||
label: i18n.translate('xpack.apm.propertiesTable.tabs.labelsLabel', {
|
||||
defaultMessage: 'Labels'
|
||||
}),
|
||||
required: true,
|
||||
presortedKeys: []
|
||||
},
|
||||
{
|
||||
key: 'custom',
|
||||
label: i18n.translate('xpack.apm.propertiesTable.tabs.customLabel', {
|
||||
defaultMessage: 'Custom'
|
||||
}),
|
||||
required: true,
|
||||
presortedKeys: []
|
||||
}
|
||||
} as ConfigItem<'labels'>
|
||||
];
|
||||
|
|
|
@ -20,7 +20,7 @@ import { registerLanguage } from 'react-syntax-highlighter/dist/light';
|
|||
// @ts-ignore
|
||||
import { xcode } from 'react-syntax-highlighter/dist/styles';
|
||||
import styled from 'styled-components';
|
||||
import { IStackframeWithLineContext } from 'x-pack/plugins/apm/typings/es_schemas/Stackframe';
|
||||
import { IStackframeWithLineContext } from 'x-pack/plugins/apm/typings/es_schemas/fields/Stackframe';
|
||||
import {
|
||||
borderRadius,
|
||||
colors,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { get } from 'lodash';
|
||||
import React, { Fragment } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { IStackframe } from '../../../../typings/es_schemas/Stackframe';
|
||||
import { IStackframe } from '../../../../typings/es_schemas/fields/Stackframe';
|
||||
import { colors, fontFamilyCode, px, units } from '../../../style/variables';
|
||||
|
||||
const FileDetails = styled.div`
|
||||
|
|
|
@ -8,7 +8,7 @@ import { EuiLink, EuiSpacer } from '@elastic/eui';
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import React, { Fragment } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { IStackframe } from 'x-pack/plugins/apm/typings/es_schemas/Stackframe';
|
||||
import { IStackframe } from 'x-pack/plugins/apm/typings/es_schemas/fields/Stackframe';
|
||||
import { units } from '../../../style/variables';
|
||||
// @ts-ignore
|
||||
import { Ellipsis } from '../../shared/Icons';
|
||||
|
|
|
@ -9,7 +9,7 @@ import styled from 'styled-components';
|
|||
import {
|
||||
IStackframe,
|
||||
IStackframeWithLineContext
|
||||
} from '../../../../typings/es_schemas/Stackframe';
|
||||
} from 'x-pack/plugins/apm/typings/es_schemas/fields/Stackframe';
|
||||
import { borderRadius, colors, fontFamilyCode } from '../../../style/variables';
|
||||
import { FrameHeading } from '../Stacktrace/FrameHeading';
|
||||
import { Context } from './Context';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { IStackframe } from 'x-pack/plugins/apm/typings/es_schemas/Stackframe';
|
||||
import { IStackframe } from 'x-pack/plugins/apm/typings/es_schemas/fields/Stackframe';
|
||||
import {
|
||||
borderRadius,
|
||||
colors,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { mount, ReactWrapper, shallow } from 'enzyme';
|
||||
import 'jest-styled-components';
|
||||
import React from 'react';
|
||||
import { IStackframe } from 'x-pack/plugins/apm/typings/es_schemas/Stackframe';
|
||||
import { IStackframe } from 'x-pack/plugins/apm/typings/es_schemas/fields/Stackframe';
|
||||
import { Stackframe } from '../Stackframe';
|
||||
import stacktracesMock from './stacktraces.json';
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { IStackframe } from '../../../../../typings/es_schemas/Stackframe';
|
||||
import { IStackframe } from 'x-pack/plugins/apm/typings/es_schemas/fields/Stackframe';
|
||||
import { getGroupedStackframes } from '../index';
|
||||
import stacktracesMock from './stacktraces.json';
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import { EuiSpacer } from '@elastic/eui';
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import { isEmpty, last } from 'lodash';
|
||||
import React, { Fragment } from 'react';
|
||||
import { IStackframe } from '../../../../typings/es_schemas/Stackframe';
|
||||
import { IStackframe } from '../../../../typings/es_schemas/fields/Stackframe';
|
||||
import { EmptyMessage } from '../../shared/EmptyMessage';
|
||||
// @ts-ignore
|
||||
import { Ellipsis } from '../../shared/Icons';
|
||||
|
|
|
@ -28,7 +28,7 @@ describe('StickyProperties', () => {
|
|||
},
|
||||
{
|
||||
label: 'Request method',
|
||||
fieldName: 'context.request.method',
|
||||
fieldName: 'http.request.method',
|
||||
val: 'GET'
|
||||
},
|
||||
{
|
||||
|
|
|
@ -61,7 +61,7 @@ exports[`StickyProperties should render entire component 1`] = `
|
|||
<EuiToolTip
|
||||
content={
|
||||
<styled.span>
|
||||
context.request.url.full
|
||||
url.full
|
||||
</styled.span>
|
||||
}
|
||||
delay="regular"
|
||||
|
@ -97,7 +97,7 @@ exports[`StickyProperties should render entire component 1`] = `
|
|||
<EuiToolTip
|
||||
content={
|
||||
<styled.span>
|
||||
context.request.method
|
||||
http.request.method
|
||||
</styled.span>
|
||||
}
|
||||
delay="regular"
|
||||
|
@ -157,7 +157,7 @@ exports[`StickyProperties should render entire component 1`] = `
|
|||
<EuiToolTip
|
||||
content={
|
||||
<styled.span>
|
||||
context.user.id
|
||||
user.id
|
||||
</styled.span>
|
||||
}
|
||||
delay="regular"
|
||||
|
|
|
@ -16,14 +16,11 @@ import {
|
|||
} from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { Location } from 'history';
|
||||
import idx from 'idx';
|
||||
import React from 'react';
|
||||
import { idx } from 'x-pack/plugins/apm/common/idx';
|
||||
import { getKibanaHref } from 'x-pack/plugins/apm/public/components/shared/Links/url_helpers';
|
||||
import { StringMap } from 'x-pack/plugins/apm/typings/common';
|
||||
import {
|
||||
Transaction,
|
||||
TransactionV2
|
||||
} from 'x-pack/plugins/apm/typings/es_schemas/Transaction';
|
||||
import { Transaction } from 'x-pack/plugins/apm/typings/es_schemas/Transaction';
|
||||
import { getDiscoverQuery } from '../Links/DiscoverLinks/DiscoverTransactionLink';
|
||||
import { QueryWithIndexPattern } from '../Links/DiscoverLinks/QueryWithIndexPattern';
|
||||
|
||||
|
@ -74,12 +71,9 @@ export class TransactionActionMenu extends React.Component<Props, State> {
|
|||
|
||||
public getInfraActions() {
|
||||
const { transaction, location } = this.props;
|
||||
const hostName = idx(transaction, _ => _.context.system.hostname);
|
||||
const podId = idx(transaction as TransactionV2, _ => _.kubernetes.pod.uid);
|
||||
const containerId = idx(
|
||||
transaction as TransactionV2,
|
||||
_ => _.docker.container.id
|
||||
);
|
||||
const hostName = idx(transaction, _ => _.host.hostname);
|
||||
const podId = idx(transaction, _ => _.kubernetes.pod.uid);
|
||||
const containerId = idx(transaction, _ => _.container.id);
|
||||
const pathname = '/app/infra';
|
||||
const time = new Date(transaction['@timestamp']).getTime();
|
||||
const infraMetricsQuery = getInfraMetricsQuery(transaction);
|
||||
|
|
|
@ -5,17 +5,15 @@
|
|||
*/
|
||||
|
||||
import { shallow } from 'enzyme';
|
||||
import { Location } from 'history';
|
||||
import 'jest-styled-components';
|
||||
import React from 'react';
|
||||
import { Transaction } from 'x-pack/plugins/apm/typings/es_schemas/Transaction';
|
||||
import { TransactionActionMenu } from '../TransactionActionMenu';
|
||||
import transactionActionMenuProps from './transactionActionMenuProps.json';
|
||||
import { props } from './transactionActionMenuProps';
|
||||
|
||||
describe('TransactionActionMenu component', () => {
|
||||
it('should render with data', () => {
|
||||
const transaction: Transaction = transactionActionMenuProps.transaction;
|
||||
const location: Location = transactionActionMenuProps.location;
|
||||
const transaction = props.transaction;
|
||||
const location = props.location;
|
||||
|
||||
expect(
|
||||
shallow(
|
||||
|
|
|
@ -94,7 +94,7 @@ exports[`TransactionActionMenu component should render with data 1`] = `
|
|||
</EuiFlexGroup>
|
||||
</EuiContextMenuItem>,
|
||||
<EuiContextMenuItem
|
||||
href="/app/infra#/link-to/host-logs/8acb9c1a71f3?time=1545092070952&_g=(time:(from:now-24h,mode:quick,to:now))&_a="
|
||||
href="/app/infra#/link-to/host-logs/227453131a17?time=1545092070952&_g=(time:(from:now-24h,mode:quick,to:now))&_a="
|
||||
icon="loggingApp"
|
||||
layoutAlign="center"
|
||||
toolTipPosition="right"
|
||||
|
@ -205,7 +205,7 @@ exports[`TransactionActionMenu component should render with data 1`] = `
|
|||
</EuiFlexGroup>
|
||||
</EuiContextMenuItem>,
|
||||
<EuiContextMenuItem
|
||||
href="/app/infra#/link-to/host-detail/8acb9c1a71f3?from=1545091770952&to=1545092370952&_g=(time:(from:now-24h,mode:quick,to:now))&_a="
|
||||
href="/app/infra#/link-to/host-detail/227453131a17?from=1545091770952&to=1545092370952&_g=(time:(from:now-24h,mode:quick,to:now))&_a="
|
||||
icon="infraApp"
|
||||
layoutAlign="center"
|
||||
toolTipPosition="right"
|
||||
|
|
|
@ -1,124 +0,0 @@
|
|||
{
|
||||
"transaction": {
|
||||
"agent": {
|
||||
"hostname": "227453131a17",
|
||||
"type": "apm-server",
|
||||
"version": "7.0.0"
|
||||
},
|
||||
"processor": {
|
||||
"name": "transaction",
|
||||
"event": "transaction"
|
||||
},
|
||||
"trace": {
|
||||
"id": "8b60bd32ecc6e1506735a8b6cfcf175c"
|
||||
},
|
||||
"@timestamp": "2018-12-18T00:14:30.952Z",
|
||||
"host": {
|
||||
"name": "227453131a17"
|
||||
},
|
||||
"context": {
|
||||
"request": {
|
||||
"headers": {
|
||||
"Accept": "*/*",
|
||||
"User-Agent": "Python/3.7 aiohttp/3.3.2",
|
||||
"Accept-Encoding": "gzip, deflate"
|
||||
},
|
||||
"method": "GET",
|
||||
"http_version": "1.1",
|
||||
"socket": {
|
||||
"remote_address": "172.18.0.12"
|
||||
},
|
||||
"url": {
|
||||
"protocol": "http",
|
||||
"hostname": "172.18.0.7",
|
||||
"port": "3000",
|
||||
"full": "http://172.18.0.7:3000/api/products/3/customers",
|
||||
"pathname": "/api/products/3/customers"
|
||||
}
|
||||
},
|
||||
"process": {
|
||||
"pid": 1,
|
||||
"title": "opbeans-go",
|
||||
"argv": [
|
||||
"/opbeans-go",
|
||||
"-listen=:3000",
|
||||
"-frontend=/opbeans-frontend",
|
||||
"-db=postgres:",
|
||||
"-cache=redis://redis:6379"
|
||||
],
|
||||
"ppid": 0
|
||||
},
|
||||
"system": {
|
||||
"hostname": "8acb9c1a71f3",
|
||||
"ip": "172.18.0.7",
|
||||
"platform": "linux",
|
||||
"architecture": "amd64"
|
||||
},
|
||||
"response": {
|
||||
"headers": {
|
||||
"X-Frame-Options": "SAMEORIGIN",
|
||||
"Server": "gunicorn/19.9.0",
|
||||
"Vary": "Cookie",
|
||||
"Content-Length": "31646",
|
||||
"Date": "Tue, 18 Dec 2018 00:14:45 GMT",
|
||||
"Content-Type": "application/json; charset=utf-8"
|
||||
},
|
||||
"status_code": 200
|
||||
},
|
||||
"service": {
|
||||
"agent": {
|
||||
"name": "go",
|
||||
"version": "1.1.1"
|
||||
},
|
||||
"framework": {
|
||||
"name": "gin",
|
||||
"version": "v1.4.0-dev"
|
||||
},
|
||||
"name": "opbeans-go",
|
||||
"runtime": {
|
||||
"name": "gc",
|
||||
"version": "go1.10.6"
|
||||
},
|
||||
"language": {
|
||||
"name": "go",
|
||||
"version": "go1.10.6"
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction": {
|
||||
"result": "HTTP 2xx",
|
||||
"duration": {
|
||||
"us": 14586403
|
||||
},
|
||||
"name": "GET /api/products/:id/customers",
|
||||
"span_count": {
|
||||
"dropped": {
|
||||
"total": 0
|
||||
},
|
||||
"started": 1
|
||||
},
|
||||
"id": "8b60bd32ecc6e150",
|
||||
"type": "request",
|
||||
"sampled": true
|
||||
},
|
||||
"kubernetes": {
|
||||
"pod": {
|
||||
"uid": "pod123456abcdef"
|
||||
}
|
||||
},
|
||||
"docker": {
|
||||
"container": {
|
||||
"id": "container123456abcdef"
|
||||
}
|
||||
},
|
||||
"timestamp": {
|
||||
"us": 1545092070952472
|
||||
},
|
||||
"version": "v2"
|
||||
},
|
||||
"location": {
|
||||
"pathname": "/opbeans-go/transactions/request/GET~20~2Fapi~2Fproducts~2F~3Aid~2Fcustomers",
|
||||
"search": "?_g=()&flyoutDetailTab=undefined&waterfallItemId=8b60bd32ecc6e150",
|
||||
"hash": ""
|
||||
}
|
||||
}
|
|
@ -0,0 +1,130 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { Location } from 'history';
|
||||
import { Transaction } from 'x-pack/plugins/apm/typings/es_schemas/Transaction';
|
||||
|
||||
const transaction: Transaction = {
|
||||
agent: {
|
||||
name: '227453131a17',
|
||||
version: '7.0.0'
|
||||
},
|
||||
processor: {
|
||||
name: 'transaction',
|
||||
event: 'transaction'
|
||||
},
|
||||
trace: {
|
||||
id: '8b60bd32ecc6e1506735a8b6cfcf175c'
|
||||
},
|
||||
'@timestamp': '2018-12-18T00:14:30.952Z',
|
||||
host: {
|
||||
hostname: '227453131a17'
|
||||
},
|
||||
service: {
|
||||
framework: {
|
||||
name: 'gin',
|
||||
version: 'v1.4.0-dev'
|
||||
},
|
||||
name: 'opbeans-go',
|
||||
runtime: {
|
||||
name: 'gc',
|
||||
version: 'go1.10.6'
|
||||
},
|
||||
language: {
|
||||
name: 'go',
|
||||
version: 'go1.10.6'
|
||||
}
|
||||
},
|
||||
process: {
|
||||
pid: 1,
|
||||
title: 'opbeans-go',
|
||||
args: [
|
||||
'/opbeans-go',
|
||||
'-listen=:3000',
|
||||
'-frontend=/opbeans-frontend',
|
||||
'-db=postgres:',
|
||||
'-cache=redis://redis:6379'
|
||||
],
|
||||
ppid: 0
|
||||
},
|
||||
context: {
|
||||
request: {
|
||||
headers: {
|
||||
Accept: '*/*',
|
||||
'User-Agent': 'Python/3.7 aiohttp/3.3.2',
|
||||
'Accept-Encoding': 'gzip, deflate'
|
||||
},
|
||||
method: 'GET',
|
||||
http_version: '1.1',
|
||||
socket: {
|
||||
remote_address: '172.18.0.12'
|
||||
},
|
||||
url: {
|
||||
protocol: 'http',
|
||||
hostname: '172.18.0.7',
|
||||
port: '3000',
|
||||
full: 'http://172.18.0.7:3000/api/products/3/customers',
|
||||
pathname: '/api/products/3/customers'
|
||||
}
|
||||
},
|
||||
|
||||
system: {
|
||||
hostname: '8acb9c1a71f3',
|
||||
ip: '172.18.0.7',
|
||||
platform: 'linux',
|
||||
architecture: 'amd64'
|
||||
},
|
||||
response: {
|
||||
headers: {
|
||||
'X-Frame-Options': 'SAMEORIGIN',
|
||||
Server: 'gunicorn/19.9.0',
|
||||
Vary: 'Cookie',
|
||||
'Content-Length': '31646',
|
||||
Date: 'Tue, 18 Dec 2018 00:14:45 GMT',
|
||||
'Content-Type': 'application/json; charset=utf-8'
|
||||
},
|
||||
status_code: 200
|
||||
}
|
||||
},
|
||||
transaction: {
|
||||
result: 'HTTP 2xx',
|
||||
duration: {
|
||||
us: 14586403
|
||||
},
|
||||
name: 'GET /api/products/:id/customers',
|
||||
span_count: {
|
||||
dropped: 0,
|
||||
started: 1
|
||||
},
|
||||
id: '8b60bd32ecc6e150',
|
||||
type: 'request',
|
||||
sampled: true
|
||||
},
|
||||
kubernetes: {
|
||||
pod: {
|
||||
uid: 'pod123456abcdef'
|
||||
}
|
||||
},
|
||||
container: {
|
||||
id: 'container123456abcdef'
|
||||
},
|
||||
timestamp: {
|
||||
us: 1545092070952472
|
||||
}
|
||||
};
|
||||
|
||||
const location: Location = {
|
||||
state: '',
|
||||
pathname:
|
||||
'/opbeans-go/transactions/request/GET~20~2Fapi~2Fproducts~2F~3Aid~2Fcustomers',
|
||||
search: '?_g=()&flyoutDetailTab=undefined&waterfallItemId=8b60bd32ecc6e150',
|
||||
hash: ''
|
||||
};
|
||||
|
||||
export const props = {
|
||||
transaction,
|
||||
location
|
||||
};
|
|
@ -14,17 +14,14 @@ interface TransactionLinkProps {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the path and query used to build a trace link,
|
||||
* given either a v2 Transaction or a Transaction Group
|
||||
* Return the path and query used to build a trace link
|
||||
*/
|
||||
export function getLinkProps(transaction: Transaction) {
|
||||
const serviceName = transaction.context.service.name;
|
||||
const serviceName = transaction.service.name;
|
||||
const transactionType = transaction.transaction.type;
|
||||
const traceId =
|
||||
transaction.version === 'v2' ? transaction.trace.id : undefined;
|
||||
const traceId = transaction.trace.id;
|
||||
const transactionId = transaction.transaction.id;
|
||||
const name = transaction.transaction.name;
|
||||
|
||||
const encodedName = legacyEncodeURIComponent(name);
|
||||
|
||||
return {
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { Span } from 'x-pack/plugins/apm/typings/es_schemas/Span';
|
||||
import { Transaction } from 'x-pack/plugins/apm/typings/es_schemas/Transaction';
|
||||
import { convertKueryToEsQuery, getAPMIndexPatternForKuery } from '../../kuery';
|
||||
|
||||
export async function getEncodedEsQuery(kuery?: string) {
|
||||
|
@ -21,13 +19,3 @@ export async function getEncodedEsQuery(kuery?: string) {
|
|||
const esFilterQuery = convertKueryToEsQuery(kuery, indexPattern);
|
||||
return encodeURIComponent(JSON.stringify(esFilterQuery));
|
||||
}
|
||||
|
||||
export function addVersion<T extends Span | Transaction | null | undefined>(
|
||||
item: T
|
||||
): T {
|
||||
if (item != null) {
|
||||
item.version = item.hasOwnProperty('trace') ? 'v2' : 'v1';
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
|
|
@ -8,22 +8,20 @@ import { TraceListAPIResponse } from 'x-pack/plugins/apm/server/lib/traces/get_t
|
|||
import { TraceAPIResponse } from 'x-pack/plugins/apm/server/lib/traces/get_trace';
|
||||
import { IUrlParams } from '../../../store/urlParams';
|
||||
import { callApi } from '../callApi';
|
||||
import { addVersion, getEncodedEsQuery } from './apm';
|
||||
import { getEncodedEsQuery } from './apm';
|
||||
|
||||
export async function loadTrace({ traceId, start, end }: IUrlParams) {
|
||||
const hits = await callApi<TraceAPIResponse>({
|
||||
return callApi<TraceAPIResponse>({
|
||||
pathname: `/api/apm/traces/${traceId}`,
|
||||
query: {
|
||||
start,
|
||||
end
|
||||
}
|
||||
});
|
||||
|
||||
return hits.map(addVersion);
|
||||
}
|
||||
|
||||
export async function loadTraceList({ start, end, kuery }: IUrlParams) {
|
||||
const groups = await callApi<TraceListAPIResponse>({
|
||||
return callApi<TraceListAPIResponse>({
|
||||
pathname: '/api/apm/traces',
|
||||
query: {
|
||||
start,
|
||||
|
@ -31,9 +29,4 @@ export async function loadTraceList({ start, end, kuery }: IUrlParams) {
|
|||
esFilterQuery: await getEncodedEsQuery(kuery)
|
||||
}
|
||||
});
|
||||
|
||||
return groups.map(group => {
|
||||
group.sample = addVersion(group.sample);
|
||||
return group;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import { ITransactionDistributionAPIResponse } from 'x-pack/plugins/apm/server/l
|
|||
import { TransactionListAPIResponse } from 'x-pack/plugins/apm/server/lib/transactions/get_top_transactions';
|
||||
import { IUrlParams } from '../../../store/urlParams';
|
||||
import { callApi } from '../callApi';
|
||||
import { addVersion, getEncodedEsQuery } from './apm';
|
||||
import { getEncodedEsQuery } from './apm';
|
||||
|
||||
export async function loadTransactionList({
|
||||
serviceName,
|
||||
|
@ -18,7 +18,7 @@ export async function loadTransactionList({
|
|||
kuery,
|
||||
transactionType = 'request'
|
||||
}: IUrlParams) {
|
||||
const groups = await callApi<TransactionListAPIResponse>({
|
||||
return await callApi<TransactionListAPIResponse>({
|
||||
pathname: `/api/apm/services/${serviceName}/transaction_groups/${transactionType}`,
|
||||
query: {
|
||||
start,
|
||||
|
@ -26,11 +26,6 @@ export async function loadTransactionList({
|
|||
esFilterQuery: await getEncodedEsQuery(kuery)
|
||||
}
|
||||
});
|
||||
|
||||
return groups.map(group => {
|
||||
group.sample = addVersion(group.sample);
|
||||
return group;
|
||||
});
|
||||
}
|
||||
|
||||
export async function loadTransactionDistribution({
|
||||
|
|
|
@ -6,35 +6,9 @@
|
|||
|
||||
import { KFetchError } from 'ui/kfetch/kfetch_error';
|
||||
import { TransactionAPIResponse } from 'x-pack/plugins/apm/server/lib/transactions/get_transaction';
|
||||
import { SpanListAPIResponse } from 'x-pack/plugins/apm/server/lib/transactions/spans/get_spans';
|
||||
import { Span } from 'x-pack/plugins/apm/typings/es_schemas/Span';
|
||||
import { IUrlParams } from '../../../store/urlParams';
|
||||
import { callApi } from '../callApi';
|
||||
import { addVersion, getEncodedEsQuery } from './apm';
|
||||
|
||||
export async function loadSpans({
|
||||
serviceName,
|
||||
start,
|
||||
end,
|
||||
transactionId
|
||||
}: IUrlParams) {
|
||||
const hits = await callApi<SpanListAPIResponse>({
|
||||
pathname: `/api/apm/services/${serviceName}/transactions/${transactionId}/spans`,
|
||||
query: {
|
||||
start,
|
||||
end
|
||||
}
|
||||
});
|
||||
|
||||
return hits.map(addVersion).map(addSpanId);
|
||||
}
|
||||
|
||||
function addSpanId(hit: Span, i: number) {
|
||||
if (!hit.span.id) {
|
||||
hit.span.id = i;
|
||||
}
|
||||
return hit;
|
||||
}
|
||||
import { getEncodedEsQuery } from './apm';
|
||||
|
||||
export async function loadTransaction({
|
||||
serviceName,
|
||||
|
@ -54,7 +28,7 @@ export async function loadTransaction({
|
|||
esFilterQuery: await getEncodedEsQuery(kuery)
|
||||
}
|
||||
});
|
||||
return addVersion(result);
|
||||
return result;
|
||||
} catch (e) {
|
||||
const err: KFetchError = e;
|
||||
|
||||
|
|
|
@ -4,13 +4,22 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { get } from 'lodash';
|
||||
import React from 'react';
|
||||
import { RRRRender } from 'react-redux-request';
|
||||
import { Request, RRRRender } from 'react-redux-request';
|
||||
import { TRACE_ID } from 'x-pack/plugins/apm/common/constants';
|
||||
import { TraceAPIResponse } from 'x-pack/plugins/apm/server/lib/traces/get_trace';
|
||||
import { Transaction } from 'x-pack/plugins/apm/typings/es_schemas/Transaction';
|
||||
import { IWaterfall } from '../../components/app/TransactionDetails/Transaction/WaterfallContainer/Waterfall/waterfall_helpers/waterfall_helpers';
|
||||
import {
|
||||
getWaterfall,
|
||||
IWaterfall
|
||||
} from '../../components/app/TransactionDetails/Transaction/WaterfallContainer/Waterfall/waterfall_helpers/waterfall_helpers';
|
||||
import { loadTrace } from '../../services/rest/apm/traces';
|
||||
import { IUrlParams } from '../urlParams';
|
||||
import { WaterfallV1Request } from './waterfallV1';
|
||||
import { WaterfallV2Request } from './waterfallV2';
|
||||
// @ts-ignore
|
||||
import { createInitialDataSelector } from './helpers';
|
||||
|
||||
export const ID = 'waterfall';
|
||||
|
||||
interface Props {
|
||||
urlParams: IUrlParams;
|
||||
|
@ -19,22 +28,22 @@ interface Props {
|
|||
}
|
||||
|
||||
export function WaterfallRequest({ urlParams, transaction, render }: Props) {
|
||||
const hasTrace = transaction.hasOwnProperty('trace');
|
||||
if (hasTrace) {
|
||||
return (
|
||||
<WaterfallV2Request
|
||||
urlParams={urlParams}
|
||||
transaction={transaction}
|
||||
render={render}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<WaterfallV1Request
|
||||
urlParams={urlParams}
|
||||
transaction={transaction}
|
||||
render={render}
|
||||
/>
|
||||
);
|
||||
const { start, end } = urlParams;
|
||||
const traceId: string = get(transaction, TRACE_ID);
|
||||
|
||||
if (!(traceId && start && end)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Request<TraceAPIResponse>
|
||||
id={ID}
|
||||
fn={loadTrace}
|
||||
args={[{ traceId, start, end }]}
|
||||
render={({ args, data = [], status }) => {
|
||||
const waterfall = getWaterfall(data, transaction);
|
||||
return render({ args, data: waterfall, status });
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { get } from 'lodash';
|
||||
import React from 'react';
|
||||
import { Request, RRRRender } from 'react-redux-request';
|
||||
import {
|
||||
SERVICE_NAME,
|
||||
TRANSACTION_ID
|
||||
} from 'x-pack/plugins/apm/common/constants';
|
||||
import { Span } from 'x-pack/plugins/apm/typings/es_schemas/Span';
|
||||
import { Transaction } from 'x-pack/plugins/apm/typings/es_schemas/Transaction';
|
||||
import {
|
||||
getWaterfall,
|
||||
IWaterfall
|
||||
} from '../../components/app/TransactionDetails/Transaction/WaterfallContainer/Waterfall/waterfall_helpers/waterfall_helpers';
|
||||
import { loadSpans } from '../../services/rest/apm/transactions';
|
||||
import { IUrlParams } from '../urlParams';
|
||||
// @ts-ignore
|
||||
import { createInitialDataSelector } from './helpers';
|
||||
|
||||
export const ID = 'waterfallV1';
|
||||
|
||||
interface Props {
|
||||
urlParams: IUrlParams;
|
||||
transaction: Transaction;
|
||||
render: RRRRender<IWaterfall>;
|
||||
}
|
||||
|
||||
export function WaterfallV1Request({ urlParams, transaction, render }: Props) {
|
||||
const { start, end } = urlParams;
|
||||
const transactionId: string = get(transaction, TRANSACTION_ID);
|
||||
const serviceName: string = get(transaction, SERVICE_NAME);
|
||||
|
||||
if (!(serviceName && transactionId && start && end)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Request<Span[]>
|
||||
id={ID}
|
||||
fn={loadSpans}
|
||||
args={[{ serviceName, start, end, transactionId }]}
|
||||
render={({ status, data = [], args }) => {
|
||||
const waterfall = getWaterfall([transaction, ...data], transaction);
|
||||
return render({ status, data: waterfall, args });
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { get } from 'lodash';
|
||||
import React from 'react';
|
||||
import { Request, RRRRender } from 'react-redux-request';
|
||||
import { TRACE_ID } from 'x-pack/plugins/apm/common/constants';
|
||||
import { TraceAPIResponse } from 'x-pack/plugins/apm/server/lib/traces/get_trace';
|
||||
import { Transaction } from 'x-pack/plugins/apm/typings/es_schemas/Transaction';
|
||||
import {
|
||||
getWaterfall,
|
||||
IWaterfall
|
||||
} from '../../components/app/TransactionDetails/Transaction/WaterfallContainer/Waterfall/waterfall_helpers/waterfall_helpers';
|
||||
import { loadTrace } from '../../services/rest/apm/traces';
|
||||
import { IUrlParams } from '../urlParams';
|
||||
// @ts-ignore
|
||||
import { createInitialDataSelector } from './helpers';
|
||||
|
||||
export const ID = 'waterfallV2';
|
||||
|
||||
interface Props {
|
||||
urlParams: IUrlParams;
|
||||
transaction: Transaction;
|
||||
render: RRRRender<IWaterfall>;
|
||||
}
|
||||
|
||||
export function WaterfallV2Request({ urlParams, transaction, render }: Props) {
|
||||
const { start, end } = urlParams;
|
||||
const traceId: string = get(transaction, TRACE_ID);
|
||||
|
||||
if (!(traceId && start && end)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Request<TraceAPIResponse>
|
||||
id={ID}
|
||||
fn={loadTrace}
|
||||
args={[{ traceId, start, end }]}
|
||||
render={({ args, data = [], status }) => {
|
||||
const waterfall = getWaterfall(data, transaction);
|
||||
return render({ args, data: waterfall, status });
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
|
@ -29,7 +29,7 @@ Array [
|
|||
},
|
||||
Object {
|
||||
"term": Object {
|
||||
"context.service.name": "myServiceName",
|
||||
"service.name": "myServiceName",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
|
||||
import { ESFilter } from 'elasticsearch';
|
||||
import { get } from 'lodash';
|
||||
import { oc } from 'ts-optchain';
|
||||
import { APMError } from 'x-pack/plugins/apm/typings/es_schemas/Error';
|
||||
import { Transaction } from 'x-pack/plugins/apm/typings/es_schemas/Transaction';
|
||||
|
@ -72,7 +71,7 @@ export async function getErrorGroup({
|
|||
const resp = await client<APMError>('search', params);
|
||||
const error = oc(resp).hits.hits[0]._source();
|
||||
const transactionId = oc(error).transaction.id();
|
||||
const traceId: string | undefined = get(error, 'trace.id'); // cannot use oc because 'trace' doesn't exist on v1 errors
|
||||
const traceId = oc(error).trace.id();
|
||||
|
||||
let transaction;
|
||||
if (transactionId) {
|
||||
|
|
|
@ -66,7 +66,7 @@ Array [
|
|||
"filter": Array [
|
||||
Object {
|
||||
"term": Object {
|
||||
"context.service.name": "test-service",
|
||||
"service.name": "test-service",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
|
|
|
@ -58,7 +58,7 @@ Array [
|
|||
"filter": Array [
|
||||
Object {
|
||||
"term": Object {
|
||||
"context.service.name": "test-service",
|
||||
"service.name": "test-service",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { OBSERVER_LISTENING } from '../../../common/constants';
|
||||
|
||||
// Note: this logic is duplicated in tutorials/apm/envs/on_prem
|
||||
export async function getServerStatus({ setup }) {
|
||||
const { client, config } = setup;
|
||||
|
@ -16,7 +18,7 @@ export async function getServerStatus({ setup }) {
|
|||
bool: {
|
||||
filter: {
|
||||
exists: {
|
||||
field: 'listening'
|
||||
field: OBSERVER_LISTENING
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ Array [
|
|||
},
|
||||
Object {
|
||||
"term": Object {
|
||||
"context.service.name": "myServiceName",
|
||||
"service.name": "myServiceName",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { Span } from 'x-pack/plugins/apm/typings/es_schemas/Span';
|
||||
import {
|
||||
PROCESSOR_EVENT,
|
||||
SPAN_START,
|
||||
TRANSACTION_ID
|
||||
} from '../../../../common/constants';
|
||||
import { Setup } from '../../helpers/setup_request';
|
||||
|
||||
export type SpanListAPIResponse = Span[];
|
||||
|
||||
// Deprecated and will be removed in 7.0. Only needed for backwards compatability pre 6.5 (introducition of v2 API and distributed tracing)
|
||||
export async function getSpans(
|
||||
transactionId: string,
|
||||
setup: Setup
|
||||
): Promise<SpanListAPIResponse> {
|
||||
const { start, end, client, config } = setup;
|
||||
|
||||
const params = {
|
||||
index: config.get<string>('apm_oss.spanIndices'),
|
||||
body: {
|
||||
size: 500,
|
||||
query: {
|
||||
bool: {
|
||||
filter: [
|
||||
{ term: { [TRANSACTION_ID]: transactionId } },
|
||||
{ term: { [PROCESSOR_EVENT]: 'span' } },
|
||||
{
|
||||
range: {
|
||||
'@timestamp': {
|
||||
gte: start,
|
||||
lte: end,
|
||||
format: 'epoch_millis'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
sort: [{ [SPAN_START]: { order: 'asc' } }]
|
||||
}
|
||||
};
|
||||
|
||||
const resp = await client<Span>('search', params);
|
||||
return resp.hits.hits.map(hit => hit._source);
|
||||
}
|
|
@ -10,7 +10,6 @@ import Joi from 'joi';
|
|||
import { withDefaultValidators } from '../lib/helpers/input_validation';
|
||||
import { setupRequest } from '../lib/helpers/setup_request';
|
||||
import { getTransaction } from '../lib/transactions/get_transaction';
|
||||
import { getSpans } from '../lib/transactions/spans/get_spans';
|
||||
|
||||
export function initTransactionsApi(server: Server) {
|
||||
server.route({
|
||||
|
@ -35,20 +34,4 @@ export function initTransactionsApi(server: Server) {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: this can be removed by 7.0 when v1 compatability can be dropped
|
||||
server.route({
|
||||
method: 'GET',
|
||||
path: `/api/apm/services/{serviceName}/transactions/{transactionId}/spans`,
|
||||
options: {
|
||||
validate: {
|
||||
query: withDefaultValidators()
|
||||
}
|
||||
},
|
||||
handler: req => {
|
||||
const { transactionId } = req.params;
|
||||
const setup = setupRequest(req);
|
||||
return getSpans(transactionId, setup);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -4,27 +4,17 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export interface APMDocV1 {
|
||||
// all documents types extend APMDoc and inherit all properties
|
||||
export interface APMDoc {
|
||||
'@timestamp': string;
|
||||
beat: {
|
||||
hostname: string;
|
||||
agent: {
|
||||
name: string;
|
||||
version: string;
|
||||
};
|
||||
host: {
|
||||
name: string;
|
||||
};
|
||||
agent?: object;
|
||||
}
|
||||
|
||||
export interface APMDocV2 extends APMDocV1 {
|
||||
timestamp: {
|
||||
us: number;
|
||||
};
|
||||
parent?: {
|
||||
id: string; // parent ID is not available on the root transaction
|
||||
};
|
||||
trace: {
|
||||
id: string;
|
||||
timestamp: { us: number };
|
||||
parent?: { id: string }; // parent ID is not available on root transactions
|
||||
trace: { id: string };
|
||||
labels?: {
|
||||
[key: string]: string | number | boolean;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export interface ContextService {
|
||||
name: string;
|
||||
agent: {
|
||||
name: string;
|
||||
version: string;
|
||||
};
|
||||
framework?: {
|
||||
name: string;
|
||||
version: string;
|
||||
};
|
||||
runtime?: {
|
||||
name: string;
|
||||
version: string;
|
||||
};
|
||||
language?: {
|
||||
name: string;
|
||||
version?: string;
|
||||
};
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface ContextSystem {
|
||||
architecture?: string;
|
||||
hostname?: string;
|
||||
ip?: string;
|
||||
platform?: string;
|
||||
}
|
||||
|
||||
export interface ContextRequest {
|
||||
url: {
|
||||
full: string;
|
||||
[key: string]: string;
|
||||
};
|
||||
method: string;
|
||||
headers?: {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface ContextProcess {
|
||||
pid: number;
|
||||
title: string;
|
||||
argv: string[];
|
||||
[key: string]: unknown;
|
||||
}
|
|
@ -4,37 +4,23 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { APMDocV1, APMDocV2 } from './APMDoc';
|
||||
import {
|
||||
ContextProcess,
|
||||
ContextRequest,
|
||||
ContextService,
|
||||
ContextSystem
|
||||
} from './Context';
|
||||
import { IStackframe } from './Stackframe';
|
||||
|
||||
interface Agent {
|
||||
hostname: string;
|
||||
type: string;
|
||||
version: string;
|
||||
}
|
||||
import { APMDoc } from './APMDoc';
|
||||
import { Container } from './fields/Container';
|
||||
import { Context } from './fields/Context';
|
||||
import { Host } from './fields/Host';
|
||||
import { Http } from './fields/Http';
|
||||
import { Kubernetes } from './fields/Kubernetes';
|
||||
import { Process } from './fields/Process';
|
||||
import { Service } from './fields/Service';
|
||||
import { IStackframe } from './fields/Stackframe';
|
||||
import { Url } from './fields/Url';
|
||||
import { User } from './fields/User';
|
||||
|
||||
interface Processor {
|
||||
name: 'error';
|
||||
event: 'error';
|
||||
}
|
||||
|
||||
interface Context {
|
||||
process?: ContextProcess;
|
||||
service: ContextService;
|
||||
system?: ContextSystem;
|
||||
request?: ContextRequest;
|
||||
page?: {
|
||||
url: string;
|
||||
};
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
interface Exception {
|
||||
message?: string; // either message or type are given
|
||||
type?: string;
|
||||
|
@ -53,43 +39,31 @@ interface Log {
|
|||
stacktrace?: IStackframe[];
|
||||
}
|
||||
|
||||
interface ErrorV1 extends APMDocV1 {
|
||||
version: 'v1';
|
||||
agent: Agent;
|
||||
processor: Processor;
|
||||
context: Context;
|
||||
transaction?: {
|
||||
id: string; // transaction ID is not required in v1
|
||||
};
|
||||
error: {
|
||||
id?: string; // ID is not required in v1
|
||||
timestamp: string;
|
||||
culprit: string;
|
||||
grouping_key: string;
|
||||
// either exception or log are given
|
||||
exception?: Exception;
|
||||
log?: Log;
|
||||
};
|
||||
}
|
||||
|
||||
interface ErrorV2 extends APMDocV2 {
|
||||
version: 'v2';
|
||||
agent: Agent;
|
||||
processor: Processor;
|
||||
context: Context;
|
||||
transaction: {
|
||||
id: string; // transaction ID is required in v2
|
||||
sampled?: boolean;
|
||||
};
|
||||
error: {
|
||||
id: string; // ID is required in v2
|
||||
culprit: string;
|
||||
grouping_key: string;
|
||||
// either exception or log are given
|
||||
exception?: Exception;
|
||||
log?: Log;
|
||||
};
|
||||
}
|
||||
|
||||
// Not calling it "Error" to avoid clashes with types for native Error
|
||||
export type APMError = ErrorV1 | ErrorV2;
|
||||
export interface APMError extends APMDoc {
|
||||
processor: Processor;
|
||||
transaction: {
|
||||
id: string;
|
||||
sampled?: boolean;
|
||||
type?: string;
|
||||
};
|
||||
error: {
|
||||
id: string;
|
||||
culprit: string;
|
||||
grouping_key: string;
|
||||
// either exception or log are given
|
||||
exception?: Exception;
|
||||
log?: Log;
|
||||
};
|
||||
|
||||
// Shared by errors and transactions
|
||||
container?: Container;
|
||||
context?: Context;
|
||||
host?: Host;
|
||||
http?: Http;
|
||||
kubernetes?: Kubernetes;
|
||||
process?: Process;
|
||||
service: Service;
|
||||
url?: Url;
|
||||
user?: User;
|
||||
}
|
||||
|
|
|
@ -4,77 +4,41 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { APMDocV1, APMDocV2 } from './APMDoc';
|
||||
import { ContextService } from './Context';
|
||||
import { IStackframe } from './Stackframe';
|
||||
|
||||
export interface DbContext {
|
||||
instance?: string;
|
||||
statement?: string;
|
||||
type?: string;
|
||||
user?: string;
|
||||
}
|
||||
import { APMDoc } from './APMDoc';
|
||||
import { IStackframe } from './fields/Stackframe';
|
||||
|
||||
interface Processor {
|
||||
name: 'transaction';
|
||||
event: 'span';
|
||||
}
|
||||
|
||||
interface HttpContext {
|
||||
url?: string;
|
||||
interface SpanContext {
|
||||
db?: {
|
||||
instance?: string;
|
||||
statement?: string;
|
||||
type?: string;
|
||||
user?: string;
|
||||
};
|
||||
http?: {
|
||||
method?: string;
|
||||
status_code?: number;
|
||||
url?: string;
|
||||
};
|
||||
}
|
||||
|
||||
interface TagsContext {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
interface Context {
|
||||
db?: DbContext;
|
||||
http?: HttpContext;
|
||||
tags?: TagsContext;
|
||||
service: ContextService;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface SpanV1 extends APMDocV1 {
|
||||
version: 'v1';
|
||||
export interface Span extends APMDoc {
|
||||
processor: Processor;
|
||||
context: Context;
|
||||
context?: SpanContext;
|
||||
service: { name: string };
|
||||
span: {
|
||||
duration: {
|
||||
us: number;
|
||||
};
|
||||
start: {
|
||||
us: number; // only v1
|
||||
};
|
||||
name: string;
|
||||
type: string;
|
||||
id: number; // we are manually adding span.id
|
||||
parent?: string; // only v1
|
||||
stacktrace?: IStackframe[];
|
||||
};
|
||||
transaction: {
|
||||
action: string;
|
||||
duration: { us: number };
|
||||
id: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface SpanV2 extends APMDocV2 {
|
||||
version: 'v2';
|
||||
processor: Processor;
|
||||
context: Context;
|
||||
span: {
|
||||
duration: {
|
||||
us: number;
|
||||
};
|
||||
name: string;
|
||||
type: string;
|
||||
id: number; // id will be derived from hex encoded 64 bit hex_id string in v2
|
||||
hex_id: string; // only v2
|
||||
stacktrace?: IStackframe[];
|
||||
subtype: string;
|
||||
sync: boolean;
|
||||
type: string;
|
||||
};
|
||||
transaction: {
|
||||
id: string;
|
||||
};
|
||||
transaction: { id: string };
|
||||
}
|
||||
|
||||
export type Span = SpanV1 | SpanV2;
|
||||
|
|
|
@ -4,98 +4,51 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { APMDocV1, APMDocV2 } from './APMDoc';
|
||||
import {
|
||||
ContextProcess,
|
||||
ContextRequest,
|
||||
ContextService,
|
||||
ContextSystem
|
||||
} from './Context';
|
||||
import { APMDoc } from './APMDoc';
|
||||
import { Container } from './fields/Container';
|
||||
import { Context } from './fields/Context';
|
||||
import { Host } from './fields/Host';
|
||||
import { Http } from './fields/Http';
|
||||
import { Kubernetes } from './fields/Kubernetes';
|
||||
import { Process } from './fields/Process';
|
||||
import { Service } from './fields/Service';
|
||||
import { Url } from './fields/Url';
|
||||
import { User } from './fields/User';
|
||||
|
||||
interface Processor {
|
||||
name: 'transaction';
|
||||
event: 'transaction';
|
||||
}
|
||||
|
||||
interface Context {
|
||||
process?: ContextProcess;
|
||||
service: ContextService;
|
||||
system?: ContextSystem;
|
||||
request: ContextRequest;
|
||||
user?: {
|
||||
id: string;
|
||||
username?: string;
|
||||
email?: string;
|
||||
};
|
||||
page?: {
|
||||
url: string;
|
||||
};
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
interface Marks {
|
||||
agent?: {
|
||||
[name: string]: number;
|
||||
};
|
||||
}
|
||||
|
||||
export interface TransactionV1 extends APMDocV1 {
|
||||
version: 'v1';
|
||||
export interface Transaction extends APMDoc {
|
||||
processor: Processor;
|
||||
context: Context;
|
||||
transaction: {
|
||||
duration: {
|
||||
us: number;
|
||||
};
|
||||
duration: { us: number };
|
||||
id: string;
|
||||
marks?: Marks;
|
||||
marks?: {
|
||||
// "agent": not defined by APM Server - only sent by RUM agent
|
||||
agent?: {
|
||||
[name: string]: number;
|
||||
};
|
||||
};
|
||||
name: string; // name could be missing in ES but the UI will always only aggregate on transactions with a name
|
||||
result?: string;
|
||||
sampled: boolean;
|
||||
span_count?: {
|
||||
dropped?: {
|
||||
total?: number;
|
||||
};
|
||||
started?: number;
|
||||
dropped?: number;
|
||||
};
|
||||
type: string;
|
||||
};
|
||||
|
||||
// Shared by errors and transactions
|
||||
container?: Container;
|
||||
context?: Context;
|
||||
host?: Host;
|
||||
http?: Http;
|
||||
kubernetes?: Kubernetes;
|
||||
process?: Process;
|
||||
service: Service;
|
||||
url?: Url;
|
||||
user?: User;
|
||||
}
|
||||
|
||||
export interface TransactionV2 extends APMDocV2 {
|
||||
version: 'v2';
|
||||
processor: Processor;
|
||||
context: Context;
|
||||
transaction: {
|
||||
duration: {
|
||||
us: number;
|
||||
};
|
||||
id: string;
|
||||
marks?: Marks;
|
||||
name: string; // name could be missing in ES but the UI will always only aggregate on transactions with a name
|
||||
result?: string;
|
||||
sampled: boolean;
|
||||
|
||||
span_count?: {
|
||||
started?: number; // only v2
|
||||
dropped?: {
|
||||
total?: number;
|
||||
};
|
||||
};
|
||||
type: string;
|
||||
};
|
||||
kubernetes?: {
|
||||
pod: {
|
||||
uid: string;
|
||||
};
|
||||
};
|
||||
docker?: {
|
||||
container: {
|
||||
id: string;
|
||||
};
|
||||
};
|
||||
container: {
|
||||
id: string;
|
||||
};
|
||||
}
|
||||
|
||||
export type Transaction = TransactionV1 | TransactionV2;
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export interface Container {
|
||||
id: string;
|
||||
}
|
10
x-pack/plugins/apm/typings/es_schemas/fields/Context.ts
Normal file
10
x-pack/plugins/apm/typings/es_schemas/fields/Context.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export interface Context {
|
||||
page?: { url: string }; // only for RUM agent
|
||||
[key: string]: unknown;
|
||||
}
|
12
x-pack/plugins/apm/typings/es_schemas/fields/Host.ts
Normal file
12
x-pack/plugins/apm/typings/es_schemas/fields/Host.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export interface Host {
|
||||
architecture?: string;
|
||||
hostname?: string;
|
||||
ip?: string;
|
||||
os?: { platform?: string };
|
||||
}
|
10
x-pack/plugins/apm/typings/es_schemas/fields/Http.ts
Normal file
10
x-pack/plugins/apm/typings/es_schemas/fields/Http.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export interface Http {
|
||||
request: { method: string };
|
||||
response: { status_code: number };
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export interface Kubernetes {
|
||||
pod: { uid: string };
|
||||
}
|
12
x-pack/plugins/apm/typings/es_schemas/fields/Process.ts
Normal file
12
x-pack/plugins/apm/typings/es_schemas/fields/Process.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export interface Process {
|
||||
args: string[];
|
||||
pid: number;
|
||||
ppid: number;
|
||||
title: string;
|
||||
}
|
21
x-pack/plugins/apm/typings/es_schemas/fields/Service.ts
Normal file
21
x-pack/plugins/apm/typings/es_schemas/fields/Service.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export interface Service {
|
||||
name: string;
|
||||
framework?: {
|
||||
name: string;
|
||||
version: string;
|
||||
};
|
||||
runtime?: {
|
||||
name: string;
|
||||
version: string;
|
||||
};
|
||||
language?: {
|
||||
name: string;
|
||||
version?: string;
|
||||
};
|
||||
}
|
9
x-pack/plugins/apm/typings/es_schemas/fields/Url.ts
Normal file
9
x-pack/plugins/apm/typings/es_schemas/fields/Url.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export interface Url {
|
||||
full: string;
|
||||
}
|
11
x-pack/plugins/apm/typings/es_schemas/fields/User.ts
Normal file
11
x-pack/plugins/apm/typings/es_schemas/fields/User.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export interface User {
|
||||
id: string;
|
||||
username?: string;
|
||||
email?: string;
|
||||
}
|
|
@ -11137,11 +11137,6 @@ icss-utils@^2.1.0:
|
|||
dependencies:
|
||||
postcss "^6.0.1"
|
||||
|
||||
idx@^2.5.2:
|
||||
version "2.5.2"
|
||||
resolved "https://registry.yarnpkg.com/idx/-/idx-2.5.2.tgz#4b405c2e6d68d04136e0a368a7ab35b9caa0595f"
|
||||
integrity sha512-MLoGF4lQU5q/RqJJjRsuid52emu7tPVtSSZaYXsqRvSjvXdBEmIwk2urvbNvPBRU9Ox9I4WYnxiz2GjhU34Lrw==
|
||||
|
||||
ieee754@^1.1.4:
|
||||
version "1.1.8"
|
||||
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.8.tgz#be33d40ac10ef1926701f6f08a2d86fbfd1ad3e4"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue