Skip to content

Capture action plugin metrics#971

Merged
zikaari merged 9 commits intomasterfrom
capture_action_plugin_metrics
Oct 18, 2023
Merged

Capture action plugin metrics#971
zikaari merged 9 commits intomasterfrom
capture_action_plugin_metrics

Conversation

@zikaari
Copy link
Copy Markdown
Contributor

@zikaari zikaari commented Oct 16, 2023

Just like how we capture metrics relating to performance of classic integrations, this patch now enables capturing of metrics related to action destinations as well.

@zikaari zikaari requested review from oscb and silesky October 16, 2023 22:50
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Oct 16, 2023

🦋 Changeset detected

Latest commit: 27ca0dd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@segment/analytics-next Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown
Contributor

@oscb oscb left a comment

Choose a reason for hiding this comment

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

just a very minor comment, every thing else looks good!

Comment thread packages/browser/src/plugins/remote-loader/index.ts Outdated

await this.action[methodName]!(transformedContext)
try {
ctx.stats.increment('analytics_js.action_plugin.invoke', 1, [
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.

This will let us easily aggregate these on datadog??? Sweet


await this.action[methodName]!(transformedContext)
} catch (error) {
ctx.stats.increment('analytics_js.action_plugin.invoke.error', 1, [
Copy link
Copy Markdown
Contributor

@silesky silesky Oct 17, 2023

Choose a reason for hiding this comment

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

We are repeating these strings / args . Can we save on bundle size through helper functions? Ditto elsewhere

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

gzip is extremely good at handling repeating strings, I've verified it - sometimes placing the strings inline yields a smaller size than storing it in a variable.

Copy link
Copy Markdown
Contributor

@silesky silesky Oct 17, 2023

Choose a reason for hiding this comment

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

Even so, I still think DRY would be an improvement here for the usual reasons (eg less code/ease of update)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's like this all across the codebase, we should refactor them all at once so that the declaration and usage is standardized all across, and not fragment it even further.

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.

Fair

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.

I see the benefit of storing in a variable more that we have 1 place to update/less chance of a typo/forgetting to update the value if we change it in the future. Won't block, but that would be my general guidance when we've got a string value that acts as a key in downstream.

@zikaari zikaari requested a review from silesky October 17, 2023 19:48
@@ -0,0 +1,5 @@
---
'@segment/analytics-next': minor
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.

Should this be a patch, since it's not a user-facing feature?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I saw it more as a "non-breaking enhancement" than a bug fix - so went with it

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.

Would vote for patch since it isn't a user-facing change to any API/API behavior.

@zikaari zikaari merged commit 2f1ae75 into master Oct 18, 2023
@zikaari zikaari deleted the capture_action_plugin_metrics branch October 18, 2023 22:35
@github-actions github-actions bot mentioned this pull request Oct 18, 2023
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.

4 participants