Skip to content

Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.

feat: add span name filter (#1065)

chris-arakia66bfb2127a2
diff --git a/src/client/src/components/(playground)/filter/traces-filter.tsx b/src/client/src/components/(playground)/filter/traces-filter.tsx
index a22119fc..4fbfeaa4 100644
--- a/src/client/src/components/(playground)/filter/traces-filter.tsx
+++ b/src/client/src/components/(playground)/filter/traces-filter.tsx
@@ -148,6 +148,7 @@ function configToParams(config: Partial<FilterConfig>, params: URLSearchParams)
params.delete("providers");
params.delete("traceTypes");
params.delete("appNames");
+ params.delete("spanNames");
params.delete("envs");
params.delete("maxCost");
// remove all existing cf entries
@@ -157,6 +158,7 @@ function configToParams(config: Partial<FilterConfig>, params: URLSearchParams)
if (config.providers?.length) params.set("providers", config.providers.join(","));
if (config.traceTypes?.length) params.set("traceTypes", config.traceTypes.join(","));
if (config.applicationNames?.length) params.set("appNames", config.applicationNames.join(","));
+ if (config.spanNames?.length) params.set("spanNames", config.spanNames.join(","));
if (config.environments?.length) params.set("envs", config.environments.join(","));
if (config.maxCost) params.set("maxCost", String(config.maxCost));
config.customFilters?.forEach(({ attributeType, key, value }) => {
@@ -176,6 +178,8 @@ function paramsToConfig(params: URLSearchParams): Partial<FilterConfig> {
if (traceTypes) config.traceTypes = traceTypes.split(",").filter(Boolean);
const appNames = params.get("appNames");
if (appNames) config.applicationNames = appNames.split(",").filter(Boolean);
+ const spanNames = params.get("spanNames");
+ if (spanNames) config.spanNames = spanNames.split(",").filter(Boolean);
const envs = params.get("envs");
if (envs) config.environments = envs.split(",").filter(Boolean);
const maxCost = params.get("maxCost");
@@ -251,6 +255,7 @@ const DynamicFilters = ({
case "providers":
case "traceTypes":
case "applicationNames":
+ case "spanNames":
case "environments":
if (operationType === "add") {
setSelectedFilterValues((s) => {
@@ -450,6 +455,19 @@ const DynamicFilters = ({
clearItem={clearFilter}
/>
) : null}
+ {filterConfig?.spanNames?.length ? (
+ <ComboDropdown
+ options={filterConfig?.spanNames.map((s) => ({
+ label: s,
+ value: s,
+ }))}
+ title="Span Names"
+ type="spanNames"
+ updateSelectedValues={updateSelectedValues}
+ selectedValues={selectedFilterValues.spanNames}
+ clearItem={clearFilter}
+ />
+ ) : null}
{filterConfig?.environments?.length ? (
<ComboDropdown
options={filterConfig?.environments.map((e) => ({
diff --git a/src/client/src/helpers/server/platform.ts b/src/client/src/helpers/server/platform.ts
index f129a4df..903f5b83 100644
--- a/src/client/src/helpers/server/platform.ts
+++ b/src/client/src/helpers/server/platform.ts
@@ -233,6 +233,14 @@ export const getFilterWhereCondition = (
);
}
+ if (filter.selectedConfig.spanNames?.length) {
+ whereArray.push(
+ `SpanName IN (${filter.selectedConfig.spanNames
+ .map((spanName) => `'${spanName}'`)
+ .join(", ")})`
+ );
+ }
+
if (filter.selectedConfig.environments?.length) {
whereArray.push(
`ResourceAttributes['${getTraceMappingKeyFullPath(
diff --git a/src/client/src/lib/platform/request/index.ts b/src/client/src/lib/platform/request/index.ts
index ecf194f2..e53ec52d 100644
--- a/src/client/src/lib/platform/request/index.ts
+++ b/src/client/src/lib/platform/request/index.ts
@@ -131,6 +131,10 @@ export async function getRequestsConfig(params: MetricParams) {
)}'])) AS applicationNames`
);
+ select.push(
+ `arrayFilter(x -> x != '', ARRAY_AGG(DISTINCT SpanName)) AS spanNames`
+ );
+
select.push(
`arrayFilter(x -> x != '', ARRAY_AGG(DISTINCT ResourceAttributes['${getTraceMappingKeyFullPath(
"environment"
diff --git a/src/client/src/types/platform.ts b/src/client/src/types/platform.ts
index 4999f8bf..a968b39d 100644
--- a/src/client/src/types/platform.ts
+++ b/src/client/src/types/platform.ts
@@ -14,6 +14,7 @@ export type FilterWhereConditionType = {
models: string[];
traceTypes: string[];
applicationNames: string[];
+ spanNames: string[];
environments: string[];
customFilters: { attributeType: string; key: string; value: string }[];
}>;
diff --git a/src/client/src/types/store/filter.ts b/src/client/src/types/store/filter.ts
index 50c60b7d..bfd49e75 100644
--- a/src/client/src/types/store/filter.ts
+++ b/src/client/src/types/store/filter.ts
@@ -34,6 +34,7 @@ export interface FilterConfig {
totalRows: number;
traceTypes: string[];
applicationNames: string[];
+ spanNames: string[];
environments: string[];
customFilters?: CustomFilter[];
}