Skip to content
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

feat(MM-61865): send network request telemetry data to the server #8436

Merged

Conversation

rahimrahman
Copy link
Contributor

@rahimrahman rahimrahman commented Dec 19, 2024

Summary

Add sending network requests telemetry data to the server

Ticket Link

https://mattermost.atlassian.net/browse/MM-61865

Checklist

  • Added or updated unit tests (required for all new features)
  • Has UI changes
  • Includes text changes and localization file updates
  • Have tested against the 5 core themes to ensure consistency between them.
  • Have run E2E tests by adding label E2E iOS tests for PR.

Device Information

This PR was tested on:
iPhone 15 (17.4)

Screenshots

 PASS  app/managers/performance_metrics_manager/index.test.ts
  performance_metrics_manager
    load metrics
      ✓ only load on target (19 ms)
      ✓ only register load once (5 ms)
      ✓ retry if the mark is not yet present (5 ms)
      ✓ fail graciously if no measure is set (12 ms)
    app state changes
      ✓ forces send on app state change to inactive, or anything other than active (5 ms)
    time to interaction
      ✓ measures time to interaction correctly (1 ms)
      ✓ handles missing TTI mark gracefully
    network request metrics
      ✓ collects network request metrics (10 ms)
    other metrics
      ✓ do not send metrics when we do not start them (7 ms)
      ✓ send metric after it has been started (6 ms)
      ✓ a second end metric does not generate a second measure (11 ms)
      ✓ different metrics do not interfere (6 ms)
      ✓ metrics to different servers do not interfere (10 ms)


=============================== Coverage summary ===============================
Statements   : 98% ( 49/50 )
Branches     : 92.85% ( 13/14 )
Functions    : 92.85% ( 13/14 )
Lines        : 97.91% ( 47/48 )
================================================================================
Test Suites: 1 passed, 1 total
Tests:       13 passed, 13 total

was

=============================== Coverage summary ===============================
Statements   : 82.5% ( 33/40 )
Branches     : 71.42% ( 10/14 )
Functions    : 72.72% ( 8/11 )
Lines        : 84.21% ( 32/38 )
================================================================================
 PASS  app/client/rest/tracking.test.ts
  ClientTracking
    ✓ should set bearer token (3 ms)
    ✓ should set CSRF token (2 ms)
    ✓ should get request headers (1 ms)
    ✓ should initialize and track group data
    ✓ should increment and decrement request count (26 ms)
    ✓ should handle request completion (1 ms)
    ✓ should clear completion timer (1 ms)
    ✓ should check if all requests are completed (1 ms)
    ✓ should send telemetry event
    ✓ should build request options
    ✓ should perform fetch with tracking (3 ms)
    ✓ should handle fetch errors (16 ms)
    ✓ should handle non-ok response with error details (3 ms)
    ✓ should handle non-ok response without error details (1 ms)
    ✓ should handle response with bearer token header
    ✓ should handle response with lowercase bearer token header (1 ms)
    ✓ should call increment and decrement the same number of times as doFetchWithTracking, and handleRequestCompletion only once (510 ms)
    ✓ should handle invalid HTTP method (2 ms)
    ✓ should handle server version changes without cache control (2 ms)
    ✓ should not update server version when cache control present (7 ms)
    ✓ should handle zero transfer time in speed calculation (1 ms)
    ✓ should track duplicate requests correctly and log duplicate details (303 ms)


=============================== Coverage summary ===============================
Statements   : 93.5% ( 144/154 )
Branches     : 82.55% ( 71/86 )
Functions    : 100% ( 29/29 )
Lines        : 93.05% ( 134/144 )
================================================================================
Test Suites: 1 passed, 1 total

was:

 PASS  app/client/rest/tracking.test.ts
  ClientTraking
    ✓ should set bearer token (3 ms)
    ✓ should set CSRF token
    ✓ should get request headers (1 ms)
    ✓ should initialize and track group data
    ✓ should increment and decrement request count (9 ms)
    ✓ should handle request completion (1 ms)
    ✓ should clear completion timer (1 ms)
    ✓ should check if all requests are completed
    ✓ should send telemetry event (1 ms)
    ✓ should build request options
    ✓ should perform fetch with tracking (2 ms)
    ✓ should handle fetch errors (14 ms)
    ✓ should call increment and decrement the same number of times as doFetchWithTracking, and handleRequestCompletion only once (306 ms)
    ✓ should track duplicate requests correctly and log duplicate details (104 ms)


=============================== Coverage summary ===============================
Statements   : 87.61% ( 92/105 )
Branches     : 69.44% ( 50/72 )
Functions    : 100% ( 19/19 )
Lines        : 87.12% ( 88/101 )
================================================================================
Test Suites: 1 passed, 1 total
Tests:       14 passed, 14 total
Snapshots:   0 total
Time:        3.082 s
Ran all test suites matching /app\/client\/rest\/tracking.test.ts/i.

Release Note


@mm-cloud-bot mm-cloud-bot added kind/feature Categorizes issue or PR as related to a new feature. release-note labels Dec 19, 2024
@rahimrahman rahimrahman requested review from enahum, larkox and isacikgoz and removed request for larkox December 20, 2024 15:01
@rahimrahman
Copy link
Contributor Author

This PR merges into @enahum PR, so no testing required on this PR.

@rahimrahman rahimrahman merged commit 02e41da into request-metrics-improvements Dec 24, 2024
6 checks passed
@rahimrahman rahimrahman deleted the feat/MM-61865-send-telemetry-data branch December 24, 2024 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants