Tempo: Add new intrinsics (#77146)

This commit is contained in:
Fabrizio 2023-10-30 14:05:14 +01:00 committed by GitHub
parent 03ca9c7c66
commit 44839a1bdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 67 additions and 6 deletions

View File

@ -106,27 +106,79 @@ describe('generateQueryFromFilters generates the correct query for', () => {
describe('gets correct tags', () => {
it('for filtered tags when no tags supplied', () => {
const tags = getFilteredTags(emptyTags, []);
expect(tags).toEqual(['duration', 'kind', 'name', 'status']);
expect(tags).toEqual([
'duration',
'kind',
'name',
'rootName',
'rootServiceName',
'status',
'statusMessage',
'traceDuration',
]);
});
it('for filtered tags when API v1 tags supplied', () => {
const tags = getFilteredTags(v1Tags, []);
expect(tags).toEqual(['duration', 'kind', 'name', 'status', 'bar', 'foo']);
expect(tags).toEqual([
'duration',
'kind',
'name',
'rootName',
'rootServiceName',
'status',
'statusMessage',
'traceDuration',
'bar',
'foo',
]);
});
it('for filtered tags when API v1 tags supplied with tags to filter out', () => {
const tags = getFilteredTags(v1Tags, ['duration']);
expect(tags).toEqual(['kind', 'name', 'status', 'bar', 'foo']);
expect(tags).toEqual([
'kind',
'name',
'rootName',
'rootServiceName',
'status',
'statusMessage',
'traceDuration',
'bar',
'foo',
]);
});
it('for filtered tags when API v2 tags supplied', () => {
const tags = getFilteredTags(uniq(getUnscopedTags(v2Tags)), []);
expect(tags).toEqual(['duration', 'kind', 'name', 'status', 'cluster', 'container', 'db']);
expect(tags).toEqual([
'duration',
'kind',
'name',
'rootName',
'rootServiceName',
'status',
'statusMessage',
'traceDuration',
'cluster',
'container',
'db',
]);
});
it('for filtered tags when API v2 tags supplied with tags to filter out', () => {
const tags = getFilteredTags(getUnscopedTags(v2Tags), ['duration', 'cluster']);
expect(tags).toEqual(['kind', 'name', 'status', 'container', 'db']);
expect(tags).toEqual([
'kind',
'name',
'rootName',
'rootServiceName',
'status',
'statusMessage',
'traceDuration',
'container',
'db',
]);
});
it('for unscoped tags', () => {

View File

@ -27,7 +27,16 @@ export const operators = ['=', '!=', '>', '<', '>=', '<=', '=~', '!~'];
export const stringOperators = ['=', '!=', '=~', '!~'];
export const numberOperators = ['=', '!=', '>', '<', '>=', '<='];
export const intrinsics = ['duration', 'kind', 'name', 'status'];
export const intrinsics = [
'duration',
'kind',
'name',
'rootName',
'rootServiceName',
'status',
'statusMessage',
'traceDuration',
];
export const scopes: string[] = ['resource', 'span'];
export const functions = ['avg', 'min', 'max', 'sum', 'count', 'by'];