[Feature Request] Improving Microsoft.IdentityModel Observability
See original GitHub issueImproving Microsoft.IdentityModel Observability
There have been some internal asks for Microsoft.IdentityModel and dependent libraries to offer a better observability surface. Currently logging is possible but good hooks for metrics and thus alerting aren’t as readily available.
Observability areas to consider
- Logging signals to monitor
- Additional logs that can clarify behavior for consumers
- Metrics/Counters which can hopefully represent some dimensional slices
- System Resources to Monitor
- While the library won’t be able to monitor its own system resource usage, it may be able to emit information that will allow consumers to better correlate operations with resource consumption.
- Anything which could assist in making Safe Deployment Practices more straightforward for services which consume the library
- Alerting
- Addition of metrics/counters will likely make this easier however anything else that can make alerting easier should be considered
Areas of focus for observability
Some metrics/counters around time taken in validation and its dependencies (crypto calls etc.) as well as information about internal caching crypto cache/LRU info.
Means of communicating the logs/metrics
Microsoft.IdentityModel.Tokens.CallContext
would appear the most promising place since it already contains the log collection.
Another possibility would be to extend scenario specific return values, e.g. TokenValidationResult
so they could be decorated with metrics/logs specific to the scenario. I’m currently partial to using CallContext
.
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (9 by maintainers)
Top Results From Across the Web
New Feature Requests - Microsoft Community Hub
Is there a mechanism for requesting new features in Azure ATP?
Read more >ASP.NET Core updates in .NET 8 Preview 6
NET 8 Preview 6 is now available and includes many great new improvements to ASP.NET Core. Here's a summary of what's new in...
Read more >Observability in cloud monitoring - Azure
Gain an understanding of how observability helps drive maturity in monitoring and help you understand the behavior of your services running ...
Read more >How can I leave a feature request or feedback on ...
Let us know what's working well, if there are problems with Outlook, or if you have ideas about new functionality that would improve...
Read more >Data observability - Cloud Adoption Framework
DataOps has been consistently improving data reliability and performance by automating data quality tests (unit, functional, and integration).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@TimHannMSFT thank you for reaching out!
One of the biggest complaints I have with IdentityModel regarding logging is the fact that the error messages became useless OOTB since the introduction of the PII protection (that is enabled by default). Messages like
IDX10205: Issuer validation failed. Issuer: 'System.String'. Did not match: validationParameters.ValidIssuer: 'System.String' or validationParameters.ValidIssuers: 'System.String'
are cryptic for users trying to debug them. It’s a huge source of bug reports for libraries built on top of IdentityModel, like OpenIddict.Potential ways to improve that:
ShowPII
property. I’d recommend making the exception messages more explicit about this option.IHostEnvironment.EnvironmentName
indicates a development environment.It’s a start. I think some visual changes like those suggested above would help make this more understandable.
https://aka.ms/IdentityModel/PII should also give an example of an error message with PII on vs off so people understand what to expect.