platformplatform / PlatformPlatform

Alpha state. A platform designed for building enterprise-grade, multi-tenant products using Azure, .NET, React, TypeScript, Infrastructure as Code, etc.
https://platformplatform.github.io
MIT License
253 stars 26 forks source link

Enhance telemetry tracking with geo data and align property naming with OpenTelemetry standards #619

Closed tjementum closed 1 week ago

tjementum commented 1 week ago

Summary & Motivation

Enhance telemetry tracking for better accuracy and consistency across the YARP AppGateway, Application Insights, and OpenTelemetry.

The YARP AppGateway has been updated to correctly forward the client’s IP address, allowing Application Insights telemetry (events and page views) and OpenTelemetry requests to track the correct geo-location data, including city and country.

When saving OpenTelemetry request data to Application Insights, the built-in authenticated user ID is now set. Since OpenTelemetry cannot set the built-in Application Insights properties for UserID and TenantId, these are added as custom properties across PageViews and CustomEvents, ensuring that all telemetry data consistently includes these values.

Custom property naming has been standardized to align with OpenTelemetry conventions. Properties such as user_UserId, user_UserRole, user_Local, event_RetryCount, etc., have been renamed to follow the OpenTelemetry format, e.g., user.id, tenant.id, user.local, user.role, and event.retry_count.

Finally, the Application Insights Provider in the Single Page Application (SPA) has been configured to correctly set the Authenticated User Id and Tenant Id, ensuring accurate tracking for PageViews and other telemetry data.

Downstream projects

Change naming on custom properties on track to use the OpenTelemetry format

Checklist

linear[bot] commented 1 week ago

PP-244 Track custom properties in OpenTelemetry

sonarcloud[bot] commented 1 week ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
1.3% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud