feat: restore OpenTelemetry metrics with v1.20+ compatibility #3769
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



Summary
Restores the OpenTelemetry/Prometheus metrics feature that was disabled in commit
0c0e5467bdue to compilation issues. This PR fixes API compatibility with OpenTelemetry v1.20+, adds automation scripts, and provides comprehensive documentation.Background
The metrics feature was originally implemented in #1966 but was disabled by default after API breaking changes in OpenTelemetry caused compilation errors. This PR addresses those issues and makes the feature production-ready.
Changes Made
Code Fixes
unique_ptr→shared_ptrconversion)account_repository.hppinclude iniologindata.cppvcpkg.jsonto properly declare OpenTelemetry featuresAutomation
scripts/build_with_metrics.sh: Automated build script with metrics enabledscripts/start_monitoring.sh: One-command Prometheus + Grafana stack launcherDocumentation
docs/METRICS.md: Quick-start guide for the metrics featuredocs/METRICS_ENABLE.md: Detailed enablement and troubleshooting guideTesting
http://localhost:9464/metricsCompatibility
FEATURE_METRICS=OFF(no breaking changes)Configuration
To enable metrics:
Security & Performance
Future Work
References
9d6099361(initial),0c0e5467b(disabled),c5a2b08af(vcpkg)Checklist
Note: This is an optional feature that requires explicit opt-in. No changes to default server behavior.