1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-11-29 23:07:45 +02:00

Remove Labelset (#595)

* Remove LabelSet frmo api/metric

* SDK tests pass

* Restore benchmarks

* All tests pass

* Remove all mentions of LabelSet

* Test RecordBatch

* Batch test

* Improves benchmark (some)

* Move the benchmark to match HEAD

* Align labels for GOARCH=386

* Add alignment test

* Disable the stress test fo GOARCH=386

* Fix bug

* Move atomic fields into their own file

* Add a TODO

* Comments

* Remove metric.Labels(...)

* FTB

Co-authored-by: Liz Fong-Jones <lizf@honeycomb.io>
This commit is contained in:
Joshua MacDonald
2020-03-27 14:06:48 -07:00
committed by GitHub
parent e7a9ba1e2e
commit e8546e3bc5
29 changed files with 436 additions and 477 deletions

View File

@@ -21,6 +21,7 @@ import (
"sync"
"time"
"go.opentelemetry.io/otel/api/core"
"go.opentelemetry.io/otel/api/global"
"go.opentelemetry.io/otel/api/key"
"go.opentelemetry.io/otel/api/metric"
@@ -53,13 +54,13 @@ func main() {
meter := global.Meter("ex.com/basic")
observerLock := new(sync.RWMutex)
observerValueToReport := new(float64)
observerLabelSetToReport := new(metric.LabelSet)
observerLabelsToReport := new([]core.KeyValue)
cb := func(result metric.Float64ObserverResult) {
(*observerLock).RLock()
value := *observerValueToReport
labelset := *observerLabelSetToReport
labels := *observerLabelsToReport
(*observerLock).RUnlock()
result.Observe(value, labelset)
result.Observe(value, labels...)
}
_ = metric.Must(meter).RegisterFloat64Observer("ex.com.one", cb,
metric.WithKeys(fooKey, barKey, lemonsKey),
@@ -69,14 +70,14 @@ func main() {
measureTwo := metric.Must(meter).NewFloat64Measure("ex.com.two", metric.WithKeys(key.New("A")))
measureThree := metric.Must(meter).NewFloat64Counter("ex.com.three")
commonLabels := meter.Labels(lemonsKey.Int(10), key.String("A", "1"), key.String("B", "2"), key.String("C", "3"))
notSoCommonLabels := meter.Labels(lemonsKey.Int(13))
commonLabels := []core.KeyValue{lemonsKey.Int(10), key.String("A", "1"), key.String("B", "2"), key.String("C", "3")}
notSoCommonLabels := []core.KeyValue{lemonsKey.Int(13)}
ctx := context.Background()
(*observerLock).Lock()
*observerValueToReport = 1.0
*observerLabelSetToReport = &commonLabels
*observerLabelsToReport = commonLabels
(*observerLock).Unlock()
meter.RecordBatch(
ctx,
@@ -89,7 +90,7 @@ func main() {
(*observerLock).Lock()
*observerValueToReport = 1.0
*observerLabelSetToReport = &notSoCommonLabels
*observerLabelsToReport = notSoCommonLabels
(*observerLock).Unlock()
meter.RecordBatch(
ctx,
@@ -102,7 +103,7 @@ func main() {
(*observerLock).Lock()
*observerValueToReport = 13.0
*observerLabelSetToReport = &commonLabels
*observerLabelsToReport = commonLabels
(*observerLock).Unlock()
meter.RecordBatch(
ctx,