Skip to content

Add API for sending exception data#238

Merged
vijayupadya merged 5 commits intomainfrom
vijayu/updateDist
Feb 7, 2026
Merged

Add API for sending exception data#238
vijayupadya merged 5 commits intomainfrom
vijayu/updateDist

Conversation

@vijayupadya
Copy link
Contributor

Add API for sending exception data

@vijayupadya vijayupadya added this to the February 2026 milestone Feb 5, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a public API for sending exception telemetry (bypassing opt-in checks) and wires it through the telemetry sender/client abstraction so Application Insights can emit real ExceptionData when supported.

Changes:

  • Extend the telemetry client abstraction with optional logException and use it from BaseTelemetrySender.sendErrorData when available.
  • Add sendDangerousTelemetryException(...) to the reporter (and update public typings/docs).
  • Refactor App Insights event property preparation and bump package version to 1.5.0.

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/common/baseTelemetrySender.ts Adds logException support and changes error fallback payload shaping.
src/common/baseTelemetryReporter.ts Adds sendDangerousTelemetryException(...) API and routes it through the sender.
src/common/appInsightsClientFactory.ts Implements logException and refactors event data preparation/merging.
dist/telemetryReporter.d.ts Exposes new API in public typings.
README.md Documents new “Dangerous Methods” section and updates version gate.
package.json Version bump to 1.5.0.
package-lock.json Lockfile version bump alignment.
Comments suppressed due to low confidence (1)

src/common/baseTelemetrySender.ts:88

  • sendErrorData no longer preserves the documented/previous behavior where data can be either a SenderData object or a plain properties bag. In the fallback branch you currently treat data as SenderData and only read senderData.properties, so calls like sendErrorData(err, { prop1: 1 }) will drop prop1 entirely (and existing unit tests expect those keys to be included). Consider normalizing data first: if it has a properties field use that, otherwise treat data itself as the properties object, then merge in the standard { name, message, stack } fields.
			// Fallback for clients without exception support (e.g., 1DS)
			const errorData = { stack: exception.stack, message: exception.message, name: exception.name };
			const senderData = data as SenderData | undefined;
			const errorProperties = senderData?.properties ?? {};
			const fallbackData: SenderData = {
				properties: { ...errorProperties, ...errorData },
				measurements: senderData?.measurements,
				tagOverrides: senderData?.tagOverrides
			};

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

@vijayupadya vijayupadya marked this pull request as ready for review February 7, 2026 00:01
@vijayupadya vijayupadya merged commit 4aa3d4d into main Feb 7, 2026
7 checks passed
@vijayupadya vijayupadya deleted the vijayu/updateDist branch February 7, 2026 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants