Skip to content

refactor: reduce memory usage with otel and clickhouse#4755

Merged
erka merged 1 commit into
v2from
rd/v2/memory
Sep 23, 2025
Merged

refactor: reduce memory usage with otel and clickhouse#4755
erka merged 1 commit into
v2from
rd/v2/memory

Conversation

@erka

@erka erka commented Sep 22, 2025

Copy link
Copy Markdown
Contributor

This pull request refactors how evaluation telemetry is handled, simplifying the tracing and analytics integration throughout the evaluation server and middleware. The main changes are the removal of legacy analytics event marshaling, the introduction of use of OpenTelemetry attributes and events for evaluation responses. This streamlines span event creation and makes tracing configuration more explicit and flexible.

@codecov

codecov Bot commented Sep 22, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 25.66372% with 84 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.64%. Comparing base (1c70431) to head (e830f79).
⚠️ Report is 1 commits behind head on v2.

Files with missing lines Patch % Lines
internal/server/evaluation/evaluation.go 0.00% 37 Missing and 2 partials ⚠️
internal/server/evaluation/ofrep_bridge.go 0.00% 32 Missing and 2 partials ⚠️
internal/server/analytics/sink.go 57.69% 10 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##               v2    #4755      +/-   ##
==========================================
- Coverage   62.67%   62.64%   -0.03%     
==========================================
  Files         132      132              
  Lines       15595    15531      -64     
==========================================
- Hits         9774     9730      -44     
+ Misses       5139     5115      -24     
- Partials      682      686       +4     
Flag Coverage Δ
integrationtests 36.34% <12.38%> (-0.18%) ⬇️
unittests 52.77% <17.69%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@erka erka added the v2 Flipt v2 label Sep 22, 2025
@erka erka changed the title fix: reduce memory usage with otel and clickhouse refactor: reduce memory usage with otel and clickhouse Sep 22, 2025
@erka
erka marked this pull request as ready for review September 22, 2025 21:40
@erka
erka requested a review from a team as a code owner September 22, 2025 21:40
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Sep 22, 2025
@erka
erka requested a review from Copilot September 22, 2025 21:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request refactors evaluation telemetry to reduce memory usage by replacing legacy analytics event marshaling with OpenTelemetry attributes and events. The changes streamline span event creation and make tracing configuration more explicit through the evaluation server.

  • Removes JSON marshaling of analytics events in middleware in favor of structured OpenTelemetry events
  • Introduces explicit tracing configuration through functional options in the evaluation server
  • Consolidates tracing logic within evaluation handlers with conditional execution based on configuration

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/server/tracing/attributes.go Adds new OpenTelemetry event constants and flag type attributes
internal/server/middleware/grpc/middleware.go Removes analytics parameter and legacy JSON marshaling logic
internal/server/middleware/grpc/middleware_test.go Updates test calls to match simplified middleware signature
internal/server/evaluation/server.go Adds tracing configuration option and constructor changes
internal/server/evaluation/evaluation.go Adds conditional tracing logic to evaluation handlers
internal/server/evaluation/ofrep_bridge.go Adds conditional tracing logic to OFREP bridge handlers
internal/server/analytics/sink.go Replaces JSON unmarshaling with structured attribute parsing
internal/server/analytics/sink_test.go Updates test to use new structured event format
internal/cmd/grpc.go Updates server construction with tracing configuration
go.mod Moves k8s.io/utils from indirect to direct dependency

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@dosubot

dosubot Bot commented Sep 22, 2025

Copy link
Copy Markdown

Related Documentation

Checked 3 published document(s). No updates required.

You have 3 draft document(s). Publish docs to keep them always up-to-date

How did I do? Any feedback?  Join Discord

@markphelps markphelps left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! ty!!

@erka
erka merged commit 5b43a4a into v2 Sep 23, 2025
41 of 44 checks passed
@erka
erka deleted the rd/v2/memory branch September 23, 2025 15:37
@github-project-automation github-project-automation Bot moved this to Done in Flipt V2 Sep 23, 2025
@dosubot

dosubot Bot commented Sep 23, 2025

Copy link
Copy Markdown

Documentation Updates

Checked 3 published document(s). No updates required.

You have 3 draft document(s). Publish docs to keep them always up-to-date

How did I do? Any feedback?  Join Discord

ptejasvini pushed a commit to ptejasvini/flipt that referenced this pull request Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files. v2 Flipt v2

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants