Skip to content

fix(metrics): disambiguate relationship metrics with source/target labels#2386

Merged
jychp merged 2 commits intomasterfrom
jeremy/metrics-relationship-label-disambiguation
Feb 13, 2026
Merged

fix(metrics): disambiguate relationship metrics with source/target labels#2386
jychp merged 2 commits intomasterfrom
jeremy/metrics-relationship-label-disambiguation

Conversation

@jychp
Copy link
Collaborator

@jychp jychp commented Feb 13, 2026

Type of change

  • Bug fix (non-breaking change that fixes an issue)

Summary

Relationship labels like RESOURCE repeat across 425+ schemas (e.g. EC2Instance->AWSAccount, S3Bucket->AWSAccount, AzureSubnet->AzureSubscription), making the current metric relationship.resource.loaded useless for distinguishing what was actually loaded.

This changes the load_matchlinks() metric to include source and target node labels:

Before: relationship.{rel_label}.loaded (e.g. relationship.resource.loaded)
After: relationship.{src}.{rel}.{tgt}.loaded (e.g. relationship.ec2instance.resource.awsaccount.loaded)

The log message is also improved to show the full relationship pattern: Loaded 42 (EC2Instance)-[RESOURCE]->(AWSAccount) relationships.

Related issues or links

Breaking changes

Metric names change from relationship.{rel_label}.loaded to relationship.{src}.{rel}.{tgt}.loaded. Any dashboards or alerts referencing the old metric names will need updating.

How was this tested?

Unit tests updated and passing (make test_unit). Pre-commit hooks pass cleanly.

Checklist

General

  • I have read the contributing guidelines.
  • The linter passes locally (make lint).
  • I have added/updated tests that prove my fix is effective or my feature works.

Proof of functionality

  • New or updated unit/integration tests.

Notes for reviewers

The source_node_label on CartographyRelSchema is optional (can be None), but load_matchlinks() is specifically for matchlink schemas where it should always be set. A fallback to "unknown" is included as a safety measure.

…bels

Relationship labels like RESOURCE repeat across 425+ schemas, making
the metric `relationship.resource.loaded` useless for distinguishing
what was loaded. Include source and target node labels in the metric
name: `relationship.{src}.{rel}.{tgt}.loaded`.

Addresses post-merge feedback from heryxpc on PR #2331.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: Jeremy Chapeau <[email protected]>
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

@jychp jychp merged commit 8c0b775 into master Feb 13, 2026
5 of 8 checks passed
@jychp jychp deleted the jeremy/metrics-relationship-label-disambiguation branch February 13, 2026 19:53
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.

2 participants