Skip to content

Comments

Jacksonweber/enable customer sdk stats#2703

Closed
JacksonWeber wants to merge 9 commits intomicrosoft:betafrom
JacksonWeber:jacksonweber/enable-customer-sdk-stats
Closed

Jacksonweber/enable customer sdk stats#2703
JacksonWeber wants to merge 9 commits intomicrosoft:betafrom
JacksonWeber:jacksonweber/enable-customer-sdk-stats

Conversation

@JacksonWeber
Copy link

This pull request introduces SDK statistics tracking and notification enhancements to the Application Insights JavaScript SDK. The main changes add support for SDK stats telemetry, enable notification of retry/send/discard events, and update interfaces to support these features.

SDK Stats Tracking and Notification Enhancements:

  • SDK Stats Feature Integration:
    • Added constants and default config for the SdkStats feature, including versioning and flush interval. [1] [2]
    • Registered an SDK stats notification listener in AppInsightsSku, which tracks and flushes SDK stats telemetry at configured intervals.
    • Ensured SDK stats listener is properly unloaded and cleaned up during SDK shutdown/reset. [1] [2]
    • Updated imports to include ISdkStatsNotifCbk and createSdkStatsNotifCbk.
    • Added a private _sdkStatsListener property to manage the lifecycle of the stats listener.

Telemetry Notification Improvements:

  • Enhanced NotificationManager:

    • Introduced a new notification type eventsRetry, with corresponding constant and method in NotificationManager, to notify listeners when telemetry events are retried. [1] [2] [3] [4]
  • Sender Plugin Enhancements:

    • Updated the Sender plugin to:
      • Store the baseType of telemetry items in the internal storage payload for accurate stats mapping. [1] [2]
      • Notify listeners on events being discarded, successfully sent, or retried (including HTTP status code). [1] [2] [3] [4]
      • Added helper methods to extract minimal telemetry items from internal payloads and dispatch notifications.

These changes collectively improve observability of SDK operations, provide more granular notifications for telemetry processing, and lay the groundwork for accurate SDK statistics reporting.

for (var i = 0; i < items.length; i++) {
if (!_isSdkStatsMetric(items[i])) {
var t = _getTelType(items[i]);
bucket[t] = (bucket[t] || 0) + 1;

Check warning

Code scanning / CodeQL

Prototype-polluting assignment Medium

This assignment may alter Object.prototype if a malicious '__proto__' string is injected from
library input
.
for (var i = 0; i < items.length; i++) {
if (!_isSdkStatsMetric(items[i])) {
var t = _getTelType(items[i]);
bucket[t] = (bucket[t] || 0) + 1;

Check warning

Code scanning / CodeQL

Prototype-polluting assignment Medium

This assignment may alter Object.prototype if a malicious '__proto__' string is injected from
library input
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant