diff --git a/x-pack/plugins/apm/common/annotations.ts b/x-pack/plugins/apm/common/annotations.ts index 33122f55d8800..264236e22b0c1 100644 --- a/x-pack/plugins/apm/common/annotations.ts +++ b/x-pack/plugins/apm/common/annotations.ts @@ -11,6 +11,6 @@ export enum AnnotationType { export interface Annotation { type: AnnotationType; id: string; - time: number; + '@timestamp': number; text: string; } diff --git a/x-pack/plugins/apm/public/components/shared/charts/CustomPlot/AnnotationsPlot.tsx b/x-pack/plugins/apm/public/components/shared/charts/CustomPlot/AnnotationsPlot.tsx index 6eff4759b2e7c..0233282bad1b5 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/CustomPlot/AnnotationsPlot.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/CustomPlot/AnnotationsPlot.tsx @@ -34,7 +34,7 @@ const style = { export function AnnotationsPlot(props: Props) { const { plotValues, annotations } = props; - const tickValues = annotations.map(annotation => annotation.time); + const tickValues = annotations.map(annotation => annotation['@timestamp']); return ( <> @@ -46,12 +46,12 @@ export function AnnotationsPlot(props: Props) { key={annotation.id} style={{ position: 'absolute', - left: plotValues.x(annotation.time) - 8, + left: plotValues.x(annotation['@timestamp']) - 8, top: -2 }} > diff --git a/x-pack/plugins/apm/server/lib/services/annotations/get_derived_service_annotations.ts b/x-pack/plugins/apm/server/lib/services/annotations/get_derived_service_annotations.ts index a4cfcf53a6f0b..e1f24bc1443f0 100644 --- a/x-pack/plugins/apm/server/lib/services/annotations/get_derived_service_annotations.ts +++ b/x-pack/plugins/apm/server/lib/services/annotations/get_derived_service_annotations.ts @@ -102,7 +102,7 @@ export async function getDerivedServiceAnnotations({ return { type: AnnotationType.VERSION, id: version, - time: firstSeen, + '@timestamp': firstSeen, text: version }; }) diff --git a/x-pack/plugins/apm/server/lib/services/annotations/get_stored_annotations.ts b/x-pack/plugins/apm/server/lib/services/annotations/get_stored_annotations.ts index 6a4dd73b03f16..1d378302d7bfe 100644 --- a/x-pack/plugins/apm/server/lib/services/annotations/get_stored_annotations.ts +++ b/x-pack/plugins/apm/server/lib/services/annotations/get_stored_annotations.ts @@ -61,7 +61,7 @@ export async function getStoredAnnotations({ return { type: AnnotationType.VERSION, id: hit._id, - time: new Date(hit._source['@timestamp']).getTime(), + '@timestamp': hit._source['@timestamp'], text: hit._source.message }; }); diff --git a/x-pack/plugins/apm/server/lib/services/annotations/index.test.ts b/x-pack/plugins/apm/server/lib/services/annotations/index.test.ts index 429d018a767cb..ef70a29728e75 100644 --- a/x-pack/plugins/apm/server/lib/services/annotations/index.test.ts +++ b/x-pack/plugins/apm/server/lib/services/annotations/index.test.ts @@ -81,13 +81,13 @@ describe('getServiceAnnotations', () => { { id: '8.0.0', text: '8.0.0', - time: 1.5281138e12, + '@timestamp': 1.5281138e12, type: 'version' }, { id: '7.5.0', text: '7.5.0', - time: 1.5281138e12, + '@timestamp': 1.5281138e12, type: 'version' } ]); diff --git a/x-pack/plugins/observability/common/annotations.ts b/x-pack/plugins/observability/common/annotations.ts index 6aea4d3d92f9b..fa4f3dc64ba92 100644 --- a/x-pack/plugins/observability/common/annotations.ts +++ b/x-pack/plugins/observability/common/annotations.ts @@ -47,5 +47,5 @@ export interface Annotation { event: { created: string; }; - '@timestamp': string; + '@timestamp': number; } diff --git a/x-pack/plugins/observability/server/lib/annotations/create_annotations_client.ts b/x-pack/plugins/observability/server/lib/annotations/create_annotations_client.ts index db40833065470..69e64b9e5cc64 100644 --- a/x-pack/plugins/observability/server/lib/annotations/create_annotations_client.ts +++ b/x-pack/plugins/observability/server/lib/annotations/create_annotations_client.ts @@ -112,11 +112,10 @@ export function createAnnotationsClient(params: { refresh: 'wait_for', })) as IndexDocumentResponse; - return { - _id: response._id, - _index: response._index, - _source: annotation, - }; + return apiCaller('get', { + index, + id: response._id, + }); }, getById: async (getByIdParams: GetByIdParams) => { const { id } = getByIdParams;