refactor(tracking): replace flat operationType with dimensional attributes#623
Merged
Conversation
…butes Rewrite BaseDaoBenchmarkMetrics so implementations receive each dimension (operation, aspect, count bucket, status, error class) as a separate parameter instead of a single concatenated operationType string. Lets a backend emit one counter/histogram with attributes rather than a separate named metric per aspect or batch size. Update InstrumentedEbeanLocalAccess to pass dimensions through cleanly: aspect class name for per-aspect ops, a bucketed count label (1..9, 10+) for batch ops. Bucketing keeps cardinality bounded for downstream backends.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #623 +/- ##
============================================
+ Coverage 66.82% 66.86% +0.03%
- Complexity 1880 1885 +5
============================================
Files 148 148
Lines 7262 7273 +11
Branches 879 880 +1
============================================
+ Hits 4853 4863 +10
- Misses 2024 2025 +1
Partials 385 385 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ZihanLi58
approved these changes
May 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BaseDaoBenchmarkMetricsso impls receive each dimension (operation, aspect, count bucket, status, error class) as a separate parameter instead of one concatenatedoperationTypestring.InstrumentedEbeanLocalAccessto pass dimensions through cleanly: aspect class name for per-aspect ops, a bucketed count label (1..9,10+) for batch ops.Why
Today the impl gets strings like
add.AliasesInfo,create.aspects_3,batchGetUnion.keys_42— each becomes its own metric path in RRD/Dropwizard, so aggregating "all adds across all aspects" requires summing hundreds of named series. Splitting into native dimensions lets backends emit one metric with attributes and aggregate/filter natively. This is a pre-req for a downstream OTEL-backed impl.Follow-up (required in metadata-graph-assets)
This PR changes the interface contract; it does not itself emit any metrics. The existing
DropwizardDaoBenchmarkMetricsin metadata-graph-assets (the only known concrete impl) implements the oldrecordOperationLatency/recordOperationErrormethods and will not compile against the new contract.When MGA picks up this version (via a metadata-models bump), it must in the same PR:
DropwizardDaoBenchmarkMetricswith a newDaoBenchmarkOtelMetricsthat implements the singlerecordOperation(...)method.MgaClientMetricsfacade pattern (typedAttributeKeys, pre-builtLongCounter+LongHistogram,Meterobtained fromcom.linkedin.opentelemetry.OpenTelemetry.meterBuilder(...)).Dao.Benchmark.Operation.Count(counter),Dao.Benchmark.Operation.Latency(histogram, ms).Operation,EntityType,Aspect,CountBucket,Status,ErrorClass.DaoBenchmarkMetricsFactory.createInstance(...)to return the OTEL impl instead of the Dropwizard one.DropwizardDaoBenchmarkMetricsand itsDropwizardDaoBenchmarkMetricsTest.InMemoryMetricReader(mirrorMgaClientMetricsTest).The MGA-side OTEL impl is where the real metric emission lives — this PR is purely kernel plumbing.
Test plan
:dao-api+:dao-impl:ebean-daocompile clean (Java 11)InstrumentedEbeanLocalAccessTestpasses — rewrote assertions to verify the 7-param contract, addedbucketCountboundary tests (0, 1, 5, 9, 10, 100), covered success + failure paths:dao-impl:ebean-dao:testsuite (CI will run)🤖 Generated with Claude Code