-
Notifications
You must be signed in to change notification settings - Fork 167
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
track telemetry on api requests #3355
Conversation
src/Microsoft.Health.Dicom.Api/Features/Telemetry/HttpDicomTelemetryClient.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Health.Dicom.Api/Features/Telemetry/DicomTelemetry.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Health.Dicom.Api/Features/Telemetry/HttpDicomTelemetryClient.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Health.Dicom.Api/Logging/DicomTelemetryInitializer.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Health.Dicom.Api/Logging/DicomTelemetryInitializer.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Health.Dicom.Api/Registration/DicomServerServiceCollectionExtensions.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Health.Dicom.Core/Extensions/DicomTelemetryClientExtensions.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Health.Dicom.Core/Features/Telemetry/IDicomTelemetryClient.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Health.Dicom.SqlServer/Features/Schema/Model/V56.Generated.cs
Outdated
Show resolved
Hide resolved
foreach ((string key, string value) in properties) | ||
{ | ||
if (requestTelemetry.Properties.ContainsKey(key)) | ||
requestTelemetry.Properties["DuplicateDimension"] = bool.TrueString; |
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.
why do we need this DuplicateDimension
? Are you expecting any of the dimension to be already present?
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.
yes - it's not guaranteed that we'd get a single one so we have to carefully filter out and not try to add duplicates. We're guaranteed at least one, but could have duplicates. We follow the same pattern elsewhere
public void Initialize(ITelemetry telemetry) | ||
{ | ||
if (telemetry is RequestTelemetry requestTelemetry) | ||
AddPropertiesFromHttpContextItems(requestTelemetry); |
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.
Will this step gets executed for all the health check requests too?
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.
yes - I don't see any reason to treat healthchecks differently, it can cause confusion when we go do our queries. Do you foresee issues with treating all requests the same?
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.
That is just some extra unwanted processing, since health check happens every 15-30 seconds. You can keep it if you need these columns to be populated in RequestTelemetry for health checks.
public void Initialize(ITelemetry telemetry) | ||
{ | ||
if (telemetry is RequestTelemetry requestTelemetry) | ||
AddPropertiesFromHttpContextItems(requestTelemetry); |
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.
That is just some extra unwanted processing, since health check happens every 15-30 seconds. You can keep it if you need these columns to be populated in RequestTelemetry for health checks.
Description
Start tracking additional telemetry api requests:
min, max and total bytes and instance count.
Example of how it shows up in telemetry:
![image](https://private-user-images.githubusercontent.com/69813504/303177095-c9040d60-7c17-4eeb-b9ca-dd46296699ee.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkxMTQ5NjUsIm5iZiI6MTcxOTExNDY2NSwicGF0aCI6Ii82OTgxMzUwNC8zMDMxNzcwOTUtYzkwNDBkNjAtN2MxNy00ZWViLWI5Y2EtZGQ0NjI5NjY5OWVlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIzVDAzNTEwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg5ZTFlNDVmZTY3MmJmMTBhNGFhMjEyYzFmOTQyYTcxOGNjODFiODZhNGFlNmE4MTdiMDNlZjJkMzNjMzcxMGUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.JM832CfWRqHX_4U-7mLng-GjyZ6QiTBCbTE26LVHTfE)
Related issues
Addresses [AB#105723].
Testing
Describe how this change was tested.