1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-07-17 01:12:45 +02:00

Refactor the SDK helpers, create MeterImpl (#560)

* Create MeterImpl interface

* Checkpoint w/ sdk.go building

* Checkpoint working on global

* api/global builds (test fails)

* Test fix

* All tests pass

* Comments

* Add two tests

* Comments and uncomment tests

* Precommit part 1

* Still working on tests

* Lint

* Add a test and a TODO

* Cleanup

* Lint

* Interface()->Implementation()

* Apply some feedback

* From feedback

* (A)Synchronous -> (A)Sync

* Add a missing comment

* Apply suggestions from code review

Co-Authored-By: Krzesimir Nowak <qdlacz@gmail.com>

* Rename a variable

Co-authored-by: Krzesimir Nowak <qdlacz@gmail.com>
This commit is contained in:
Joshua MacDonald
2020-03-19 12:02:46 -07:00
committed by GitHub
parent e0406dd3eb
commit d8682c1999
55 changed files with 1314 additions and 1299 deletions

View File

@ -22,6 +22,7 @@ import (
"unsafe"
"go.opentelemetry.io/otel/api/core"
"go.opentelemetry.io/otel/api/metric"
export "go.opentelemetry.io/otel/sdk/export/metric"
"go.opentelemetry.io/otel/sdk/export/metric/aggregator"
)
@ -83,7 +84,7 @@ func (c *Aggregator) Points() ([]core.Number, error) {
// Checkpoint saves the current state and resets the current state to
// the empty set, taking a lock to prevent concurrent Update() calls.
func (c *Aggregator) Checkpoint(ctx context.Context, desc *export.Descriptor) {
func (c *Aggregator) Checkpoint(ctx context.Context, desc *metric.Descriptor) {
c.lock.Lock()
c.checkpoint, c.current = c.current, nil
c.lock.Unlock()
@ -106,7 +107,7 @@ func (c *Aggregator) Checkpoint(ctx context.Context, desc *export.Descriptor) {
// Update adds the recorded measurement to the current data set.
// Update takes a lock to prevent concurrent Update() and Checkpoint()
// calls.
func (c *Aggregator) Update(_ context.Context, number core.Number, desc *export.Descriptor) error {
func (c *Aggregator) Update(_ context.Context, number core.Number, desc *metric.Descriptor) error {
c.lock.Lock()
c.current = append(c.current, number)
c.lock.Unlock()
@ -114,7 +115,7 @@ func (c *Aggregator) Update(_ context.Context, number core.Number, desc *export.
}
// Merge combines two data sets into one.
func (c *Aggregator) Merge(oa export.Aggregator, desc *export.Descriptor) error {
func (c *Aggregator) Merge(oa export.Aggregator, desc *metric.Descriptor) error {
o, _ := oa.(*Aggregator)
if o == nil {
return aggregator.NewInconsistentMergeError(c, oa)