-
Notifications
You must be signed in to change notification settings - Fork 413
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
Add request count and duration telemetry #3022
base: dev
Are you sure you want to change the base?
Conversation
src/Microsoft.IdentityModel.Logging/IdentityModelTelemetryUtil.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Logging/IdentityModelTelemetryUtil.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Logging/IdentityModelTelemetryUtil.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
.../Microsoft.IdentityModel.Protocols.OpenIdConnect.Tests/ConfigurationManagerTelemetryTests.cs
Outdated
Show resolved
Hide resolved
.../Microsoft.IdentityModel.Protocols.OpenIdConnect.Tests/ConfigurationManagerTelemetryTests.cs
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Logging/IdentityModelTelemetryUtil.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.JsonWebTokens/JsonWebTokenHandler.ValidateToken.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Logging/ConfigurationManagerTelemetryInstrumentation.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Asking for laying changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 7 out of 22 changed files in this pull request and generated no comments.
Files not reviewed (15)
- build/dependencies.props: Language not supported
- build/dependenciesTest.props: Language not supported
- src/Microsoft.IdentityModel.JsonWebTokens/InternalAPI.Unshipped.txt: Language not supported
- src/Microsoft.IdentityModel.Logging/Microsoft.IdentityModel.Logging.csproj: Language not supported
- src/Microsoft.IdentityModel.Protocols/InternalAPI.Unshipped.txt: Language not supported
- src/Microsoft.IdentityModel.Tokens/InternalAPI.Unshipped.txt: Language not supported
- src/System.IdentityModel.Tokens.Jwt/InternalAPI.Unshipped.txt: Language not supported
- test/Microsoft.IdentityModel.Logging.Tests/Microsoft.IdentityModel.Logging.Tests.csproj: Language not supported
- test/Microsoft.IdentityModel.Protocols.OpenIdConnect.Tests/Microsoft.IdentityModel.Protocols.OpenIdConnect.Tests.csproj: Language not supported
- src/Microsoft.IdentityModel.JsonWebTokens/JsonWebTokenHandler.ValidateToken.cs: Evaluated as low risk
- src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs: Evaluated as low risk
- src/Microsoft.IdentityModel.Protocols/InternalsVisibleTo.cs: Evaluated as low risk
- src/Microsoft.IdentityModel.Tokens/Telemetry/ITelemetryInstrumentation.cs: Evaluated as low risk
- src/Microsoft.IdentityModel.Tokens/Telemetry/IdentityModelTelemetry.cs: Evaluated as low risk
- src/Microsoft.IdentityModel.Tokens/Telemetry/TelemetryConstants.cs: Evaluated as low risk
Comments suppressed due to low confidence (2)
src/System.IdentityModel.Tokens.Jwt/JwtSecurityTokenHandler.cs:893
- Ensure that
validationParameters.ConfigurationManager.MetadataAddress
is not null or empty before logging it.
_telemetryClient.IncrementConfigurationRefreshRequestCounter(
src/Microsoft.IdentityModel.Tokens/Telemetry/TelemetryInstrumentation.cs:48
- [nitpick] The method name 'RecordConfigurationRetrievalDurationHistogram' is too long and could be simplified to 'RecordRetrievalDuration' for better readability.
IdentityModelTelemetry.RecordConfigurationRetrievalDurationHistogram(durationInMilliseconds, tagList);
src/Microsoft.IdentityModel.Tokens/Telemetry/TelemetryInstrumentation.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Show resolved
Hide resolved
@@ -32,6 +32,10 @@ | |||
</None> | |||
</ItemGroup> | |||
|
|||
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' or '$(TargetFramework)' == 'netstandard2.0' "> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reference should be in the assembly where the types are used.
Currently this is M.IM.Tokens, which includes this reference, which allows the project to build.
I think the telemetry stuff should be in M.IM.Logging.
src/Microsoft.IdentityModel.Tokens/Telemetry/IdentityModelTelemetry.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Tokens/Telemetry/ITelemetryInstrumentation.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some naming.
Code should live in assembly where dependencies are included.
Why do we need an interface?
src/Microsoft.IdentityModel.Tokens/Telemetry/TelemetryConstants.cs
Outdated
Show resolved
Hide resolved
|
||
namespace Microsoft.IdentityModel.Tokens.Telemetry | ||
{ | ||
internal class IdentityModelTelemetry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I would rename TelemetryInstrumentation to TelemetryClient and merge this class into it to simplify the logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As more telemetry gets added, this class and TelemetryClient will grow a lot and I would rather keep them separate and focused in anticipation of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. My underlying feeling behind the comment was that it's a bit unclear at first glance what the purpose and the difference between the two classes is. Looks like TelemetryInstrumentation prepares the data and IdentityModelTelemetry actually pushes the data. At the very least, I suggest adding class comments to clarify the purpose. And also maybe renaming the class to make it clearer (like TelemetryRecorder, or Uploader or something?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood. I'll add some comments to clarify and think about the name a bit more.
src/Microsoft.IdentityModel.Tokens/Telemetry/TelemetryInstrumentation.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Tokens/Telemetry/TelemetryConstants.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenHandlerTelemetryTests.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Tokens/Telemetry/IdentityModelTelemetry.cs
Outdated
Show resolved
Hide resolved
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
src/Microsoft.IdentityModel.Tokens/Telemetry/IdentityModelTelemetry.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Tokens/Telemetry/TelemetryClient.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Keegan <Keegan.Caruso@microsoft.com>
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest putting telemetry code in M.IM.Logging assembly.
Addresses client telemetry repair item
Add counter for get configuration requests and histogram for total duration of the same requests.