Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-surrounding-context-filters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hyperdx/app": patch
---

Fix Surrounding Context filters for non-OTEL schemas by using the source's serviceNameExpression for the "Service" filter instead of hardcoded ResourceAttributes lookup. Also adds quick event attribute filters that let users toggle attributes from the current event to narrow surrounding context results.
29 changes: 29 additions & 0 deletions packages/app/src/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
COLORS,
evaluateColorCondition,
formatAttributeClause,
formatColumnEquals,
formatDurationMs,
formatDurationMsCompact,
formatNumber,
Expand Down Expand Up @@ -42,6 +43,10 @@ describe('formatAttributeClause', () => {
expect(formatAttributeClause('data', 'user-id', 'abc-123', true)).toBe(
"data['user-id']='abc-123'",
);

expect(formatAttributeClause('data', 'user-id', "O'Brien", true)).toBe(
"data['user-id']='O''Brien'",
);
});

it('should format lucene attribute clause correctly', () => {
Expand All @@ -56,6 +61,30 @@ describe('formatAttributeClause', () => {
expect(formatAttributeClause('data', 'user-id', 'abc-123', false)).toBe(
'data.user-id:"abc-123"',
);

expect(formatAttributeClause('data', 'user-id', 'say "hello"', false)).toBe(
'data.user-id:"say \\"hello\\""',
);
});
});

describe('formatColumnEquals', () => {
it('formats SQL column equality with quote escaping', () => {
expect(formatColumnEquals('ServiceName', 'my-svc', true)).toBe(
"ServiceName = 'my-svc'",
);
expect(formatColumnEquals('Name', "O'Brien", true)).toBe(
"Name = 'O''Brien'",
);
});

it('formats Lucene column equality with quote escaping', () => {
expect(formatColumnEquals('ServiceName', 'my-svc', false)).toBe(
'ServiceName:"my-svc"',
);
expect(formatColumnEquals('Name', 'say "hello"', false)).toBe(
'Name:"say \\"hello\\""',
);
});
});

Expand Down
Loading
Loading