Skip to content

Commit

Permalink
[internal/exp/metrics] Allow identity types to return the "higher" id…
Browse files Browse the repository at this point in the history
…entity
  • Loading branch information
RichieSams committed Feb 5, 2024
1 parent a106e64 commit d9b3edd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/exp/metrics/identity/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func (i Metric) Hash() hash.Hash64 {
return sum
}

func (i Metric) Scope() Scope {
return i.scope
}

func OfMetric(scope Scope, m pmetric.Metric) Metric {
id := Metric{
scope: scope,
Expand Down
4 changes: 4 additions & 0 deletions internal/exp/metrics/identity/scope.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ func (s Scope) Hash() hash.Hash64 {
return sum
}

func (s Scope) Resource() Resource {
return s.res
}

func OfScope(res Resource, scope pcommon.InstrumentationScope) Scope {
return Scope{
res: res,
Expand Down
4 changes: 4 additions & 0 deletions internal/exp/metrics/identity/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ func (i Stream) Hash() hash.Hash64 {
return sum
}

func (i Stream) Metric() Metric {
return i.metric
}

func OfStream[DataPoint attrPoint](m Metric, dp DataPoint) Stream {
return Stream{metric: m, attrs: pdatautil.MapHash(dp.Attributes())}
}
Expand Down

0 comments on commit d9b3edd

Please sign in to comment.