STO-533: Convert littdb to use otel#3466
Conversation
PR SummaryMedium Risk Overview Metrics wiring is simplified around a global OTel provider. Reviewed by Cursor Bugbot for commit be9328d. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit be9328d. Configure here.
| logger.Info("Starting metrics server", "port", config.MetricsPort) | ||
| commonmetrics.StartMetricsServer(config.CTX, reg, addr) | ||
|
|
||
| return metrics.NewLittDBMetrics(), shutdown |
There was a problem hiding this comment.
Metrics HTTP server leaks after DB close
Medium Severity
The metrics HTTP server started by commonmetrics.StartMetricsServer is never shut down when db.Close() is called. The old code deferred d.metricsServer.Close() inside gatherMetrics, but the new code only defers d.metricsShutdown (the OTel provider.Shutdown), which flushes the meter provider without stopping the HTTP listener. The server only terminates when config.CTX is cancelled, and the default context is context.Background(), which is never cancelled. This leaks a goroutine and a bound TCP port after every Close() call.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit be9328d. Configure here.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3466 +/- ##
==========================================
+ Coverage 58.96% 58.98% +0.02%
==========================================
Files 2185 2185
Lines 181869 181796 -73
==========================================
- Hits 107240 107238 -2
+ Misses 65024 64953 -71
Partials 9605 9605
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|


Describe your changes and provide context
LittDB's original metrics stack uses the prometheus APIs. Convert instead to using OTEL APIs.
Testing performed to validate your change
unit tests