Skip to content

feat(user-action): add callback function to create custom attributes in user action logs#358

Open
ssakhamu wants to merge 1 commit into
open-telemetry:mainfrom
ssakhamu:feature/custom-attributes-useraction
Open

feat(user-action): add callback function to create custom attributes in user action logs#358
ssakhamu wants to merge 1 commit into
open-telemetry:mainfrom
ssakhamu:feature/custom-attributes-useraction

Conversation

@ssakhamu

@ssakhamu ssakhamu commented Jul 20, 2026

Copy link
Copy Markdown

Which problem is this PR solving?

In other instrumentation packages (navigation, web-vitals, etc), the applyCustomLogRecordData hook allows custom attributes to be attached to logs. This hook does not exist in the user-action instrumentation; this change adds this hook into the user-action instrumentation with the appropriate tests. The goal is to provide consistency in adding custom attributes to any logs generated across instrumentation packages.

Short description of the changes

  • adds the applyCustomLogRecordData hook to UserActionInstrumentationConfig
  • safely executes this hook on the generated log record in the event of a click
  • tests the success and failure cases of the hook

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • if the applyCustomLogRecordData hook is present in the config passed into UserActionInstrumentation, ensure that the custom attributes it creates are in the log record
  • if the applyCustomLogRecordData hook throws an error, ensure that the user action log is still emitted and the error is logged via diagnostics logger

These two tests are in packages/instrumentation/src/user-action/instrumentation.test.ts.

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

@ssakhamu
ssakhamu requested a review from a team as a code owner July 20, 2026 17:01
@linux-foundation-easycla

linux-foundation-easycla Bot commented Jul 20, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: ssakhamu / name: Sai Sakhamuri (289ded1)

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