You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-06-14 23:45:20 +02:00
Rename otel/label -> otel/attribute (#1541)
* Rename otel/label -> otel/attr Leave the imported name alone, to avoid a large diff and conflicts * Better import comment * Update CHANGELOG.md Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com> * otel/attr -> otel/attribute * Missed the changelog entry * Get rid of import renaming * Merge remaining conflicts Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com> Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
This commit is contained in:
@ -18,7 +18,7 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"go.opentelemetry.io/otel/label"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
)
|
||||
|
||||
const testKeyFmt = "test-key-%d"
|
||||
@ -28,7 +28,7 @@ func TestAttributesMap(t *testing.T) {
|
||||
attrMap := newAttributesMap(wantCapacity)
|
||||
|
||||
for i := 0; i < 256; i++ {
|
||||
attrMap.add(label.Int(fmt.Sprintf(testKeyFmt, i), i))
|
||||
attrMap.add(attribute.Int(fmt.Sprintf(testKeyFmt, i), i))
|
||||
}
|
||||
if attrMap.capacity != wantCapacity {
|
||||
t.Errorf("attrMap.capacity: got '%d'; want '%d'", attrMap.capacity, wantCapacity)
|
||||
@ -39,14 +39,14 @@ func TestAttributesMap(t *testing.T) {
|
||||
}
|
||||
|
||||
for i := 0; i < wantCapacity; i++ {
|
||||
key := label.Key(fmt.Sprintf(testKeyFmt, i))
|
||||
key := attribute.Key(fmt.Sprintf(testKeyFmt, i))
|
||||
_, ok := attrMap.attributes[key]
|
||||
if ok {
|
||||
t.Errorf("key %q should be dropped", testKeyFmt)
|
||||
}
|
||||
}
|
||||
for i := wantCapacity; i < 256; i++ {
|
||||
key := label.Key(fmt.Sprintf(testKeyFmt, i))
|
||||
key := attribute.Key(fmt.Sprintf(testKeyFmt, i))
|
||||
_, ok := attrMap.attributes[key]
|
||||
if !ok {
|
||||
t.Errorf("key %q should not be dropped", key)
|
||||
@ -58,7 +58,7 @@ func TestAttributesMapGetOldestRemoveOldest(t *testing.T) {
|
||||
attrMap := newAttributesMap(128)
|
||||
|
||||
for i := 0; i < 128; i++ {
|
||||
attrMap.add(label.Int(fmt.Sprintf(testKeyFmt, i), i))
|
||||
attrMap.add(attribute.Int(fmt.Sprintf(testKeyFmt, i), i))
|
||||
}
|
||||
|
||||
attrMap.removeOldest()
|
||||
@ -66,7 +66,7 @@ func TestAttributesMapGetOldestRemoveOldest(t *testing.T) {
|
||||
attrMap.removeOldest()
|
||||
|
||||
for i := 0; i < 3; i++ {
|
||||
key := label.Key(fmt.Sprintf(testKeyFmt, i))
|
||||
key := attribute.Key(fmt.Sprintf(testKeyFmt, i))
|
||||
_, ok := attrMap.attributes[key]
|
||||
if ok {
|
||||
t.Errorf("key %q should be removed", key)
|
||||
@ -78,7 +78,7 @@ func TestAttributesMapToKeyValue(t *testing.T) {
|
||||
attrMap := newAttributesMap(128)
|
||||
|
||||
for i := 0; i < 128; i++ {
|
||||
attrMap.add(label.Int(fmt.Sprintf(testKeyFmt, i), i))
|
||||
attrMap.add(attribute.Int(fmt.Sprintf(testKeyFmt, i), i))
|
||||
}
|
||||
|
||||
kv := attrMap.toKeyValue()
|
||||
@ -94,7 +94,7 @@ func BenchmarkAttributesMapToKeyValue(b *testing.B) {
|
||||
attrMap := newAttributesMap(128)
|
||||
|
||||
for i := 0; i < 128; i++ {
|
||||
attrMap.add(label.Int(fmt.Sprintf(testKeyFmt, i), i))
|
||||
attrMap.add(attribute.Int(fmt.Sprintf(testKeyFmt, i), i))
|
||||
}
|
||||
|
||||
for n := 0; n < b.N; n++ {
|
||||
|
Reference in New Issue
Block a user