Skip to content

Telemetry: named TelemetryPayload builder with int/float support; gate all telemetry behind PLAYER_TELEMETRY_SUPPORT#118

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/insert-runtime-telemetry-events
Draft

Telemetry: named TelemetryPayload builder with int/float support; gate all telemetry behind PLAYER_TELEMETRY_SUPPORT#118
Copilot wants to merge 5 commits intomainfrom
copilot/insert-runtime-telemetry-events

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 25, 2026

Two issues addressed: all telemetry code was unconditionally compiled (pulling in <map> and logging headers everywhere), and sendEvent only accepted std::map<string,string> forcing std::to_string() noise at every call site with numeric values. Additionally, all call sites used anonymous inline initializer lists instead of named objects.

PlayerTelemetry.h

  • Entire implementation gated behind #ifdef PLAYER_TELEMETRY_SUPPORT; a no-op stub class compiles in the #else branch — no per-call #ifdef guards needed at call sites
  • Replaces the raw std::map<string,string> parameter with a new TelemetryPayload builder class exposing add() overloads for std::string, int, long, float, and double — numeric values are converted internally
  • sendEvent(name, TelemetryPayload) replaces sendEvent(name, map)
  • No-op TelemetryPayload stub in #else branch has matching add() signatures so all call sites compile unchanged in non-telemetry builds

CMakeLists.txt

  • CMAKE_PLAYER_TELEMETRY_SUPPORT option appends -DPLAYER_TELEMETRY_SUPPORT to LIBPLAYERGSTINTERFACE_DEFINES, following the same pattern as CMAKE_GST_SUBTEC_ENABLED

Call sites (6 files, 22 sites)

All anonymous {{"key", value}} inline map arguments replaced with explicit named TelemetryPayload objects. std::to_string() and redundant static_cast<int> on implicitly-promotable types (gushort, int32_t) removed.

// Before
PlayerTelemetry::sendEvent(TELEMETRY_EVENT_DRM_SESSION_INIT_FAILED,
    {{"reason", "empty_session_id"}, {"keyState", std::to_string(static_cast<int>(code))}});

// After
TelemetryPayload payload;
payload.add("reason", "empty_session_id");
payload.add("keyState", static_cast<int>(code));
PlayerTelemetry::sendEvent(TELEMETRY_EVENT_DRM_SESSION_INIT_FAILED, payload);

Files changed: InterfacePlayerRDK.cpp (10 sites), GstHandlerControl.cpp (1), drm/DrmSessionManager.cpp (6), drm/ocdm/opencdmsessionadapter.cpp (2), gst-plugins/drm/gst/gstcdmidecryptor.cpp (3).

Original prompt

Implement runtime telemetry event emission throughout the player interface.

  1. For each event in TelemetryMarkers.h, locate the corresponding place in the player logic (e.g., InterfacePlayerRDK.cpp) where the specific playback, media, error, lifecycle, or miscellaneous event actually occurs.
  2. Insert PlayerTelemetry::sendEvent(...) calls using the appropriate marker macro, providing additional key/value data where applicable (such as error reasons or track info).
  3. Use realistic payload contents based on event context (e.g., HTTP error code, track type/id, pipeline states, etc.).
  4. Ensure that a telemetry event is sent only when and where the actual event happens — never on simulation or stub execution.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: provide some telemetry event markers for this repo

Assistant: Here are some example telemetry event markers suitable for the rdkcentral/middleware-player-interface repository, especially considering it is a C++-heavy interface for media player components (like aamp) to interact with RDK middleware:

// Telemetry event markers for rdkcentral/middleware-player-interface

#pragma once

// Playback events
#define TELEMETRY_EVENT_PLAYBACK_STARTED    "PLAYBACK_STARTED"
#define TELEMETRY_EVENT_PLAYBACK_PAUSED     "PLAYBACK_PAUSED"
#define TELEMETRY_EVENT_PLAYBACK_RESUMED    "PLAYBACK_RESUMED"
#define TELEMETRY_EVENT_PLAYBACK_STOPPED    "PLAYBACK_STOPPED"
#define TELEMETRY_EVENT_PLAYBACK_COMPLETED  "PLAYBACK_COMPLETED"

// Media events
#define TELEMETRY_EVENT_BUFFERING_STARTED   "BUFFERING_STARTED"
#define TELEMETRY_EVENT_BUFFERING_ENDED     "BUFFERING_ENDED"
#define TELEMETRY_EVENT_SEEK_STARTED        "SEEK_STARTED"
#define TELEMETRY_EVENT_SEEK_COMPLETED      "SEEK_COMPLETED"

// Error events
#define TELEMETRY_EVENT_ERROR               "ERROR"
#define TELEMETRY_EVENT_DECODE_ERROR        "DECODE_ERROR"
#define TELEMETRY_EVENT_NETWORK_ERROR       "NETWORK_ERROR"

// Lifecycle events
#define TELEMETRY_EVENT_INITIALIZED         "INTERFACE_INITIALIZED"
#define TELEMETRY_EVENT_SHUTDOWN            "INTERFACE_SHUTDOWN"

// Miscellaneous
#define TELEMETRY_EVENT_EOS_DETECTED        "END_OF_STREAM_DETECTED"
#define TELEMETRY_EVENT_TRACK_SWITCHED      "TRACK_SWITCHED"

Usage:

  • Use these macros as keys when sending telemetry data.
  • If your implementation uses a specific telemetry API, these markers can be passed to the API to indicate specific events (e.g., logging or analytics).

Customization:

  • Add or remove markers based on the actual events your interface handles or requires in your environment.
  • If you use enums instead of macros, convert the strings to enum types to match your standards.

Would you like example C++ code integrating these markers with a logging/telemetry function?

User: pls check RDKEMW-13310 for added telemetry in InterfacePlayerRDK.cpp and implement similar telemetry event markers

Assistant: There are currently no telemetry event markers or telemetry code found in InterfacePlayerRDK.cpp within the rdkcentral/middleware-player-interface repository, according to a search for telemetry-related terms.

If you can provide the code or commit changes from RDKEMW-13310, I can help you implement similar telemetry event markers. Otherwise, if you have a different file or more details, please let me know!

User: https://github.com/rdkcentral/middleware-player-interface/tree/feature/RDKEMW-13310

Assistant: Here are telemetry event markers inspired by the actual implementation strategy used in InterfacePlayerRDK.cpp from feature/RDKEMW-13310:

  • The code defines and uses telemetry events such as "MW_PIPELINE_STATE_CHANGE_FAILURE" (see line ~1306) sent via a PlayerTelemetry2 instance with numeric and string fields, such as state transitions and element names.
  • This shows a key/value telemetry reporting pattern for element state failures and similar events.

You should implement event markers consistent with this usage as follows:

// Telemetry event markers for rdkcentral/middleware-player-interface

#pragma once

// Pipeline state change failures, matching deployed events
#define TELEMETRY_EVENT_PIPELINE_STATE_CHANGE_FAILURE "MW_PIPELINE_STATE_CHANGE_FAILURE"

// Playback events
#define TELEMETRY_EVENT_PLAYBACK_STARTED    "PLAYBACK_STARTED"
#define TELEMETRY_EVENT_PLAYBACK_PAUSED     "PLAYBACK_PAUSED"
#define TELEMETRY_EVENT_PLAYBACK_RESUMED    "PLAYBACK_RESUMED"
#define TELEMETRY_EVENT_PLAYBACK_STOPPED    "PLAYBACK_STOPPED"
#define TELEMETRY_EVENT_PLAYBACK_COMPLETED  "PLAYBACK_COMPLETED"

// Media events
#define TELEMETRY_EVENT_BUFFERING_STARTED   "BUFFERING_STARTED"
#define TELEMETRY_EVENT_BUFFERING_ENDED     "BUFFERING_ENDED"
#define TELEMETRY_EVENT_SEEK_STARTED        "SEEK_STARTED"
#define TELEMETRY_EVENT_SEEK_COMPLETED      "SEEK_COMPLETED"

// Error events
#define TELEMETRY_EVENT_ERROR               "ERROR"
#define TELEMETR...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

*This pull request was created from Copilot chat.*
>

<!-- START COPILOT CODING AGENT TIPS -->
---

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. [Learn more about Advanced Security.](https://gh.io/cca-advanced-security)

…rface

- Add TelemetryMarkers.h with macro definitions for all 17 telemetry event names
- Add PlayerTelemetry.h with sendEvent() overloads backed by MW_LOG_MIL
- Instrument InterfacePlayerRDK.cpp with 19 PlayerTelemetry::sendEvent() calls:
  lifecycle (init/shutdown), playback (started/paused/resumed/stopped/completed),
  buffering (started/ended), seek (started/completed), error (generic/network/decode),
  pipeline state change failure, EOS detected, and track switched

Co-authored-by: dp0000 <53818367+dp0000@users.noreply.github.com>
Agent-Logs-Url: https://github.com/rdkcentral/middleware-player-interface/sessions/568b6714-9c63-4663-9966-49cffd3749de
Copilot AI changed the title [WIP] Implement runtime telemetry event emission in player interface Add runtime telemetry event emission to InterfacePlayerRDK Mar 25, 2026
Copilot AI requested a review from dp0000 March 25, 2026 18:08
…l subsystems

- TelemetryMarkers.h: add 10 new markers for DRM/OCDM/HDCP/handler failures
- GstHandlerControl.cpp: emit HANDLER_TIMEOUT when waitForDone() times out
- drm/DrmSessionManager.cpp: emit DRM_HELPER_NOT_FOUND, DRM_PSSH_PARSE_FAILED,
  DRM_SESSION_CREATE_FAILED, and DRM_SESSION_INIT_FAILED (3 variants)
- drm/ocdm/opencdmsessionadapter.cpp: emit OCDM_SYSTEM_CREATE_FAILED and
  OCDM_SESSION_CREATE_FAILED with key system and error code payload
- gst-plugins/drm/gst/gstcdmidecryptor.cpp: emit HDCP_PROTECTION_FAILURE,
  HDCP_COMPLIANCE_FAILURE, and DECRYPT_FAILURE at threshold-breach points

Co-authored-by: dp0000 <53818367+dp0000@users.noreply.github.com>
Agent-Logs-Url: https://github.com/rdkcentral/middleware-player-interface/sessions/00222964-3d85-4630-8c0d-e2154ccb0f98
Copilot AI changed the title Add runtime telemetry event emission to InterfacePlayerRDK Add runtime telemetry emission across player, DRM, OCDM, HDCP, and handler subsystems Mar 25, 2026
PlayerTelemetry.h: split into two #ifdef PLAYER_TELEMETRY_SUPPORT branches
- Active branch: includes <map>, MW_LOG_MIL emission (compiled when flag set)
- No-op stub branch: empty inline sendEvent() overloads (zero overhead when
  flag absent); call sites need no per-call #ifdef guards in either case

CMakeLists.txt: add CMAKE_PLAYER_TELEMETRY_SUPPORT option that appends
-DPLAYER_TELEMETRY_SUPPORT to LIBPLAYERGSTINTERFACE_DEFINES, following the
same pattern used by CMAKE_GST_SUBTEC_ENABLED and similar feature flags

Co-authored-by: dp0000 <53818367+dp0000@users.noreply.github.com>
Agent-Logs-Url: https://github.com/rdkcentral/middleware-player-interface/sessions/22158a4c-70d9-474e-9d28-e435b129b1de
Copilot AI changed the title Add runtime telemetry emission across player, DRM, OCDM, HDCP, and handler subsystems Add critical-error telemetry across DRM, OCDM, HDCP, and handler subsystems; gate behind PLAYER_TELEMETRY_SUPPORT Mar 26, 2026
…ble support

PlayerTelemetry.h:
- Add TelemetryPayload builder class with add() overloads for std::string,
  int, long, float, double — numeric values are auto-converted to string so
  call sites need no std::to_string()
- Replace sendEvent(name, map) with sendEvent(name, TelemetryPayload)
- Add matching no-op TelemetryPayload stub in #else branch (non-telemetry
  builds compile and link without change)

All inline {{"key", value}} map arguments replaced with named TelemetryPayload
objects in:
  InterfacePlayerRDK.cpp (10 call sites)
  GstHandlerControl.cpp  (1 call site)
  drm/DrmSessionManager.cpp (6 call sites)
  drm/ocdm/opencdmsessionadapter.cpp (2 call sites)
  gst-plugins/drm/gst/gstcdmidecryptor.cpp (3 call sites)

Redundant std::to_string() and unnecessary static_cast<int> removed at all
affected call sites.

Co-authored-by: dp0000 <53818367+dp0000@users.noreply.github.com>
Agent-Logs-Url: https://github.com/rdkcentral/middleware-player-interface/sessions/0277cd52-920d-4e51-915b-f4020683330e
Copilot AI changed the title Add critical-error telemetry across DRM, OCDM, HDCP, and handler subsystems; gate behind PLAYER_TELEMETRY_SUPPORT Telemetry: named TelemetryPayload builder with int/float support; gate all telemetry behind PLAYER_TELEMETRY_SUPPORT Mar 26, 2026
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.

2 participants