From 9c6befbe4a7c0eb78596323f384ab8352ad608a2 Mon Sep 17 00:00:00 2001 From: Alex Grant Date: Thu, 5 Dec 2024 14:35:09 -0500 Subject: [PATCH] feat: add empty operators to explore --- .../analytics-utilities/src/types/explore/advanced.ts | 8 ++++++-- .../analytics/analytics-utilities/src/types/explore/ai.ts | 8 ++++++-- .../analytics-utilities/src/types/explore/basic.ts | 8 ++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/packages/analytics/analytics-utilities/src/types/explore/advanced.ts b/packages/analytics/analytics-utilities/src/types/explore/advanced.ts index 863dc304df..a0d4a9c365 100644 --- a/packages/analytics/analytics-utilities/src/types/explore/advanced.ts +++ b/packages/analytics/analytics-utilities/src/types/explore/advanced.ts @@ -1,5 +1,5 @@ import { makeFilterable } from './util' -import type { BasicExploreFilter, BasicExploreInFilterV2, BasicExploreQuery } from './basic' +import type { BasicExploreEmptyFilterV2, BasicExploreFilter, BasicExploreInFilterV2, BasicExploreQuery } from './basic' import { basicExploreAggregations, queryableBasicExploreDimensions } from './basic' export const queryableExploreDimensions = [ @@ -23,6 +23,10 @@ export interface ExploreInFilterV2 extends Omit field: FilterableExploreDimensions } +export interface ExploreEmptyFilterV2 extends Omit { + field: FilterableExploreDimensions +} + export const exploreAggregations = [ ...basicExploreAggregations, 'response_latency_p99', @@ -48,7 +52,7 @@ export const exploreAggregations = [ export type ExploreAggregations = typeof exploreAggregations[number] -export type ExploreFilterAll = ExploreFilter | ExploreInFilterV2 +export type ExploreFilterAll = ExploreFilter | ExploreInFilterV2 | ExploreEmptyFilterV2 export interface ExploreQuery extends Omit { metrics?: ExploreAggregations[] diff --git a/packages/analytics/analytics-utilities/src/types/explore/ai.ts b/packages/analytics/analytics-utilities/src/types/explore/ai.ts index dde7230448..ab95b87ae6 100644 --- a/packages/analytics/analytics-utilities/src/types/explore/ai.ts +++ b/packages/analytics/analytics-utilities/src/types/explore/ai.ts @@ -1,5 +1,5 @@ import { makeFilterable } from './util' -import type { BasicExploreFilter, BasicExploreInFilterV2, BasicExploreQuery } from './basic' +import type { BasicExploreEmptyFilterV2, BasicExploreFilter, BasicExploreInFilterV2, BasicExploreQuery } from './basic' export const queryableAiExploreDimensions = [ 'control_plane', @@ -31,6 +31,10 @@ export interface AiExploreInFilterV2 extends Omit { + field: FilterableAiExploreDimensions +} + export const aiExploreAggregations = [ 'total_tokens', 'prompt_tokens', @@ -46,7 +50,7 @@ export const aiExploreAggregations = [ export type AiExploreAggregations = typeof aiExploreAggregations[number] -export type AiExploreFilterAll = AiExploreFilter | AiExploreInFilterV2 +export type AiExploreFilterAll = AiExploreFilter | AiExploreInFilterV2 | AiExploreEmptyFilterV2 export interface AiExploreQuery extends Omit { metrics?: AiExploreAggregations[] diff --git a/packages/analytics/analytics-utilities/src/types/explore/basic.ts b/packages/analytics/analytics-utilities/src/types/explore/basic.ts index d7e15ebdb2..c67e03475a 100644 --- a/packages/analytics/analytics-utilities/src/types/explore/basic.ts +++ b/packages/analytics/analytics-utilities/src/types/explore/basic.ts @@ -1,5 +1,5 @@ import { makeFilterable } from './util' -import type { ExploreFilterTypesV2, GranularityValues, TimeRangeV4 } from './common' +import type { ExploreFilterTypesV2, GranularityValues, RequestFilterTypeEmptyV2, TimeRangeV4 } from './common' export const queryableBasicExploreDimensions = [ 'api_product', @@ -32,6 +32,10 @@ export interface BasicExploreInFilterV2 { value: (string | number | null)[] } +export interface BasicExploreEmptyFilterV2 { + operator: RequestFilterTypeEmptyV2 + field: FilterableBasicExploreDimensions +} export const basicExploreAggregations = [ 'active_services', 'request_count', @@ -41,7 +45,7 @@ export const basicExploreAggregations = [ export type BasicExploreAggregations = typeof basicExploreAggregations[number] -export type BasicExploreFilterAll = BasicExploreFilter | BasicExploreInFilterV2 +export type BasicExploreFilterAll = BasicExploreFilter | BasicExploreInFilterV2 | BasicExploreEmptyFilterV2 export interface BasicExploreQuery { metrics?: BasicExploreAggregations[]