-
Notifications
You must be signed in to change notification settings - Fork 715
fix: add email headers to metrics and traces ep #9357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Failed to generate code suggestions for PR |
|
Failed to generate code suggestions for PR |
Greptile OverviewGreptile SummaryThis PR systematically adds user email tracking to metrics and traces ingestion endpoints for usage reporting purposes. The changes thread a Key Changes:
Implementation Pattern: Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Client
participant HTTPHandler
participant GRPCHandler
participant AuthValidator
participant HeadersExtractor
participant ServiceLayer
participant UsageReporting
Note over Client,UsageReporting: HTTP Request Flow (Metrics/Traces)
Client->>HTTPHandler: POST /org/v1/metrics (with Auth)
HTTPHandler->>HeadersExtractor: Extract UserEmail from headers
HeadersExtractor->>HeadersExtractor: Deserialize user_id header
HeadersExtractor-->>HTTPHandler: UserEmail struct
HTTPHandler->>ServiceLayer: ingest(org_id, body, user_email)
ServiceLayer->>ServiceLayer: Process data & create req_stats
ServiceLayer->>ServiceLayer: req_stats.user_email = Some(user_email)
ServiceLayer->>UsageReporting: report_request_usage_stats(req_stats)
UsageReporting-->>Client: Response
Note over Client,UsageReporting: gRPC Request Flow
Client->>GRPCHandler: Export(request, metadata)
GRPCHandler->>GRPCHandler: Extract user_id from metadata
GRPCHandler->>ServiceLayer: handle_otlp_request(org_id, req, type, user_email)
ServiceLayer->>ServiceLayer: Process & assign req_stats.user_email
ServiceLayer->>UsageReporting: report_request_usage_stats(req_stats)
UsageReporting-->>Client: Response
Note over Client,UsageReporting: RUM Request Flow (with Validator)
Client->>AuthValidator: POST /v1/org/rum (with token)
AuthValidator->>AuthValidator: Validate token
AuthValidator->>AuthValidator: get_user_by_token()
AuthValidator->>AuthValidator: Inject user_id header with email
AuthValidator->>HTTPHandler: Forward with user_id header
HTTPHandler->>HTTPHandler: Extract user_id from headers
HTTPHandler->>ServiceLayer: logs ingest with user_email
ServiceLayer->>UsageReporting: report_request_usage_stats(req_stats)
UsageReporting-->>Client: Response
Note over Client,UsageReporting: Internal/System Flow
HTTPHandler->>ServiceLayer: self-metrics ingest with empty string
ServiceLayer->>ServiceLayer: req_stats.user_email = None
ServiceLayer->>UsageReporting: report_request_usage_stats(req_stats)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
13 files reviewed, no comments
YashodhanJoshi1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm with a small nit
adding headers to multiple endpoints for usage reporting