Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref(metrics): Remodel metric submission flow (#3867)
Remove all the load of processing metrics from the project cache and move it to the processor. We slowly moved more and more logic into the project cache, which over time became quite expensive to execute. Especially for heavily batched metrics. To alleviate this problem, the project cache only enriches messages with project information and dispatches based on this information instead of also dealing with filtering/validating metrics and rate limiting metrics. Validation and rate limits are now enforced in the Processor. The old flow for Metrics: ```mermaid sequenceDiagram Endpoint->>Processor: ProcessMetrics Processor->>Project Cache: AddMetricBuckets activate Project Cache Note right of Project Cache: [check_buckets] Project Cache->>Aggregator: MergeBuckets deactivate Project Cache Aggregator->>Project Cache: FlushBuckets activate Project Cache Note right of Project Cache: [check_buckets] Project Cache->>Processor: EncodeMetrics deactivate Project Cache Processor->>Store: SendRequest ``` The new flow: ```mermaid sequenceDiagram participant Endpoint participant Processor participant Project Cache participant Aggregator participant Store Endpoint->>Project Cache: ProcessMetrics Project Cache->>Processor: ProcessProjectMetrics activate Processor Note right of Processor: [check_buckets] Processor->>Aggregator: MergeBuckets deactivate Processor Aggregator->>Project Cache: FlushBuckets Project Cache->>Processor: EncodeMetrics activate Processor Note right of Processor: [check_buckets] Processor->>Store: SendRequest deactivate Processor ``` Batched metrics just have a slightly adjusted flow, they go from the endpoint to the processor for parsing, then move forward with the same `ProcessMetrics` flow.
- Loading branch information