feat: return total size in metric size Allow method for Log#5628
feat: return total size in metric size Allow method for Log#5628joe-elliott merged 9 commits intografana:mainfrom
Conversation
|
Thank you for this improvement, but for any future changes please don't open a new PR. We can continue working in this one. I have one more change to request. The code you've improved is going to go away in Tempo 3.0. We've moved this logic to a new spot. Adding better support for logging max traces sizes in 3.0 should be quite simple. Can you wrap this error with the appropriate info: https://github.com/grafana/tempo/blob/main/pkg/livetraces/livetraces.go#L92 |
@joe-elliott Thank you for the feedback! I've been exploring different approaches for wrapping the error with appropriate info: Option 1: fmt.Errorf() with detailed info (Current implementation)Pros: Simple, maintains errors.Is() compatibility, minimal changes to existing code Option 2: Return AllowResult struct instead of error from PushWithTimestampAndLimitsPros: Structured information, handles both success/failure cases Option 3: Inject logger into PushWithTimestampAndLimits for internal loggingPros: Logging handled at the point of occurrence, minimal caller code changes Which approach would you prefer for Tempo 3.0? |
|
These lines can log an enormous amount. I think we should pass in a logger when creating the livetraces struct, but we need it to be rate limited like here: https://github.com/grafana/tempo/blob/main/modules/ingester/instance.go#L131 |
@joe-elliott thanks I added log on livetraces.go too. |
joe-elliott
left a comment
There was a problem hiding this comment.
this looks good, but looks like theres a lint issue?
@joe-elliott I fixed it thanks 👍 |
|
@joe-elliott Hi can u check this PR please? |
|
@joe-elliott hi I checked ci workflow again can u check this pr I really appreciate your time |
joe-elliott
left a comment
There was a problem hiding this comment.
Thank you for sticking with this! Nice addition 🙏
What this PR does
Implements feedback from #5625
Returns the trace size directly from the
.Allow()method instead, ensuring a thread-safe approach.Adds total size logging functionality
Track and log the cumulative size of traces processed by the ingester.
→ Provides better observability into trace data volume and helps with monitoring resource usage.
Comparison of Approaches
Performance Impact
Command used:
go test -bench=BenchmarkInstancePushBytesExistingTrace -benchmem -run=^$ -v -benchtime=30sAt This PR
At #5625
Analysis:
• Latency increase: ~42μs per operation (+13.84%)
Result
Which issue(s) this PR fixes:
Addresses feedback from #5625 - implements trace size logging via .Allow() method return value for thread-safe operation.
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]