fix(contrib/metric/otelmetric): Fix MustProvider function parameter and improve runtime version retrieval - #4729
Open
H4x3rs wants to merge 4 commits into
Open
fix(contrib/metric/otelmetric): Fix MustProvider function parameter and improve runtime version retrieval#4729H4x3rs wants to merge 4 commits into
H4x3rs wants to merge 4 commits into
Conversation
added 2 commits
March 2, 2026 16:58
- 将metric.WithReader替换为otelmetric.WithReader以匹配正确的函数签名
- 添加 reflect 包导入以支持动态调用 - 实现 getRuntimeVersion 函数,通过反射安全获取运行时版本 - 替换直接调用 runtime.Version() 为 getRuntimeVersion() 调用 - 提高版本获取的稳定性和兼容性
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the otelmetric contrib module to (1) correct the README example to use the module’s Option helpers, and (2) make built-in runtime metrics scope version retrieval resilient to upstream API differences.
Changes:
- Update README example to pass
otelmetric.WithReader(...)intootelmetric.MustProvider(...). - Introduce
getRuntimeVersion()and replace directruntime.Version()calls when constructing built-in metric views.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| contrib/metric/otelmetric/otelmetric_provider.go | Adds a compatibility runtime version getter and uses it for instrumentation scope version in built-in metric views. |
| contrib/metric/otelmetric/README.MD | Fixes the README example to use otelmetric.WithReader (matching MustProvider(...Option)). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Member
|
@H4x3rs Please resolve the comment. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
docs(otelmetric/README.MD): 修复MustProvider函数参数错误
fix(otelmetric): 兼容不同版本runtime版本获取逻辑