Skip to content

feat(metrics): initialise MULTIPLEXED_METRIC_ROUTING_KEY for routing#19096

Open
harshit078 wants to merge 24 commits intogetsentry:developfrom
harshit078:routing-to-different-dsn
Open

feat(metrics): initialise MULTIPLEXED_METRIC_ROUTING_KEY for routing#19096
harshit078 wants to merge 24 commits intogetsentry:developfrom
harshit078:routing-to-different-dsn

Conversation

@harshit078
Copy link
Contributor

@harshit078 harshit078 commented Jan 29, 2026

Before submitting a pull request, please take a look at our
Contributing guidelines and verify:

  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).
  • Link an issue if there is one related to your pull request. If no issue is linked, one will be auto-generated and linked.

Closes #18913

What changed

  • implemented attribute-based routing for metrics
  • added MetricRoutingInfo with dsn and release as its field
  • added routing to MetricOptions and enabled captureMetric to inject routing info into attributes
  • similarly added routing to InternalCaptureMetricOptions
  • created _stripRoutingAttributes function which removes routing info before sending to sentry

@harshit078 harshit078 marked this pull request as ready for review February 2, 2026 12:05
@harshit078
Copy link
Contributor Author

Hi @chargome, the PR is ready to review. Thanks !

@Lms24 Lms24 requested a review from chargome February 4, 2026 09:05
Copy link
Member

@chargome chargome left a comment

Choose a reason for hiding this comment

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

Nice, thanks for opening the PR! I left some comments. Also, we definitely want to test this behaviour somehow in a browser integration test.

const container = Array.isArray(item) ? (item[1] as SerializedMetricContainer) : undefined;
const containerItems = container?.items;
if (containerItems) {
metric = containerItems[0];
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't this mean we always just pull the first metric?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes it would mean we pull the first metric. What I'm thinking now after your comment is that I can add a logic which will check if all metrics and route to same or multiple destinations. Whats your opinion ?

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

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.

Support routing metrics to different DSNs in MFE setup

2 participants