-
Notifications
You must be signed in to change notification settings - Fork 867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose track2 module name and version for tracing purpose #23574
Comments
@jhendrixMSFT, could you comment on this ask? Is it by design that we don't expose name & version? |
The only reason we never exported it in the past was because we didn't think it would be useful. If there's a real need for these to be exported, we can do that. |
We should export if we can't find a suitable way to query this at runtime. |
@JeffreyRichter Any concerns with exposing these two fields for all modules? |
Doesn't our tracing work as-is? |
SDK is a dependency of our library. I need to add this info into log and trace. |
I don't quite understand. If your app depended on any other module which did not have constants for the module name and version embedded in it, then what would you do? Most modules do not have these constants and I don't think that just because we do we need to expose them. I'm hesitant to expose them because we don't guarantee that we'll keep them in future versions of that their content will keep the same format. |
Sorry for my poor written English.
Yes. I will print this in our own logger.
Arm requests will be generated by sdk and apiVersion will be overwritten in our lib. So, it is hard to tell which version of sdk is in use.
As long as I can tell which version the lib depends on, That's ok. |
You can tell because you build your package with the dependent module versions in your go.mod file. |
But I can't print it in logger.. |
I'm not following this enough. I think you know what version of the module you are taking a dependency on when you build your package and therefore, I think you can hard-code this version in your logging code. You do not REQUIRE that we make these constants public to accomplish your goal. While making these constants public might be convenient for you, it is inconvenient for us as we would now have to document them and maintain them in perpetuity. If I'm not following the problem you're trying to solve, then you have to really explain it to me in detail. Specifically, I need to know the various components that are part of the problem and which entity (the Go SDK, an immediate consumer of the SDK, a more distant consumer of the SDK, etc.) owns which component. I also need to understand how the components integrate with each other. |
Go builds dependency info into executables that you can parse with import "runtime/debug"
if bi, ok := debug.ReadBuildInfo(); ok {
for _, dep := range bi.Deps {
fmt.Printf("%s %s\n", dep.Path, dep.Version)
}
} Output
Does that work for you? |
Hi @MartinForReal. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue. |
@chlowell, this is cool and I had no idea about it! Great suggestion! |
Thanks! |
You're welcome! |
Feature Request
Expose track2 module name and version for tracing purpose
We need to add module info into trace context. But Module name and module version are not exposed to public.
e.g.
azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/constants.go
Line 12 in fb9b7a2
Do you think if it is feasible to expose those information? Thanks!
The text was updated successfully, but these errors were encountered: