Commit 48334ab8 by Zoltán Bedi Committed by GitHub

Exemplars: change api to reflect latest changes (#30910)

parent cbe040b8
...@@ -492,13 +492,9 @@ describe('Prometheus Result Transformer', () => { ...@@ -492,13 +492,9 @@ describe('Prometheus Result Transformer', () => {
seriesLabels: { __name__: 'test' }, seriesLabels: { __name__: 'test' },
exemplars: [ exemplars: [
{ {
scrapeTimestamp: 1610449069957, timestamp: 1610449069957,
exemplar: {
labels: { traceID: '5020b5bc45117f07' }, labels: { traceID: '5020b5bc45117f07' },
value: 0.002074123, value: 0.002074123,
timestamp: 1610449054960,
hasTimestamp: true,
},
}, },
], ],
}, },
...@@ -521,29 +517,21 @@ describe('Prometheus Result Transformer', () => { ...@@ -521,29 +517,21 @@ describe('Prometheus Result Transformer', () => {
{ {
exemplars: [ exemplars: [
{ {
scrapeTimestamp: 1610449070000, timestamp: 1610449070000,
exemplar: {
value: 5, value: 5,
}, },
},
{ {
scrapeTimestamp: 1610449070000, timestamp: 1610449070000,
exemplar: {
value: 1, value: 1,
}, },
},
{ {
scrapeTimestamp: 1610449070500, timestamp: 1610449070500,
exemplar: {
value: 13, value: 13,
}, },
},
{ {
scrapeTimestamp: 1610449070300, timestamp: 1610449070300,
exemplar: {
value: 20, value: 20,
}, },
},
], ],
}, },
], ],
......
...@@ -78,9 +78,9 @@ export function transform( ...@@ -78,9 +78,9 @@ export function transform(
prometheusResult.forEach((exemplarData) => { prometheusResult.forEach((exemplarData) => {
const data = exemplarData.exemplars.map((exemplar) => { const data = exemplarData.exemplars.map((exemplar) => {
return { return {
[TIME_SERIES_TIME_FIELD_NAME]: exemplar.scrapeTimestamp, [TIME_SERIES_TIME_FIELD_NAME]: exemplar.timestamp,
[TIME_SERIES_VALUE_FIELD_NAME]: exemplar.exemplar.value, [TIME_SERIES_VALUE_FIELD_NAME]: exemplar.value,
...exemplar.exemplar.labels, ...exemplar.labels,
...exemplarData.seriesLabels, ...exemplarData.seriesLabels,
}; };
}); });
......
...@@ -69,21 +69,15 @@ export interface Labels { ...@@ -69,21 +69,15 @@ export interface Labels {
[index: string]: any; [index: string]: any;
} }
export interface ScrapeExemplar {
exemplar: Exemplar;
scrapeTimestamp: number;
}
export interface Exemplar { export interface Exemplar {
labels: Labels; labels: Labels;
value: number; value: number;
timestamp: number; timestamp: number;
hasTimestamp: boolean;
} }
export interface PromExemplarData { export interface PromExemplarData {
seriesLabels: PromMetric; seriesLabels: PromMetric;
exemplars: ScrapeExemplar[]; exemplars: Exemplar[];
} }
export interface PromVectorData { export interface PromVectorData {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment