Skip to content

Commit

Permalink
Deprecate MetricDataPointFlags.String(), no other pdata has this (#5868)
Browse files Browse the repository at this point in the history
* Deprecate MetricDataPointFlags.String(), no other pdata has this

If offering String() on pdata we should do it from the pdata generator not as ad-hoc for some of the hand written structs.

Signed-off-by: Bogdan <bogdandrutu@gmail.com>

* Update CHANGELOG.md

Co-authored-by: Dmitrii Anoshin <anoshindx@gmail.com>

Co-authored-by: Dmitrii Anoshin <anoshindx@gmail.com>
  • Loading branch information
bogdandrutu and dmitryax authored Aug 9, 2022
1 parent c140304 commit 7c2aba4
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
- `component.ReceiverFactory.MetricsReceiverStability`
- `component.ReceiverFactory.LogsReceiverStability`
- Deprecate `obsreport.ProcessorSettings.Level` and `obsreport.ExporterSettings.Level`, use MetricsLevel from CreateSettings (#5824)
- Deprecate MetricDataPointFlags.String(), no other pdata flags have this method (#5868)
- Deprecates `FlagsStruct` in favor of `Flags` (#5842)
- `MetricDataPointFlagsStruct` -> `MetricDataPointFlags`
- `NewMetricDataPointFlagsStruct` -> `NewMetricDataPointFlags`
Expand Down
2 changes: 1 addition & 1 deletion pdata/internal/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ func (ms MetricDataPointFlags) SetNoRecordedValue(b bool) {
}
}

// String returns the string representation of the MetricDataPointFlags.
// Deprecated: [v0.58.0] will be soon removed, no String() on any other pdata.
func (ms MetricDataPointFlags) String() string {
return otlpmetrics.DataPointFlags(*ms.orig).String()
}
Expand Down
3 changes: 0 additions & 3 deletions pdata/internal/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -690,13 +690,10 @@ func TestMetricsClone(t *testing.T) {

func TestMetricsDataPointFlags(t *testing.T) {
gauge := generateTestGauge()

assert.False(t, gauge.DataPoints().At(0).Flags().NoRecordedValue())
assert.Equal(t, "FLAG_NONE", gauge.DataPoints().At(0).Flags().String())

gauge.DataPoints().At(1).Flags().SetNoRecordedValue(true)
assert.True(t, gauge.DataPoints().At(1).Flags().NoRecordedValue())
assert.Equal(t, "FLAG_NO_RECORDED_VALUE", gauge.DataPoints().At(1).Flags().String())
gauge.DataPoints().At(1).Flags().SetNoRecordedValue(false)
assert.False(t, gauge.DataPoints().At(1).Flags().NoRecordedValue())

Expand Down

0 comments on commit 7c2aba4

Please sign in to comment.