Skip to content

Enhance telemetry configuration with dynamic properties and username#2339

Merged
dividedmind merged 2 commits into
mainfrom
feat/telemetry-improvements
Oct 28, 2025
Merged

Enhance telemetry configuration with dynamic properties and username#2339
dividedmind merged 2 commits into
mainfrom
feat/telemetry-improvements

Conversation

@dividedmind

Copy link
Copy Markdown
Collaborator

This pull request enhances the telemetry client by improving how default properties are set and merged, especially for different backend types. It ensures that environment-provided client info is included, and adds automatic user identification for Splunk backends. The tests have been updated to verify these behaviors.

Telemetry property handling improvements:

  • The buildDefaultConfiguration function now merges default telemetry properties—including OS, architecture, hostname, and source—with any provided properties, and automatically adds the username for Splunk backends. It also merges client info from the APPMAP_TELEMETRY_PROPERTIES environment variable.
  • The TelemetryConfiguration type now includes an optional properties field to support the new merged property handling.
  • The telemetry client uses the merged properties in all events, ensuring consistent and comprehensive property reporting.

Testing and validation:

  • The tests mock the OS user info and verify that the username is only included for Splunk backends, and that environment-provided client info is correctly merged into telemetry properties. [1] [2] [3] [4]
  • Test setup improvements include explicit backend configuration and isolation of environment variables for reliable test execution. [1] [2]

This allows passing information such as IDE version from the caller.

Also, always add username info when telemetry backend is splunk.
Splunk is used in controlled environments where privacy is less
important but the ability to track usage per-user can be.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the telemetry client by improving default property handling and adding automatic user identification for Splunk backends. The changes centralize property management in buildDefaultConfiguration and ensure environment-provided client info is properly merged.

Key Changes:

  • Added dynamic property merging with default system properties (OS, arch, hostname) and username for Splunk backends
  • Modified buildDefaultConfiguration to handle property merging from environment variables and backend-specific logic
  • Updated tests to verify username inclusion for Splunk backends and environment variable property merging

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/telemetry/tests/client.spec.ts Added tests for username inclusion in Splunk backend and environment variable property merging; mocked os.userInfo()
packages/telemetry/src/types.ts Added optional properties field to TelemetryConfiguration type
packages/telemetry/src/client.ts Centralized property handling in buildDefaultConfiguration with backend-specific logic; removed inline property construction and flush() call

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/telemetry/src/client.ts
@dividedmind dividedmind merged commit df7c960 into main Oct 28, 2025
29 checks passed
@dividedmind dividedmind deleted the feat/telemetry-improvements branch October 28, 2025 19:24
@appland-release

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version @appland/telemetry-v1.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants