fix(observability): keep probe and otel summaries bounded
This commit is contained in:
@@ -750,9 +750,10 @@ async function search(config: UniDeskConfig, options: SearchOptions): Promise<Re
|
||||
}
|
||||
|
||||
function inferSearchTempoQuery(options: SearchOptions): string | null {
|
||||
if (options.path !== null) return `{ .http.route = ${JSON.stringify(options.path)} }`;
|
||||
if (options.status !== null) return `{ .http.response.status_code = ${options.status} }`;
|
||||
return null;
|
||||
const filters: string[] = [];
|
||||
if (options.path !== null) filters.push(`.http.route = ${JSON.stringify(options.path)}`);
|
||||
if (options.status !== null) filters.push(`.http.response.status_code = ${options.status}`);
|
||||
return filters.length > 0 ? `{ ${filters.join(" && ")} }` : null;
|
||||
}
|
||||
|
||||
function businessTraceIdFromSearchText(value: string | null): string | null {
|
||||
@@ -827,7 +828,7 @@ function renderTraceTable(input: {
|
||||
return [
|
||||
shortenEnd(textValue(span.name), 48),
|
||||
shortenEnd(textValue(span.service), 28),
|
||||
spanDetail(span, 140),
|
||||
spanDetail(span, 360),
|
||||
];
|
||||
});
|
||||
const countRows = asArray(input.result.spanNameCounts).slice(0, 8).map((item) => {
|
||||
@@ -1039,6 +1040,7 @@ function uniqueSpanRecords(values: unknown[]): Record<string, unknown>[] {
|
||||
function spanDetail(span: Record<string, unknown>, maxLength: number): string {
|
||||
const attrs = asPlainRecord(span.attributes);
|
||||
const parts = [
|
||||
valuePart("durationMs", span.durationMs),
|
||||
attrPart(attrs, "failureKind"),
|
||||
attrPart(attrs, "errorSummary"),
|
||||
attrPart(attrs, "error.message"),
|
||||
@@ -1059,11 +1061,30 @@ function spanDetail(span: Record<string, unknown>, maxLength: number): string {
|
||||
attrPart(attrs, "commandFingerprint"),
|
||||
attrPart(attrs, "http.route"),
|
||||
attrPart(attrs, "http.response.status_code"),
|
||||
attrPart(attrs, "db.system"),
|
||||
attrPart(attrs, "db.operation.name"),
|
||||
attrPart(attrs, "db.sql.table"),
|
||||
attrPart(attrs, "db.query.arg_count"),
|
||||
attrPart(attrs, "db.index.expected"),
|
||||
attrPart(attrs, "db.pool.max_open"),
|
||||
attrPart(attrs, "db.pool.open_connections"),
|
||||
attrPart(attrs, "db.pool.in_use"),
|
||||
attrPart(attrs, "db.pool.idle"),
|
||||
attrPart(attrs, "db.pool.wait_count"),
|
||||
attrPart(attrs, "db.pool.wait_duration_ms"),
|
||||
attrPart(attrs, "error.code"),
|
||||
attrPart(attrs, "error.category"),
|
||||
attrPart(attrs, "error.layer"),
|
||||
].filter((item) => item !== null) as string[];
|
||||
if (parts.length === 0) return "-";
|
||||
return shortenEnd(parts.join(" "), maxLength);
|
||||
}
|
||||
|
||||
function valuePart(key: string, value: unknown): string | null {
|
||||
if (value === null || value === undefined || value === "") return null;
|
||||
return `${key}=${textValue(value)}`;
|
||||
}
|
||||
|
||||
function attrPart(attrs: Record<string, unknown> | null, key: string): string | null {
|
||||
if (attrs === null) return null;
|
||||
const value = attrs[key];
|
||||
|
||||
Reference in New Issue
Block a user