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

🪟🔧 AppMonitoringService for custom datadog RUM events #19287

Merged
merged 8 commits into from
Nov 11, 2022

Conversation

josephkmh
Copy link
Contributor

What

Adds a monitoring service and hook that allows us to track custom RUM events from the frontend. This is useful for logging when certain code paths are hit, like edge cases or unexpected application states. By logging these events in datadog, we are able to query them and set up monitoring/alerts if thresholds are exceeded.

How

Adds an ApplicationMonitoringService that exposes two methods:

const { trackAction, trackError } = useAppMonitoringService();

trackAction: (actionCode: AppActionCodes, context?: Record<string, unknown>) => void;
Sends a RUM event of type action to datadog

trackError: (error: Error, context?: Record<string, unknown>) => void;
Sends a RUM event of type error to datadog

Both trackAction and trackError can be called with an optional second parameter, context, which is a JSON blob of any other relevant data to log.

In case the datadog RUM SDK is not initialized, trackAction and trackError will log messages in the browser console via console.debug.

Recommended reading order

  1. AppMonitoringService.tsx for the implementation
  2. LDExperimentService.tsx for an example usage: logging when LaunchDarkly takes too long to respond, and fall back to rendering the app without any Launch Darkly feature/experiment flags.

@github-actions github-actions bot added area/platform issues related to the platform area/frontend Related to the Airbyte webapp labels Nov 10, 2022
@josephkmh josephkmh changed the title 🪟🔧 [DRAFT] AppMonitoringService for custom RUM events 🪟🔧 [DRAFT] AppMonitoringService for custom datadog RUM events Nov 10, 2022
@josephkmh josephkmh marked this pull request as ready for review November 11, 2022 11:30
@josephkmh josephkmh requested a review from a team as a code owner November 11, 2022 11:30
@josephkmh josephkmh changed the title 🪟🔧 [DRAFT] AppMonitoringService for custom datadog RUM events 🪟🔧 AppMonitoringService for custom datadog RUM events Nov 11, 2022
Copy link
Collaborator

@timroes timroes left a comment

Choose a reason for hiding this comment

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

Code LGTM. Have not tested locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend Related to the Airbyte webapp area/platform issues related to the platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants