Skip to content

Commit

Permalink
Update function docs in sdk.go (#1826)
Browse files Browse the repository at this point in the history
* Made copy of attribute.KeyValue

* Add comments and test

* move test to sdk/metric

* Update CHANGELOG.md

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>

* Add label order assertions for final results

* Update CHANGELOG PR number

* Revert code changes and update docs

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
  • Loading branch information
3 people authored Apr 20, 2021
1 parent 70bc9eb commit 66389ad
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sdk/metric/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,12 @@ func (s *syncInstrument) acquireHandle(kvs []attribute.KeyValue, labelPtr *attri
}
}

// The order of the input array `kvs` may be sorted after the function is called.
func (s *syncInstrument) Bind(kvs []attribute.KeyValue) metric.BoundSyncImpl {
return s.acquireHandle(kvs, nil)
}

// The order of the input array `kvs` may be sorted after the function is called.
func (s *syncInstrument) RecordOne(ctx context.Context, num number.Number, kvs []attribute.KeyValue) {
h := s.acquireHandle(kvs, nil)
defer h.Unbind()
Expand Down Expand Up @@ -396,6 +398,7 @@ func (m *Accumulator) collectSyncInstruments() int {
}

// CollectAsync implements internal.AsyncCollector.
// The order of the input array `kvs` may be sorted after the function is called.
func (m *Accumulator) CollectAsync(kv []attribute.KeyValue, obs ...metric.Observation) {
labels := attribute.NewSetWithSortable(kv, &m.asyncSortSlice)

Expand Down Expand Up @@ -472,6 +475,7 @@ func (m *Accumulator) checkpointAsync(a *asyncInstrument) int {
}

// RecordBatch enters a batch of metric events.
// The order of the input array `kvs` may be sorted after the function is called.
func (m *Accumulator) RecordBatch(ctx context.Context, kvs []attribute.KeyValue, measurements ...metric.Measurement) {
// Labels will be computed the first time acquireHandle is
// called. Subsequent calls to acquireHandle will re-use the
Expand Down

0 comments on commit 66389ad

Please sign in to comment.