8000 Fix Marshal outputs json text representation of nil · open-telemetry/opentelemetry-go@fafac78 · GitHub
[go: up one dir, main page]

Skip to content

Commit fafac78

Browse files
committed
Fix Marshal outputs json text representation of nil
1 parent c8d68cb commit fafac78

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

exporters/stdout/stdoutmetric/example_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ func Example() {
257257
// 6,
258258
// 0
259259
// ],
260-
// "Min": {},
261-
// "Max": {},
260+
// "Min": null,
261+
// "Max": null,
262262
// "Sum": 57
263263
// }
264264
// ],

sdk/metric/metricdata/data.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ type Extrema[N int64 | float64] struct {
215215
// MarshalText converts the Extrema value to text.
216216
func (e Extrema[N]) MarshalText() ([]byte, error) {
217217
if !e.valid {
218-
return nil, nil
218+
return json.Marshal(nil)
219219
}
220220
return json.Marshal(e.value)
221221
}

0 commit comments

Comments
 (0)
0