Skip to content

Commit

Permalink
Generate spans containing attributes with array values (#19)
Browse files Browse the repository at this point in the history
* Update to go 1.21.x

* Send content type and accept header for HTTP requests

This is useful to generate attributes with array values

* The template example now sends attributes with array values

* Use local rand.Rand instance instead of package global rand.Seed()

* Update dependencies
  • Loading branch information
stoewer authored Dec 11, 2023
1 parent 599b8ec commit 95f69fd
Show file tree
Hide file tree
Showing 9 changed files with 359 additions and 185 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:
- name: Set-up Go
uses: actions/setup-go@v3
with:
go-version: ^1.19
go-version: ^1.21
cache: true

- name: Lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.50.1
version: v1.55.2
args: --config ./golangci.yml

- name: Test
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19-alpine AS xk6-client-tracing-build
FROM golang:1.21-alpine AS xk6-client-tracing-build

RUN apk add --no-cache \
build-base \
Expand Down
3 changes: 2 additions & 1 deletion examples/template/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const traceTemplates = [
},
{
defaults: {
attributes: {"numbers": ["one", "two", "three"]},
attributeSemantics: tracing.SEMANTICS_HTTP,
},
spans: [
Expand All @@ -54,7 +55,7 @@ const traceTemplates = [
defaults: traceDefaults,
spans: [
{service: "shop-backend", attributes: {"http.status_code": 403}},
{service: "shop-backend", name: "authenticate"},
{service: "shop-backend", name: "authenticate", attributes: {"http.request.header.accept": ["application/json"]}},
{service: "auth-service", name: "authenticate", attributes: {"http.status_code": 403}},
]
},
Expand Down
120 changes: 77 additions & 43 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,73 +1,107 @@
module github.com/grafana/xk6-client-tracing

go 1.18
go 1.21

require (
github.com/dop251/goja v0.0.0-20221025165401-cb5011b539fe
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/jaegerexporter v0.62.0
github.com/dop251/goja v0.0.0-20231027120936-b396bb4c349d
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/jaegerexporter v0.85.0
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.8.1
go.k6.io/k6 v0.40.0
go.opentelemetry.io/collector v0.62.1
go.opentelemetry.io/collector/pdata v0.62.1
go.opentelemetry.io/otel/metric v0.32.1
go.opentelemetry.io/otel/trace v1.11.1
go.uber.org/zap v1.23.0
github.com/stretchr/testify v1.8.4
go.k6.io/k6 v0.48.0
go.opentelemetry.io/collector/component v0.90.1
go.opentelemetry.io/collector/config/configgrpc v0.90.1
go.opentelemetry.io/collector/config/confighttp v0.90.1
go.opentelemetry.io/collector/config/configopaque v0.90.0
go.opentelemetry.io/collector/config/configtls v0.90.1
go.opentelemetry.io/collector/exporter v0.90.0
go.opentelemetry.io/collector/exporter/otlpexporter v0.90.1
go.opentelemetry.io/collector/exporter/otlphttpexporter v0.90.1
go.opentelemetry.io/collector/pdata v1.0.0
go.opentelemetry.io/otel/metric v1.21.0
go.opentelemetry.io/otel/trace v1.21.0
go.uber.org/zap v1.26.0
)

require (
github.com/apache/thrift v0.17.0 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
cloud.google.com/go/compute/metadata v0.2.4-0.20230617002413-005d2dfb6b68 // indirect
github.com/apache/thrift v0.19.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dlclark/regexp2 v1.7.0 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/dlclark/regexp2 v1.9.0 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-sourcemap/sourcemap v2.1.4-0.20211119122758-180fcef48034+incompatible // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/jaegertracing/jaeger v1.38.1 // indirect
github.com/google/pprof v0.0.0-20230728192033-2ba5b33183c6 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/jaegertracing/jaeger v1.41.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.15.11 // indirect
github.com/knadh/koanf v1.4.3 // indirect
github.com/klauspost/compress v1.17.3 // indirect
github.com/knadh/koanf v1.5.0 // indirect
github.com/knadh/koanf/v2 v2.0.1 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/mapstructure v1.5.1-0.20220423185008-bf980b35cac4 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mostynb/go-grpc-compression v1.1.17 // indirect
github.com/mostynb/go-grpc-compression v1.2.2 // indirect
github.com/mstoykov/atlas v0.0.0-20220811071828-388f114305dd // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.62.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.62.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.85.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.85.0 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rs/cors v1.8.2 // indirect
github.com/rs/cors v1.10.1 // indirect
github.com/serenize/snaker v0.0.0-20201027110005-a7ad2135616e // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/spf13/afero v1.8.2 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/afero v1.9.2 // indirect
github.com/uber/jaeger-client-go v2.30.0+incompatible // indirect
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
go.opencensus.io v0.23.0 // indirect
go.opentelemetry.io/collector/semconv v0.62.1 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.36.1 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.36.1 // indirect
go.opentelemetry.io/otel v1.11.1 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/collector v0.90.0 // indirect
go.opentelemetry.io/collector/config/configauth v0.90.0 // indirect
go.opentelemetry.io/collector/config/configcompression v0.90.0 // indirect
go.opentelemetry.io/collector/config/confignet v0.90.0 // indirect
go.opentelemetry.io/collector/config/configtelemetry v0.90.0 // indirect
go.opentelemetry.io/collector/config/internal v0.90.0 // indirect
go.opentelemetry.io/collector/confmap v0.90.0 // indirect
go.opentelemetry.io/collector/consumer v0.90.0 // indirect
go.opentelemetry.io/collector/extension v0.90.0 // indirect
go.opentelemetry.io/collector/extension/auth v0.90.0 // indirect
go.opentelemetry.io/collector/featuregate v1.0.0 // indirect
go.opentelemetry.io/collector/semconv v0.85.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect
go.opentelemetry.io/otel v1.21.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0 // indirect
go.opentelemetry.io/otel/sdk v1.21.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/net v0.0.0-20220926192436-02166a98028e // indirect
golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect
google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc // indirect
google.golang.org/grpc v1.50.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/oauth2 v0.13.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231030173426-d783a09b4405 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/guregu/null.v3 v3.3.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace cloud.google.com/go/compute/metadata => cloud.google.com/go/compute/metadata v0.2.3
Loading

0 comments on commit 95f69fd

Please sign in to comment.