test(metricdata): add unit tests for Extrema and Temporality #9091
All Vouch review confidence checks passed
Residual risk 0.13 = Change Risk (0.39) × (1 − Review Confidence (0.66)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 321 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.39 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.345
Real PR Conversation Timeline
4 items
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 89.2%. Comparing base (
8131b0a) to head (03d7afe).<details><summary>Additional details and impacted files</summary>

@@ Coverage Diff @@
## main #9091 +/- ##
=====================================
Coverage 89.2% 89.2%
=====================================
Files 339 339
Lines 22340 22340
=====================================
+ Hits 19928 19933 +5
+ Misses 2412 2407 -5
see 4 files with indirect coverage changes
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
</details>
Approved
Approved these changes.
Approved
Approved these changes.
dmathieu
shardool-patil
Description
This PR introduces comprehensive unit test coverage for the
go.opentelemetry.io/otel/sdk/metric/metricdatapackage, focusing on the public typesExtrema[N]andTemporality. Prior to this change, the package had no direct unit test files (0.0%statement coverage).Changes
sdk/metric/metricdata/data_test.go:- Table-driven tests (
testCases) forExtrema.Value()coveringint64andfloat64across zero-values, positive, negative, and explicit zero states.- Table-driven tests (
testCases) forExtrema.MarshalText()asserting text representation ("null"when uninitialized, scalar strings when defined).- Tests for
Extrema.MarshalJSON():- Struct wrapper roundtrips for strongly typed
int64andfloat64structs.- Table-driven tests (
testCases) for pointer-receiver directMarshalJSON()encoding across initialized and zero-value states.sdk/metric/metricdata/temporality_test.go:- Table-driven tests (
testCases) forTemporality.String()testingCumulativeTemporality,DeltaTemporality,undefinedTemporality, and out-of-range bounds.- Table-driven tests (
testCases) forTemporality.MarshalText()confirming byte matching againstString().Verification
```bash
cd sdk/metric && go test -v -count=1 -cover ./metricdata/...