Skip to content

fix: analytics#35

Merged
dwjanus merged 6 commits intomainfrom
dwj/more-analytics
Jan 23, 2026
Merged

fix: analytics#35
dwjanus merged 6 commits intomainfrom
dwj/more-analytics

Conversation

@dwjanus
Copy link
Collaborator

@dwjanus dwjanus commented Jan 21, 2026

Changes

  • add frontend property to bugsnag
  • add frontend property directly to datadog events
  • implement enrichment plugin for amplitude to add event property frontend

Issue

https://linear.app/dydx/issue/ENG-1600/fix-bonk-logging-issue

@dwjanus dwjanus requested a review from jaredvu January 21, 2026 16:35
@dwjanus dwjanus requested a review from a team as a code owner January 21, 2026 16:35
@vercel
Copy link

vercel bot commented Jan 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
project-pup Ready Ready Preview, Comment Jan 21, 2026 4:35pm

Request Review

Comment on lines 41 to 42
setup: function() { return undefined; },
execute: function(event) {
Copy link

Choose a reason for hiding this comment

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

don't these need to be async functions?

https://amplitude.com/docs/sdks/sdk-plugins#enrichment-plugins

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yea i think youre right

Comment on lines 38 to 39
var enrichFrontendPlugin = {
name: 'enrich-frontend-plugin',
Copy link

Choose a reason for hiding this comment

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

use more descriptive name i.e. appendBonkPlugin

// Enrichment plugin to add 'frontend' to ALL events (including automatic ones)
var enrichFrontendPlugin = {
name: 'enrich-frontend-plugin',
type: 'enrichment',
Copy link

Choose a reason for hiding this comment

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

confirm this is what PluginType.ENRICHMENT's value is

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it is however it defaults to enrichment type so removing

Comment on lines +27 to +29
datadogLogs.setGlobalContextProperty('frontend', FRONTEND);
datadogLogs.setGlobalContextProperty('dd-client-token', CLIENT_TOKEN);
datadogLogs.setGlobalContextProperty('instance-id', instanceId);
Copy link

Choose a reason for hiding this comment

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

What is the difference between the Global and non-Global context property?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The difference is when they are executed, global sets the context pre-init and regular is called synchronously after init. This is really just a belt and suspenders incase we were setting the context async before the SDK was fully initialized

// Enrichment plugin to add 'frontend' to ALL events (including automatic ones)
var appendBonkPlugin = {
name: 'append-bonk-plugin',
execute: async function(event) {
Copy link

Choose a reason for hiding this comment

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

don't you also need setup?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

in the docs they say its optional and the setup that was there didnt do anything so i dont think we need it.
for reference see Amplitude browser sdk plugins and scroll down to the table in the Create a custom plugin section

@dwjanus dwjanus requested a review from jaredvu January 22, 2026 19:41
@dwjanus dwjanus merged commit 7c62c98 into main Jan 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants