Skip to content
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 github.com/Azure/azure-sdk-for-go/sdk/internal/log package so that custom policy can print log #22052

Open
MartinForReal opened this issue Nov 24, 2023 · 6 comments
Assignees
Labels
Azure.Core customer-reported Issues that are reported by GitHub users external to the Azure organization. design-discussion An area of design currently under discussion and open to team and community feedback. feature-request This issue requires a new behavior in the product in order be resolved. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team
Milestone

Comments

@MartinForReal
Copy link
Contributor

MartinForReal commented Nov 24, 2023

Feature Request

In current design, custom policy which is out of github.com/Azure/azure-sdk-for-go/sdk module cannot import log package.
It is hard to debug policy without any log.

I'm wondering if we could expose this package for custom policy. Thanks!

@MartinForReal MartinForReal changed the title Expose github.com/Azure/azure-sdk-for-go/sdk/internal/log package so that custom policy can print log Expose github.com/Azure/azure-sdk-for-go/sdk/internal/log package so that custom policy can print log Nov 24, 2023
@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Nov 24, 2023
@jhendrixMSFT
Copy link
Member

If you just need access to the Event type it can be found in the azcore/log package.

https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/azcore/log/log.go#L15

@jhendrixMSFT jhendrixMSFT added Azure.Core needs-author-feedback Workflow: More information is needed from author to address the issue. and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Nov 27, 2023
Copy link

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.

@MartinForReal
Copy link
Contributor Author

I want to invoke log.write function in custom policy to print some info. It would be great if log package can be exposed to public.

@github-actions github-actions bot added needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team and removed needs-author-feedback Workflow: More information is needed from author to address the issue. labels Nov 27, 2023
@jhendrixMSFT
Copy link
Member

Thanks for clarifying.

Can we get more info about your scenario? The SDK's logging facility wasn't meant to be general-purpose, but for SDK authors.

@MartinForReal
Copy link
Contributor Author

A throttled policy was implemented in cloud provider. https://github.com/kubernetes-sigs/cloud-provider-azure/blob/master/pkg/azclient/policy/ratelimit/flowcontrol/throttle.go And I just want to print some logs. With these log entries, I can confirm that the request was not sent.

@RickWinter RickWinter added this to the 2024-10 milestone Aug 9, 2024
@RickWinter RickWinter added the feature-request This issue requires a new behavior in the product in order be resolved. label Aug 9, 2024
@RickWinter RickWinter modified the milestones: 2024-10, 2025-03 Jan 22, 2025
@RickWinter RickWinter added the design-discussion An area of design currently under discussion and open to team and community feedback. label Jan 27, 2025
@RickWinter RickWinter modified the milestones: 2025-03, Backlog Jan 27, 2025
@JeffreyRichter
Copy link
Member

Joel is correct.
The built-in log policy is for logging HTTP request/replies and is NOT intended to be a general purpose log mechanism. Customers initialize our log policy by passing a callback function to the log policy options when invoking a Client constructor. Your own policy can also take the same (or a different) log callback function in its ctor just as easily and then invoke whatever callback its initialized with. Use the same callback to unify all entries to a single log or use a different callback for a different log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure.Core customer-reported Issues that are reported by GitHub users external to the Azure organization. design-discussion An area of design currently under discussion and open to team and community feedback. feature-request This issue requires a new behavior in the product in order be resolved. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team
Projects
None yet
Development

No branches or pull requests

4 participants