File tree Expand file tree Collapse file tree 8 files changed +128
-9
lines changed
server/lib/helpers/create_es_client/create_apm_event_client Expand file tree Collapse file tree 8 files changed +128
-9
lines changed Original file line number Diff line number Diff line change 55 */
66
77import { ValuesType } from 'utility-types' ;
8- import { APMBaseDoc } from '../../../../../typings/es_schemas/raw/apm_base_doc' ;
98import { APMError } from '../../../../../typings/es_schemas/ui/apm_error' ;
109import {
1110 KibanaRequest ,
@@ -21,6 +20,7 @@ import { addFilterToExcludeLegacyData } from './add_filter_to_exclude_legacy_dat
2120import { callClientWithDebug } from '../call_client_with_debug' ;
2221import { Transaction } from '../../../../../typings/es_schemas/ui/transaction' ;
2322import { Span } from '../../../../../typings/es_schemas/ui/span' ;
23+ import { Metric } from '../../../../../typings/es_schemas/ui/metric' ;
2424import { unpackProcessorEvents } from './unpack_processor_events' ;
2525
2626export type APMEventESSearchRequest = Omit < ESSearchRequest , 'index' > & {
@@ -33,7 +33,7 @@ type TypeOfProcessorEvent<T extends ProcessorEvent> = {
3333 [ ProcessorEvent . error ] : APMError ;
3434 [ ProcessorEvent . transaction ] : Transaction ;
3535 [ ProcessorEvent . span ] : Span ;
36- [ ProcessorEvent . metric ] : APMBaseDoc ;
36+ [ ProcessorEvent . metric ] : Metric ;
3737 [ ProcessorEvent . onboarding ] : unknown ;
3838 [ ProcessorEvent . sourcemap ] : unknown ;
3939} [ T ] ;
Original file line number Diff line number Diff line change 44 * you may not use this file except in compliance with the Elastic License.
55 */
66
7+ import { Observer } from './fields/observer' ;
8+
79// all documents types extend APMBaseDoc and inherit all properties
810export interface APMBaseDoc {
911 '@timestamp' : string ;
1012 agent : {
1113 name : string ;
1214 version : string ;
1315 } ;
14- timestamp : { us : number } ;
1516 parent ?: { id : string } ; // parent ID is not available on root transactions
1617 trace ?: { id : string } ;
1718 labels ?: {
1819 [ key : string ] : string | number | boolean ;
1920 } ;
2021 [ key : string ] : unknown ;
22+ observer ?: Observer ;
2123}
Original file line number Diff line number Diff line change @@ -13,9 +13,9 @@ import { Page } from './fields/page';
1313import { Process } from './fields/process' ;
1414import { Service } from './fields/service' ;
1515import { Stackframe } from './fields/stackframe' ;
16+ import { TimestampUs } from './fields/timestamp_us' ;
1617import { Url } from './fields/url' ;
1718import { User } from './fields/user' ;
18- import { Observer } from './fields/observer' ;
1919
2020interface Processor {
2121 name : 'error' ;
@@ -43,6 +43,7 @@ interface Log {
4343
4444export interface ErrorRaw extends APMBaseDoc {
4545 processor : Processor ;
46+ timestamp : TimestampUs ;
4647 transaction ?: {
4748 id : string ;
4849 sampled ?: boolean ;
@@ -69,5 +70,4 @@ export interface ErrorRaw extends APMBaseDoc {
6970 service : Service ;
7071 url ?: Url ;
7172 user ?: User ;
72- observer ?: Observer ;
7373}
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+ * or more contributor license agreements. Licensed under the Elastic License;
4+ * you may not use this file except in compliance with the Elastic License.
5+ */
6+
7+ export interface TimestampUs {
8+ us : number ;
9+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+ * or more contributor license agreements. Licensed under the Elastic License;
4+ * you may not use this file except in compliance with the Elastic License.
5+ */
6+
7+ import { APMBaseDoc } from './apm_base_doc' ;
8+ import { Container } from './fields/container' ;
9+ import { Kubernetes } from './fields/kubernetes' ;
10+
11+ type BaseMetric = APMBaseDoc & {
12+ processor : {
13+ name : 'metric' ;
14+ event : 'metric' ;
15+ } ;
16+ } ;
17+
18+ type BaseBreakdownMetric = BaseMetric & {
19+ transaction : {
20+ name : string ;
21+ type : string ;
22+ } ;
23+ span : {
24+ self_time : {
25+ count : number ;
26+ sum : {
27+ us : number ;
28+ } ;
29+ } ;
30+ } ;
31+ } ;
32+
33+ type TransactionBreakdownMetric = BaseBreakdownMetric & {
34+ transaction : {
35+ duration : {
36+ count : number ;
37+ sum : {
38+ us : number ;
39+ } ;
40+ } ;
41+ breakdown : {
42+ count : number ;
43+ } ;
44+ } ;
45+ } ;
46+
47+ type SpanBreakdownMetric = BaseBreakdownMetric & {
48+ span : {
49+ type : string ;
50+ subtype ?: string ;
51+ } ;
52+ } ;
53+
54+ type SystemMetric = BaseMetric & {
55+ system : unknown ;
56+ service : {
57+ node ?: {
58+ name : string ;
59+ } ;
60+ } ;
61+ } ;
62+
63+ type CGroupMetric = SystemMetric ;
64+ type JVMMetric = SystemMetric & {
65+ jvm : unknown ;
66+ } ;
67+
68+ type TransactionDurationMetric = BaseMetric & {
69+ transaction : {
70+ name : string ;
71+ type : string ;
72+ result ?: string ;
73+ duration : {
74+ histogram : {
75+ values : number [ ] ;
76+ counts : number [ ] ;
77+ } ;
78+ } ;
79+ } ;
80+ service : {
81+ name : string ;
82+ node ?: {
83+ name : string ;
84+ } ;
85+ environment ?: string ;
86+ version ?: string ;
87+ } ;
88+ container ?: Container ;
89+ kubernetes ?: Kubernetes ;
90+ } ;
91+
92+ export type MetricRaw =
93+ | BaseMetric
94+ | TransactionBreakdownMetric
95+ | SpanBreakdownMetric
96+ | TransactionDurationMetric
97+ | SystemMetric
98+ | CGroupMetric
99+ | JVMMetric ;
Original file line number Diff line number Diff line change 66
77import { APMBaseDoc } from './apm_base_doc' ;
88import { Stackframe } from './fields/stackframe' ;
9- import { Observer } from './fields/observer ' ;
9+ import { TimestampUs } from './fields/timestamp_us ' ;
1010
1111interface Processor {
1212 name : 'transaction' ;
@@ -50,9 +50,9 @@ export interface SpanRaw extends APMBaseDoc {
5050 headers ?: Record < string , unknown > ;
5151 } ;
5252 } ;
53+ timestamp : TimestampUs ;
5354 transaction ?: {
5455 id : string ;
5556 } ;
56- observer ?: Observer ;
5757 child ?: { id : string [ ] } ;
5858}
Original file line number Diff line number Diff line change @@ -12,10 +12,10 @@ import { Kubernetes } from './fields/kubernetes';
1212import { Page } from './fields/page' ;
1313import { Process } from './fields/process' ;
1414import { Service } from './fields/service' ;
15+ import { TimestampUs } from './fields/timestamp_us' ;
1516import { Url } from './fields/url' ;
1617import { User } from './fields/user' ;
1718import { UserAgent } from './fields/user_agent' ;
18- import { Observer } from './fields/observer' ;
1919
2020interface Processor {
2121 name : 'transaction' ;
@@ -24,6 +24,7 @@ interface Processor {
2424
2525export interface TransactionRaw extends APMBaseDoc {
2626 processor : Processor ;
27+ timestamp : TimestampUs ;
2728 trace : { id : string } ; // trace is required
2829 transaction : {
2930 duration : { us : number } ;
@@ -65,5 +66,4 @@ export interface TransactionRaw extends APMBaseDoc {
6566 url ?: Url ;
6667 user ?: User ;
6768 user_agent ?: UserAgent ;
68- observer ?: Observer ;
6969}
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+ * or more contributor license agreements. Licensed under the Elastic License;
4+ * you may not use this file except in compliance with the Elastic License.
5+ */
6+
7+ import { MetricRaw } from '../raw/metric_raw' ;
8+
9+ export type Metric = MetricRaw ;
You can’t perform that action at this time.
0 commit comments