Disable default APM tracer.

This commit is contained in:
Ludovic Fernandez 2020-03-04 00:56:04 +01:00 committed by GitHub
parent 67e17def56
commit fb51ebcba6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View file

@ -1,3 +1,8 @@
dist/
!dist/traefik
site/
vendor/
.github/
.semaphoreci/
.travis/
.idea/

View file

@ -21,8 +21,8 @@ RUN mkdir -p /usr/local/bin \
# Download golangci-lint binary to bin folder in $GOPATH
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.23.6
# Download golangci-lint and misspell binary to bin folder in $GOPATH
RUN GO111MODULE=off go get github.com/client9/misspell/cmd/misspell
# Download misspell binary to bin folder in $GOPATH
RUN curl -sfL https://raw.githubusercontent.com/client9/misspell/master/install-misspell.sh | bash -s -- -b $GOPATH/bin v0.3.4
# Download goreleaser binary to bin folder in $GOPATH
RUN curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh

View file

@ -15,6 +15,13 @@ import (
// Name sets the name of this tracer.
const Name = "elastic"
func init() {
// The APM lib uses the init() function to create a default tracer.
// So this default tracer must be disabled.
// https://github.com/elastic/apm-agent-go/blob/8dd383d0d21776faad8841fe110f35633d199a03/tracer.go#L61-L65
apm.DefaultTracer.Close()
}
// Config provides configuration settings for a elastic.co tracer.
type Config struct {
ServerURL string `description:"Set the URL of the Elastic APM server." json:"serverURL,omitempty" toml:"serverURL,omitempty" yaml:"serverURL,omitempty"`