forked from highlight/highlight
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introduce backend for filtering ingest (highlight#6713)
## Summary Introduces a sampling rate and ingestion exclusion filters for all 4 products. Rate-based ingestion uses a stable ingest-item key to consistently deem whether a resource should be ingested or not, so that even if we replay the ingest queue, ingest decisions will remain the same based on client-generated keys. Filter-based ingestion mimics the existing search logic we have but applies filters directly as each item is ingested to avoid having to insert into clickhouse to make a filter query. This means that the filtering logic has to be duplicated with what we have for the feeds themselves, but the logic is shared across the 4 products. ### Sessions * Sampling rate uses session secure ID as the key * Exclusion filters are applied when a session is initialized or when the datasync queue has an entry (ie. new fields are appended). ### Errors * Sampling rate uses request id, trace id, or span id. * Exclusion filters are applied when errors are ingested in push payload or in otel backend processing. ### Logs * Sampling rate uses the log UUID. * Exclusion filters are applied in otel backend processing. ### Traces * Sampling rate uses the trace UUID. Because the trace UUID is consistent with all spans children of a root trace, this is effectively 'head' tracing since once we determine a root trace to be included, all child spans will also be included. * Exclusion filters are applied in otel backend processing. Relates to highlight#6749 ## How did you test this change? New unit tests. Validating sampling working correctly locally. ![image](https://github.com/highlight/highlight/assets/1351531/52bc2474-d5ac-44b8-8833-efbc3d5365d3) ## Are there any deployment considerations? No, all new functionality is disabled by default with no way to enable this from the UI yet. ## Does this work require review from our design team? No
- Loading branch information
Showing
41 changed files
with
2,898 additions
and
244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package clickhouse | ||
|
||
import ( | ||
modelInputs "github.com/highlight-run/highlight/backend/public-graph/graph/model" | ||
"github.com/highlight-run/highlight/backend/queryparser" | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
"time" | ||
) | ||
|
||
func Test_ErrorMatchesQuery(t *testing.T) { | ||
errorObject := modelInputs.BackendErrorObjectInput{} | ||
filters := queryparser.Parse("oops something bad type:console.error os.type:linux resource_name:worker.* service_name:all") | ||
matches := ErrorMatchesQuery(&errorObject, &filters) | ||
assert.False(t, matches) | ||
|
||
errorObject = modelInputs.BackendErrorObjectInput{ | ||
Event: "good evening, this is an error where oops something bad happens", | ||
Type: "console.error", | ||
URL: "https://example.com", | ||
Source: "backend", | ||
StackTrace: "yoo", | ||
Timestamp: time.Now(), | ||
Service: &modelInputs.ServiceInput{ | ||
Name: "all", | ||
Version: "asdf", | ||
}, | ||
} | ||
matches = ErrorMatchesQuery(&errorObject, &filters) | ||
assert.True(t, matches) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.