Skip to content

Commit

Permalink
Use attribute Sets instead of KeyValues for export data (#3012)
Browse files Browse the repository at this point in the history
Attribute Sets have stronger guarantees about the uniqueness of their
keys and more functionality. We already ensure attributes are stored as
Sets by the aggregator which will produce these data types. Instead of
converting to a KeyValue slice, keep the data as a Set.

Any user of the data can always call the ToSlice method to use the data
as a slice of KeyValues.
  • Loading branch information
MrAlias authored Jul 14, 2022
1 parent 425e9ce commit a1c5b6f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sdk/metric/export/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ func (Sum) privateAggregation() {}

// DataPoint is a single data point in a timeseries.
type DataPoint struct {
// Attributes is the set of key value pairs that uniquely identify the timeseries.
Attributes []attribute.KeyValue
// Attributes is the set of key value pairs that uniquely identify the
// timeseries.
Attributes attribute.Set
// StartTime is when the timeseries was started. (optional)
StartTime time.Time
// Time is the time when the timeseries was recorded. (optional)
Expand Down Expand Up @@ -126,8 +127,9 @@ func (Histogram) privateAggregation() {}

// HistogramDataPoint is a single histogram data point in a timeseries.
type HistogramDataPoint struct {
// Attributes is the set of key value pairs that uniquely identify the timeseries.
Attributes []attribute.KeyValue
// Attributes is the set of key value pairs that uniquely identify the
// timeseries.
Attributes attribute.Set
// StartTime is when the timeseries was started.
StartTime time.Time
// Time is the time when the timeseries was recorded.
Expand Down

0 comments on commit a1c5b6f

Please sign in to comment.