Skip to content
This repository has been archived by the owner on Dec 20, 2021. It is now read-only.

0.11.0 change kv to label #90

Merged
merged 3 commits into from
Sep 15, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 36 additions & 30 deletions example/client/client.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// COPIED FROM OPENTELEMETRY HTTP EXAMPLE
// COPIED FROM OPENTELEMETRY CONTRIB HTTP EXAMPLE

package main

Expand All @@ -9,17 +9,19 @@ import (
"io/ioutil"
"log"
"net/http"
"net/http/httptrace"
"time"

"google.golang.org/grpc/codes"
"github.com/honeycombio/opentelemetry-exporter-go/honeycomb"

otelhttp "go.opentelemetry.io/contrib/instrumentation/net/http"
otelhttptrace "go.opentelemetry.io/contrib/instrumentation/net/http/httptrace"
"go.opentelemetry.io/otel/api/correlation"
"go.opentelemetry.io/otel/api/global"
"go.opentelemetry.io/otel/api/kv"
"go.opentelemetry.io/otel/api/trace"
"go.opentelemetry.io/otel/instrumentation/httptrace"

"github.com/honeycombio/opentelemetry-exporter-go/honeycomb"
"go.opentelemetry.io/otel/label"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"go.opentelemetry.io/otel/semconv"
)

func initTracer(exporter *honeycomb.Exporter) {
Expand All @@ -38,52 +40,56 @@ func main() {
dataset := flag.String("dataset", "opentelemetry", "Your Honeycomb dataset")
flag.Parse()

exporter, err := honeycomb.NewExporter(
exporter, errExp := honeycomb.NewExporter(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to change this? If not, I'd prefer to leave it as it was, naming this err and using err = func(ctx context.Context) error {} below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, will fix that ... Just habit so err doesn't get shadowed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert it back ... it is only example code :)

honeycomb.Config{
APIKey: *apikey,
},
honeycomb.TargetingDataset(*dataset),
honeycomb.WithServiceName("opentelemetry-client"),
honeycomb.WithDebugEnabled())
if err != nil {
log.Fatal(err)
if errExp != nil {
log.Fatal(errExp)
}
defer exporter.Close()

initTracer(exporter)

tr := global.TraceProvider().Tracer("honeycomb/example/client")
url := flag.String("server", "http://localhost:7777/hello", "server url")
flag.Parse()

client := http.Client{Transport: otelhttp.NewTransport(http.DefaultTransport)}

client := http.DefaultClient
ctx := correlation.NewContext(context.Background(),
kv.String("username", "donuts"),
label.String("username", "donuts"),
)

var body []byte
ctx = httptrace.WithClientTrace(ctx, otelhttptrace.NewClientTrace(ctx))

err = tr.WithSpan(ctx, "say hello",
func(ctx context.Context) error {
req, _ := http.NewRequest("GET", "http://localhost:7777/hello", nil)

ctx, req = httptrace.W3C(ctx, req)
httptrace.Inject(ctx, req)
var body []byte

fmt.Printf("Sending request...\n")
res, err := client.Do(req)
if err != nil {
panic(err)
}
body, err = ioutil.ReadAll(res.Body)
tr := global.Tracer("example/client")
err := func(ctx context.Context) error {
ctx, span := tr.Start(ctx, "say hello", trace.WithAttributes(semconv.PeerServiceKey.String("ExampleService")))
defer span.End()
req, _ := http.NewRequestWithContext(ctx, "GET", *url, nil)

res.Body.Close()
trace.SpanFromContext(ctx).SetStatus(codes.OK, "")
fmt.Printf("Sending request...\n")
res, err := client.Do(req)
if err != nil {
panic(err)
}
body, err = ioutil.ReadAll(res.Body)
_ = res.Body.Close()

return err
})
return err
}(ctx)

if err != nil {
panic(err)
}

fmt.Printf("%s", body)
fmt.Printf("Response Received: %s\n\n\n", body)
fmt.Printf("Waiting for few seconds to export spans ...\n\n")
time.Sleep(10 * time.Second)
fmt.Printf("Inspect traces on stdout\n")
}
10 changes: 5 additions & 5 deletions example/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ import (
"net/http"

"github.com/honeycombio/opentelemetry-exporter-go/honeycomb"

"go.opentelemetry.io/contrib/instrumentation/net/http/httptrace"
"go.opentelemetry.io/otel/api/correlation"
"go.opentelemetry.io/otel/api/global"
"go.opentelemetry.io/otel/api/kv"
"go.opentelemetry.io/otel/api/trace"

"go.opentelemetry.io/otel/instrumentation/httptrace"
"go.opentelemetry.io/otel/label"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
)

Expand Down Expand Up @@ -77,8 +77,8 @@ func main() {
)
defer span.End()

span.SetAttributes(kv.String("ex.com/another", "yes"))
span.AddEvent(ctx, "handling this...", kv.Int("request-handled", 100))
span.SetAttributes(label.String("ex.com/another", "yes"))
span.AddEvent(ctx, "handling this...", label.Int("request-handled", 100))

_, _ = io.WriteString(w, "Hello, world!\n")
}
Expand Down
8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ require (
github.com/klauspost/compress v1.10.10 // indirect
github.com/stretchr/testify v1.6.1
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect
go.opentelemetry.io/otel v0.10.0
go.opentelemetry.io/otel/sdk v0.10.0
go.opentelemetry.io/contrib/instrumentation/net/http v0.11.0
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace v0.11.0
go.opentelemetry.io/otel v0.11.0
go.opentelemetry.io/otel/sdk v0.11.0
golang.org/x/net v0.0.0-20200707034311-ab3426394381 // indirect
google.golang.org/appengine v1.6.6 // indirect
google.golang.org/grpc v1.30.0
google.golang.org/grpc v1.31.0
google.golang.org/protobuf v1.25.0 // indirect
)
27 changes: 15 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojt
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg=
github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk=
github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0=
github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ=
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/mock v1.1.1 h1:G5FRp8JnTd7RQH5kemVNlMeyXQAztQ3mOWV95KxsXH8=
Expand Down Expand Up @@ -82,14 +84,12 @@ github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
Expand All @@ -100,10 +100,16 @@ github.com/vmihailenco/msgpack/v4 v4.3.12 h1:07s4sz9IReOgdikxLTKNbBdqDMLsjPKXwvC
github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4=
github.com/vmihailenco/tagparser v0.1.1 h1:quXMXlA39OCbd2wAdTsGDlK9RkOk6Wuw+x37wVyIuWY=
github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
go.opentelemetry.io/otel v0.10.0 h1:2y/HYj1dIfG1nPh0Z15X4se8WwYWuTyKHLSgRb/mbQ0=
go.opentelemetry.io/otel v0.10.0/go.mod h1:n3v1JGUBpn5DafiF1UeoDs5fr5XZMG+43kigDtFB8Vk=
go.opentelemetry.io/otel/sdk v0.10.0 h1:iQWVDfmGB+5TjbrO9yFlezGCWBaJ73vxJTHB+ttdTQk=
go.opentelemetry.io/otel/sdk v0.10.0/go.mod h1:T5752PMr00aUHAVEbaDAYU5tzM2PWOmyy7Lc5OzSrs8=
go.opentelemetry.io/contrib v0.11.0 h1:EQOdk+fxs7qp3wVIS5wCinwqNHfhD/DreQRY/VADO8s=
go.opentelemetry.io/contrib v0.11.0/go.mod h1:ZE6zLnhbB+AmcDlcG57gEbtyUasUiaeppcDfBcrZabY=
go.opentelemetry.io/contrib/instrumentation/net/http v0.11.0 h1:ufewgDRmtrrdDpPgm7b4/gr4RXLS7KhDttAhyThtYS4=
go.opentelemetry.io/contrib/instrumentation/net/http v0.11.0/go.mod h1:SBUSwgw/714EVSKHaAttjlJqbBv1YkUi+qdaN1oxMGE=
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace v0.11.0 h1:mMHMO/0IFn9AGzjeckFHMFIfGuQSGKQMrTidedpFqUI=
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace v0.11.0/go.mod h1:r85rZjRYKYzeQnA6pwrLgYN07jvXcLqIt9H0syOLzb8=
go.opentelemetry.io/otel v0.11.0 h1:IN2tzQa9Gc4ZVKnTaMbPVcHjvzOdg5n9QfnmlqiET7E=
go.opentelemetry.io/otel v0.11.0/go.mod h1:G8UCk+KooF2HLkgo8RHX9epABH/aRGYET7gQOqBVdB0=
go.opentelemetry.io/otel/sdk v0.11.0 h1:bkDMymVj6gIkPfgC5ci5atq0OYbfUHSn8NvsmyfyMq4=
go.opentelemetry.io/otel/sdk v0.11.0/go.mod h1:XbZ6MrzIZ+d+qr7pH0FwHIbCnANMvXYgkq4afL/IUMQ=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
Expand All @@ -120,7 +126,6 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJV
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200301022130-244492dfa37a h1:GuSPYbZzB5/dcLNCwLQLsg3obCJtX9IJhpXkvY7kzk0=
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e h1:3G+cUijn7XD+S4eJFddp53Pv7+slrESplyjG25HgL+k=
Expand All @@ -138,7 +143,6 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
Expand All @@ -160,16 +164,14 @@ google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCID
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20191009194640-548a555dbc03 h1:4HYDjxeNXAOTv3o1N2tjo8UUSlhQgAD52FVkwxnWgM8=
google.golang.org/genproto v0.0.0-20191009194640-548a555dbc03/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.30.0 h1:M5a8xTlYTxwMn5ZFkwhRabsygDY5G8TYLyQDBxJNAxE=
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.31.0 h1:T7P4R73V3SSDPhH7WW7ATbfViLtmamH0DKrP3f9AuDI=
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
Expand All @@ -185,6 +187,7 @@ gopkg.in/alexcesaro/statsd.v2 v2.0.0 h1:FXkZSCZIH17vLCO5sO2UucTHsH9pc+17F6pl3JVC
gopkg.in/alexcesaro/statsd.v2 v2.0.0/go.mod h1:i0ubccKGzBVNBpdGV5MocxyA/XlLUJzA7SLonnE4drU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
3 changes: 2 additions & 1 deletion honeycomb/honeycomb.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (

libhoney "github.com/honeycombio/libhoney-go"
"github.com/honeycombio/libhoney-go/transmission"

"go.opentelemetry.io/otel/sdk/export/trace"
)

Expand Down Expand Up @@ -400,7 +401,7 @@ func NewExporter(config Config, opts ...ExporterOption) (*Exporter, error) {
// Developer note: bump this with each release
// TODO: Stamp this via a variable set at link time with a value derived
// from the current VCS tag.
const versionStr = "0.10.0"
const versionStr = "0.11.0"

if len(config.APIKey) == 0 {
return nil, errors.New("API key must not be empty")
Expand Down
35 changes: 18 additions & 17 deletions honeycomb/honeycomb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import (
"testing"
"time"

"github.com/honeycombio/libhoney-go/transmission"
"github.com/stretchr/testify/assert"
"go.opentelemetry.io/otel/api/global"
"go.opentelemetry.io/otel/api/kv"

"google.golang.org/grpc/codes"

"github.com/honeycombio/libhoney-go/transmission"
"go.opentelemetry.io/otel/api/global"
apitrace "go.opentelemetry.io/otel/api/trace"
"go.opentelemetry.io/otel/label"
exporttrace "go.opentelemetry.io/otel/sdk/export/trace"
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
Expand Down Expand Up @@ -212,11 +213,11 @@ func TestHoneycombOutput(t *testing.T) {
_, span := tr.Start(context.TODO(), "myTestSpan")
var nilString string
span.SetAttributes(
kv.String("ex.com/string", "yes"),
kv.Bool("ex.com/bool", true),
kv.Int64("ex.com/int64", 42),
kv.Float64("ex.com/float64", 3.14),
kv.String("ex.com/nil", nilString),
label.String("ex.com/string", "yes"),
label.Bool("ex.com/bool", true),
label.Int64("ex.com/int64", 42),
label.Float64("ex.com/float64", 3.14),
label.String("ex.com/nil", nilString),
)
time.Sleep(time.Duration(0.5 * float64(time.Millisecond)))

Expand Down Expand Up @@ -266,7 +267,7 @@ func TestHoneycombOutputWithMessageEvent(t *testing.T) {
assert.Nil(err)

ctx, span := tr.Start(context.TODO(), "myTestSpan")
span.AddEvent(ctx, "handling this...", kv.Int("request-handled", 100))
span.AddEvent(ctx, "handling this...", label.Int("request-handled", 100))
time.Sleep(time.Duration(0.5 * float64(time.Millisecond)))

span.End()
Expand Down Expand Up @@ -522,7 +523,7 @@ func TestHoneycombOutputWithStaticFields(t *testing.T) {

_, span := tr.Start(context.TODO(), "myTestSpan")
span.SetAttributes(
kv.String("ex.com/string", "yes"),
label.String("ex.com/string", "yes"),
)

span.End()
Expand Down Expand Up @@ -557,7 +558,7 @@ func TestHoneycombOutputWithDynamicFields(t *testing.T) {

_, span := tr.Start(context.TODO(), "myTestSpan")
span.SetAttributes(
kv.String("ex.com/string", "yes"),
label.String("ex.com/string", "yes"),
)

span.End()
Expand Down Expand Up @@ -595,7 +596,7 @@ func TestHoneycombOutputWithStaticAndDynamicFields(t *testing.T) {

_, span := tr.Start(context.TODO(), "myTestSpan")
span.SetAttributes(
kv.String("ex.com/string", "yes"),
label.String("ex.com/string", "yes"),
)

span.End()
Expand Down Expand Up @@ -627,17 +628,17 @@ func TestHoneycombOutputWithResource(t *testing.T) {

tr, err := setUpTestProvider(exporter,
sdktrace.WithResource(resource.New(
kv.Int64("a", middle),
kv.Int64("c", middle),
label.Int64("a", middle),
label.Int64("c", middle),
)))

ctx, span := tr.Start(context.TODO(), "myTestSpan")
assert.Nil(err)
span.SetAttributes(
kv.Int64("a", overlay),
kv.Int64("d", overlay),
label.Int64("a", overlay),
label.Int64("d", overlay),
)
span.AddEvent(ctx, "something", kv.Int64("c", overlay))
span.AddEvent(ctx, "something", label.Int64("c", overlay))
time.Sleep(time.Duration(0.5 * float64(time.Millisecond)))

span.End()
Expand Down
Loading