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

Rename resource pkg label vars and methods (#1692)

* Rename resource pkg label vars and methods

The former `labels` package is now named `attributes` to conform with
the specification requirement. This removes the lingering `label` term
from the `resource` package.

Resolve https://github.com/open-telemetry/opentelemetry-go/issues/1691

* Update PR number in CHANGELOG

* Propagate rename to the prometheus exporter pkg
This commit is contained in:
Tyler Yahn
2021-03-11 11:00:12 -08:00
committed by GitHub
parent a1539d4485
commit 8b1be11a54
5 changed files with 27 additions and 28 deletions

View File

@@ -168,9 +168,9 @@ func TestMerge(t *testing.T) {
func TestDefault(t *testing.T) {
res := resource.Default()
require.False(t, res.Equal(resource.Empty()))
require.True(t, res.LabelSet().HasValue(semconv.ServiceNameKey))
require.True(t, res.Set().HasValue(semconv.ServiceNameKey))
serviceName, _ := res.LabelSet().Value(semconv.ServiceNameKey)
serviceName, _ := res.Set().Value(semconv.ServiceNameKey)
require.True(t, strings.HasPrefix(serviceName.AsString(), "unknown_service:"))
require.Greaterf(t, len(serviceName.AsString()), len("unknown_service:"),
"default service.name should include executable name")