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', () => {
seriesLabels: { __name__: 'test' },
exemplars: [
{
scrapeTimestamp: 1610449069957,
exemplar: {
timestamp: 1610449069957,
labels: { traceID: '5020b5bc45117f07' },
value: 0.002074123,
timestamp: 1610449054960,
hasTimestamp: true,
},
},
],
},
......@@ -521,29 +517,21 @@ describe('Prometheus Result Transformer', () => {
{
exemplars: [
{
scrapeTimestamp: 1610449070000,
exemplar: {
timestamp: 1610449070000,
value: 5,
},
},
{
scrapeTimestamp: 1610449070000,
exemplar: {
timestamp: 1610449070000,
value: 1,
},
},
{
scrapeTimestamp: 1610449070500,
exemplar: {
timestamp: 1610449070500,
value: 13,
},
},
{
scrapeTimestamp: 1610449070300,
exemplar: {
timestamp: 1610449070300,
value: 20,
},
},
],
},
],
......
......@@ -78,9 +78,9 @@ export function transform(
prometheusResult.forEach((exemplarData) => {
const data = exemplarData.exemplars.map((exemplar) => {
return {
[TIME_SERIES_TIME_FIELD_NAME]: exemplar.scrapeTimestamp,
[TIME_SERIES_VALUE_FIELD_NAME]: exemplar.exemplar.value,
...exemplar.exemplar.labels,
[TIME_SERIES_TIME_FIELD_NAME]: exemplar.timestamp,
[TIME_SERIES_VALUE_FIELD_NAME]: exemplar.value,
...exemplar.labels,
...exemplarData.seriesLabels,
};
});
......
......@@ -69,21 +69,15 @@ export interface Labels {
[index: string]: any;
}
export interface ScrapeExemplar {
exemplar: Exemplar;
scrapeTimestamp: number;
}
export interface Exemplar {
labels: Labels;
value: number;
timestamp: number;
hasTimestamp: boolean;
}
export interface PromExemplarData {
seriesLabels: PromMetric;
exemplars: ScrapeExemplar[];
exemplars: Exemplar[];
}
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