summaryrefslogtreecommitdiff
path: root/vendor/go.opencensus.io
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/go.opencensus.io')
-rw-r--r--vendor/go.opencensus.io/.gitignore9
-rw-r--r--vendor/go.opencensus.io/.travis.yml17
-rw-r--r--vendor/go.opencensus.io/AUTHORS1
-rw-r--r--vendor/go.opencensus.io/CONTRIBUTING.md63
-rw-r--r--vendor/go.opencensus.io/Gopkg.lock231
-rw-r--r--vendor/go.opencensus.io/Gopkg.toml36
-rw-r--r--vendor/go.opencensus.io/LICENSE202
-rw-r--r--vendor/go.opencensus.io/Makefile96
-rw-r--r--vendor/go.opencensus.io/README.md263
-rw-r--r--vendor/go.opencensus.io/appveyor.yml25
-rw-r--r--vendor/go.opencensus.io/go.mod12
-rw-r--r--vendor/go.opencensus.io/go.sum61
-rw-r--r--vendor/go.opencensus.io/internal/internal.go37
-rw-r--r--vendor/go.opencensus.io/internal/sanitize.go50
-rw-r--r--vendor/go.opencensus.io/internal/traceinternals.go53
-rw-r--r--vendor/go.opencensus.io/opencensus.go21
-rw-r--r--vendor/go.opencensus.io/trace/basetypes.go119
-rw-r--r--vendor/go.opencensus.io/trace/config.go86
-rw-r--r--vendor/go.opencensus.io/trace/doc.go53
-rw-r--r--vendor/go.opencensus.io/trace/evictedqueue.go38
-rw-r--r--vendor/go.opencensus.io/trace/export.go97
-rw-r--r--vendor/go.opencensus.io/trace/internal/internal.go22
-rw-r--r--vendor/go.opencensus.io/trace/lrumap.go37
-rw-r--r--vendor/go.opencensus.io/trace/sampling.go75
-rw-r--r--vendor/go.opencensus.io/trace/spanbucket.go130
-rw-r--r--vendor/go.opencensus.io/trace/spanstore.go306
-rw-r--r--vendor/go.opencensus.io/trace/status_codes.go37
-rw-r--r--vendor/go.opencensus.io/trace/trace.go598
-rw-r--r--vendor/go.opencensus.io/trace/trace_go11.go32
-rw-r--r--vendor/go.opencensus.io/trace/trace_nongo11.go25
-rw-r--r--vendor/go.opencensus.io/trace/tracestate/tracestate.go147
31 files changed, 2979 insertions, 0 deletions
diff --git a/vendor/go.opencensus.io/.gitignore b/vendor/go.opencensus.io/.gitignore
new file mode 100644
index 000000000..74a6db472
--- /dev/null
+++ b/vendor/go.opencensus.io/.gitignore
@@ -0,0 +1,9 @@
+/.idea/
+
+# go.opencensus.io/exporter/aws
+/exporter/aws/
+
+# Exclude vendor, use dep ensure after checkout:
+/vendor/github.com/
+/vendor/golang.org/
+/vendor/google.golang.org/
diff --git a/vendor/go.opencensus.io/.travis.yml b/vendor/go.opencensus.io/.travis.yml
new file mode 100644
index 000000000..bd6b66ee8
--- /dev/null
+++ b/vendor/go.opencensus.io/.travis.yml
@@ -0,0 +1,17 @@
+language: go
+
+go_import_path: go.opencensus.io
+
+go:
+ - 1.11.x
+
+env:
+ global:
+ GO111MODULE=on
+
+before_script:
+ - make install-tools
+
+script:
+ - make travis-ci
+ - go run internal/check/version.go # TODO move this to makefile
diff --git a/vendor/go.opencensus.io/AUTHORS b/vendor/go.opencensus.io/AUTHORS
new file mode 100644
index 000000000..e491a9e7f
--- /dev/null
+++ b/vendor/go.opencensus.io/AUTHORS
@@ -0,0 +1 @@
+Google Inc.
diff --git a/vendor/go.opencensus.io/CONTRIBUTING.md b/vendor/go.opencensus.io/CONTRIBUTING.md
new file mode 100644
index 000000000..1ba3962c8
--- /dev/null
+++ b/vendor/go.opencensus.io/CONTRIBUTING.md
@@ -0,0 +1,63 @@
+# How to contribute
+
+We'd love to accept your patches and contributions to this project. There are
+just a few small guidelines you need to follow.
+
+## Contributor License Agreement
+
+Contributions to this project must be accompanied by a Contributor License
+Agreement. You (or your employer) retain the copyright to your contribution,
+this simply gives us permission to use and redistribute your contributions as
+part of the project. Head over to <https://cla.developers.google.com/> to see
+your current agreements on file or to sign a new one.
+
+You generally only need to submit a CLA once, so if you've already submitted one
+(even if it was for a different project), you probably don't need to do it
+again.
+
+## Code reviews
+
+All submissions, including submissions by project members, require review. We
+use GitHub pull requests for this purpose. Consult [GitHub Help] for more
+information on using pull requests.
+
+[GitHub Help]: https://help.github.com/articles/about-pull-requests/
+
+## Instructions
+
+Fork the repo, checkout the upstream repo to your GOPATH by:
+
+```
+$ go get -d go.opencensus.io
+```
+
+Add your fork as an origin:
+
+```
+cd $(go env GOPATH)/src/go.opencensus.io
+git remote add fork git@github.com:YOUR_GITHUB_USERNAME/opencensus-go.git
+```
+
+Run tests:
+
+```
+$ make install-tools # Only first time.
+$ make
+```
+
+Checkout a new branch, make modifications and push the branch to your fork:
+
+```
+$ git checkout -b feature
+# edit files
+$ git commit
+$ git push fork feature
+```
+
+Open a pull request against the main opencensus-go repo.
+
+## General Notes
+This project uses Appveyor and Travis for CI.
+
+The dependencies are managed with `go mod` if you work with the sources under your
+`$GOPATH` you need to set the environment variable `GO111MODULE=on`. \ No newline at end of file
diff --git a/vendor/go.opencensus.io/Gopkg.lock b/vendor/go.opencensus.io/Gopkg.lock
new file mode 100644
index 000000000..3be12ac8f
--- /dev/null
+++ b/vendor/go.opencensus.io/Gopkg.lock
@@ -0,0 +1,231 @@
+# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
+
+
+[[projects]]
+ branch = "master"
+ digest = "1:eee9386329f4fcdf8d6c0def0c9771b634bdd5ba460d888aa98c17d59b37a76c"
+ name = "git.apache.org/thrift.git"
+ packages = ["lib/go/thrift"]
+ pruneopts = "UT"
+ revision = "6e67faa92827ece022380b211c2caaadd6145bf5"
+ source = "github.com/apache/thrift"
+
+[[projects]]
+ branch = "master"
+ digest = "1:d6afaeed1502aa28e80a4ed0981d570ad91b2579193404256ce672ed0a609e0d"
+ name = "github.com/beorn7/perks"
+ packages = ["quantile"]
+ pruneopts = "UT"
+ revision = "3a771d992973f24aa725d07868b467d1ddfceafb"
+
+[[projects]]
+ digest = "1:4c0989ca0bcd10799064318923b9bc2db6b4d6338dd75f3f2d86c3511aaaf5cf"
+ name = "github.com/golang/protobuf"
+ packages = [
+ "proto",
+ "ptypes",
+ "ptypes/any",
+ "ptypes/duration",
+ "ptypes/timestamp",
+ ]
+ pruneopts = "UT"
+ revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5"
+ version = "v1.2.0"
+
+[[projects]]
+ digest = "1:ff5ebae34cfbf047d505ee150de27e60570e8c394b3b8fdbb720ff6ac71985fc"
+ name = "github.com/matttproud/golang_protobuf_extensions"
+ packages = ["pbutil"]
+ pruneopts = "UT"
+ revision = "c12348ce28de40eed0136aa2b644d0ee0650e56c"
+ version = "v1.0.1"
+
+[[projects]]
+ digest = "1:824c8f3aa4c5f23928fa84ebbd5ed2e9443b3f0cb958a40c1f2fbed5cf5e64b1"
+ name = "github.com/openzipkin/zipkin-go"
+ packages = [
+ ".",
+ "idgenerator",
+ "model",
+ "propagation",
+ "reporter",
+ "reporter/http",
+ ]
+ pruneopts = "UT"
+ revision = "d455a5674050831c1e187644faa4046d653433c2"
+ version = "v0.1.1"
+
+[[projects]]
+ digest = "1:d14a5f4bfecf017cb780bdde1b6483e5deb87e12c332544d2c430eda58734bcb"
+ name = "github.com/prometheus/client_golang"
+ packages = [
+ "prometheus",
+ "prometheus/promhttp",
+ ]
+ pruneopts = "UT"
+ revision = "c5b7fccd204277076155f10851dad72b76a49317"
+ version = "v0.8.0"
+
+[[projects]]
+ branch = "master"
+ digest = "1:2d5cd61daa5565187e1d96bae64dbbc6080dacf741448e9629c64fd93203b0d4"
+ name = "github.com/prometheus/client_model"
+ packages = ["go"]
+ pruneopts = "UT"
+ revision = "5c3871d89910bfb32f5fcab2aa4b9ec68e65a99f"
+
+[[projects]]
+ branch = "master"
+ digest = "1:63b68062b8968092eb86bedc4e68894bd096ea6b24920faca8b9dcf451f54bb5"
+ name = "github.com/prometheus/common"
+ packages = [
+ "expfmt",
+ "internal/bitbucket.org/ww/goautoneg",
+ "model",
+ ]
+ pruneopts = "UT"
+ revision = "c7de2306084e37d54b8be01f3541a8464345e9a5"
+
+[[projects]]
+ branch = "master"
+ digest = "1:8c49953a1414305f2ff5465147ee576dd705487c35b15918fcd4efdc0cb7a290"
+ name = "github.com/prometheus/procfs"
+ packages = [
+ ".",
+ "internal/util",
+ "nfs",
+ "xfs",
+ ]
+ pruneopts = "UT"
+ revision = "05ee40e3a273f7245e8777337fc7b46e533a9a92"
+
+[[projects]]
+ branch = "master"
+ digest = "1:deafe4ab271911fec7de5b693d7faae3f38796d9eb8622e2b9e7df42bb3dfea9"
+ name = "golang.org/x/net"
+ packages = [
+ "context",
+ "http/httpguts",
+ "http2",
+ "http2/hpack",
+ "idna",
+ "internal/timeseries",
+ "trace",
+ ]
+ pruneopts = "UT"
+ revision = "922f4815f713f213882e8ef45e0d315b164d705c"
+
+[[projects]]
+ branch = "master"
+ digest = "1:e0140c0c868c6e0f01c0380865194592c011fe521d6e12d78bfd33e756fe018a"
+ name = "golang.org/x/sync"
+ packages = ["semaphore"]
+ pruneopts = "UT"
+ revision = "1d60e4601c6fd243af51cc01ddf169918a5407ca"
+
+[[projects]]
+ branch = "master"
+ digest = "1:a3f00ac457c955fe86a41e1495e8f4c54cb5399d609374c5cc26aa7d72e542c8"
+ name = "golang.org/x/sys"
+ packages = ["unix"]
+ pruneopts = "UT"
+ revision = "3b58ed4ad3395d483fc92d5d14123ce2c3581fec"
+
+[[projects]]
+ digest = "1:a2ab62866c75542dd18d2b069fec854577a20211d7c0ea6ae746072a1dccdd18"
+ name = "golang.org/x/text"
+ packages = [
+ "collate",
+ "collate/build",
+ "internal/colltab",
+ "internal/gen",
+ "internal/tag",
+ "internal/triegen",
+ "internal/ucd",
+ "language",
+ "secure/bidirule",
+ "transform",
+ "unicode/bidi",
+ "unicode/cldr",
+ "unicode/norm",
+ "unicode/rangetable",
+ ]
+ pruneopts = "UT"
+ revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
+ version = "v0.3.0"
+
+[[projects]]
+ branch = "master"
+ digest = "1:c0c17c94fe8bc1ab34e7f586a4a8b788c5e1f4f9f750ff23395b8b2f5a523530"
+ name = "google.golang.org/api"
+ packages = ["support/bundler"]
+ pruneopts = "UT"
+ revision = "e21acd801f91da814261b938941d193bb036441a"
+
+[[projects]]
+ branch = "master"
+ digest = "1:077c1c599507b3b3e9156d17d36e1e61928ee9b53a5b420f10f28ebd4a0b275c"
+ name = "google.golang.org/genproto"
+ packages = ["googleapis/rpc/status"]
+ pruneopts = "UT"
+ revision = "c66870c02cf823ceb633bcd05be3c7cda29976f4"
+
+[[projects]]
+ digest = "1:3dd7996ce6bf52dec6a2f69fa43e7c4cefea1d4dfa3c8ab7a5f8a9f7434e239d"
+ name = "google.golang.org/grpc"
+ packages = [
+ ".",
+ "balancer",
+ "balancer/base",
+ "balancer/roundrobin",
+ "codes",
+ "connectivity",
+ "credentials",
+ "encoding",
+ "encoding/proto",
+ "grpclog",
+ "internal",
+ "internal/backoff",
+ "internal/channelz",
+ "internal/envconfig",
+ "internal/grpcrand",
+ "internal/transport",
+ "keepalive",
+ "metadata",
+ "naming",
+ "peer",
+ "resolver",
+ "resolver/dns",
+ "resolver/passthrough",
+ "stats",
+ "status",
+ "tap",
+ ]
+ pruneopts = "UT"
+ revision = "32fb0ac620c32ba40a4626ddf94d90d12cce3455"
+ version = "v1.14.0"
+
+[solve-meta]
+ analyzer-name = "dep"
+ analyzer-version = 1
+ input-imports = [
+ "git.apache.org/thrift.git/lib/go/thrift",
+ "github.com/golang/protobuf/proto",
+ "github.com/openzipkin/zipkin-go",
+ "github.com/openzipkin/zipkin-go/model",
+ "github.com/openzipkin/zipkin-go/reporter",
+ "github.com/openzipkin/zipkin-go/reporter/http",
+ "github.com/prometheus/client_golang/prometheus",
+ "github.com/prometheus/client_golang/prometheus/promhttp",
+ "golang.org/x/net/context",
+ "golang.org/x/net/http2",
+ "google.golang.org/api/support/bundler",
+ "google.golang.org/grpc",
+ "google.golang.org/grpc/codes",
+ "google.golang.org/grpc/grpclog",
+ "google.golang.org/grpc/metadata",
+ "google.golang.org/grpc/stats",
+ "google.golang.org/grpc/status",
+ ]
+ solver-name = "gps-cdcl"
+ solver-version = 1
diff --git a/vendor/go.opencensus.io/Gopkg.toml b/vendor/go.opencensus.io/Gopkg.toml
new file mode 100644
index 000000000..a9f3cd68e
--- /dev/null
+++ b/vendor/go.opencensus.io/Gopkg.toml
@@ -0,0 +1,36 @@
+# For v0.x.y dependencies, prefer adding a constraints of the form: version=">= 0.x.y"
+# to avoid locking to a particular minor version which can cause dep to not be
+# able to find a satisfying dependency graph.
+
+[[constraint]]
+ branch = "master"
+ name = "git.apache.org/thrift.git"
+ source = "github.com/apache/thrift"
+
+[[constraint]]
+ name = "github.com/golang/protobuf"
+ version = "1.0.0"
+
+[[constraint]]
+ name = "github.com/openzipkin/zipkin-go"
+ version = ">=0.1.0"
+
+[[constraint]]
+ name = "github.com/prometheus/client_golang"
+ version = ">=0.8.0"
+
+[[constraint]]
+ branch = "master"
+ name = "golang.org/x/net"
+
+[[constraint]]
+ branch = "master"
+ name = "google.golang.org/api"
+
+[[constraint]]
+ name = "google.golang.org/grpc"
+ version = "1.11.3"
+
+[prune]
+ go-tests = true
+ unused-packages = true
diff --git a/vendor/go.opencensus.io/LICENSE b/vendor/go.opencensus.io/LICENSE
new file mode 100644
index 000000000..7a4a3ea24
--- /dev/null
+++ b/vendor/go.opencensus.io/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License. \ No newline at end of file
diff --git a/vendor/go.opencensus.io/Makefile b/vendor/go.opencensus.io/Makefile
new file mode 100644
index 000000000..457866cb1
--- /dev/null
+++ b/vendor/go.opencensus.io/Makefile
@@ -0,0 +1,96 @@
+# TODO: Fix this on windows.
+ALL_SRC := $(shell find . -name '*.go' \
+ -not -path './vendor/*' \
+ -not -path '*/gen-go/*' \
+ -type f | sort)
+ALL_PKGS := $(shell go list $(sort $(dir $(ALL_SRC))))
+
+GOTEST_OPT?=-v -race -timeout 30s
+GOTEST_OPT_WITH_COVERAGE = $(GOTEST_OPT) -coverprofile=coverage.txt -covermode=atomic
+GOTEST=go test
+GOFMT=gofmt
+GOLINT=golint
+GOVET=go vet
+EMBEDMD=embedmd
+# TODO decide if we need to change these names.
+TRACE_ID_LINT_EXCEPTION="type name will be used as trace.TraceID by other packages"
+TRACE_OPTION_LINT_EXCEPTION="type name will be used as trace.TraceOptions by other packages"
+README_FILES := $(shell find . -name '*README.md' | sort | tr '\n' ' ')
+
+.DEFAULT_GOAL := fmt-lint-vet-embedmd-test
+
+.PHONY: fmt-lint-vet-embedmd-test
+fmt-lint-vet-embedmd-test: fmt lint vet embedmd test
+
+# TODO enable test-with-coverage in tavis
+.PHONY: travis-ci
+travis-ci: fmt lint vet embedmd test test-386
+
+all-pkgs:
+ @echo $(ALL_PKGS) | tr ' ' '\n' | sort
+
+all-srcs:
+ @echo $(ALL_SRC) | tr ' ' '\n' | sort
+
+.PHONY: test
+test:
+ $(GOTEST) $(GOTEST_OPT) $(ALL_PKGS)
+
+.PHONY: test-386
+test-386:
+ GOARCH=386 $(GOTEST) -v -timeout 30s $(ALL_PKGS)
+
+.PHONY: test-with-coverage
+test-with-coverage:
+ $(GOTEST) $(GOTEST_OPT_WITH_COVERAGE) $(ALL_PKGS)
+
+.PHONY: fmt
+fmt:
+ @FMTOUT=`$(GOFMT) -s -l $(ALL_SRC) 2>&1`; \
+ if [ "$$FMTOUT" ]; then \
+ echo "$(GOFMT) FAILED => gofmt the following files:\n"; \
+ echo "$$FMTOUT\n"; \
+ exit 1; \
+ else \
+ echo "Fmt finished successfully"; \
+ fi
+
+.PHONY: lint
+lint:
+ @LINTOUT=`$(GOLINT) $(ALL_PKGS) | grep -v $(TRACE_ID_LINT_EXCEPTION) | grep -v $(TRACE_OPTION_LINT_EXCEPTION) 2>&1`; \
+ if [ "$$LINTOUT" ]; then \
+ echo "$(GOLINT) FAILED => clean the following lint errors:\n"; \
+ echo "$$LINTOUT\n"; \
+ exit 1; \
+ else \
+ echo "Lint finished successfully"; \
+ fi
+
+.PHONY: vet
+vet:
+ # TODO: Understand why go vet downloads "github.com/google/go-cmp v0.2.0"
+ @VETOUT=`$(GOVET) ./... | grep -v "go: downloading" 2>&1`; \
+ if [ "$$VETOUT" ]; then \
+ echo "$(GOVET) FAILED => go vet the following files:\n"; \
+ echo "$$VETOUT\n"; \
+ exit 1; \
+ else \
+ echo "Vet finished successfully"; \
+ fi
+
+.PHONY: embedmd
+embedmd:
+ @EMBEDMDOUT=`$(EMBEDMD) -d $(README_FILES) 2>&1`; \
+ if [ "$$EMBEDMDOUT" ]; then \
+ echo "$(EMBEDMD) FAILED => embedmd the following files:\n"; \
+ echo "$$EMBEDMDOUT\n"; \
+ exit 1; \
+ else \
+ echo "Embedmd finished successfully"; \
+ fi
+
+.PHONY: install-tools
+install-tools:
+ go get -u golang.org/x/tools/cmd/cover
+ go get -u golang.org/x/lint/golint
+ go get -u github.com/rakyll/embedmd
diff --git a/vendor/go.opencensus.io/README.md b/vendor/go.opencensus.io/README.md
new file mode 100644
index 000000000..fabab2e06
--- /dev/null
+++ b/vendor/go.opencensus.io/README.md
@@ -0,0 +1,263 @@
+# OpenCensus Libraries for Go
+
+[![Build Status][travis-image]][travis-url]
+[![Windows Build Status][appveyor-image]][appveyor-url]
+[![GoDoc][godoc-image]][godoc-url]
+[![Gitter chat][gitter-image]][gitter-url]
+
+OpenCensus Go is a Go implementation of OpenCensus, a toolkit for
+collecting application performance and behavior monitoring data.
+Currently it consists of three major components: tags, stats and tracing.
+
+## Installation
+
+```
+$ go get -u go.opencensus.io
+```
+
+The API of this project is still evolving, see: [Deprecation Policy](#deprecation-policy).
+The use of vendoring or a dependency management tool is recommended.
+
+## Prerequisites
+
+OpenCensus Go libraries require Go 1.8 or later.
+
+## Getting Started
+
+The easiest way to get started using OpenCensus in your application is to use an existing
+integration with your RPC framework:
+
+* [net/http](https://godoc.org/go.opencensus.io/plugin/ochttp)
+* [gRPC](https://godoc.org/go.opencensus.io/plugin/ocgrpc)
+* [database/sql](https://godoc.org/github.com/opencensus-integrations/ocsql)
+* [Go kit](https://godoc.org/github.com/go-kit/kit/tracing/opencensus)
+* [Groupcache](https://godoc.org/github.com/orijtech/groupcache)
+* [Caddy webserver](https://godoc.org/github.com/orijtech/caddy)
+* [MongoDB](https://godoc.org/github.com/orijtech/mongo-go-driver)
+* [Redis gomodule/redigo](https://godoc.org/github.com/orijtech/redigo)
+* [Redis goredis/redis](https://godoc.org/github.com/orijtech/redis)
+* [Memcache](https://godoc.org/github.com/orijtech/gomemcache)
+
+If you're using a framework not listed here, you could either implement your own middleware for your
+framework or use [custom stats](#stats) and [spans](#spans) directly in your application.
+
+## Exporters
+
+OpenCensus can export instrumentation data to various backends.
+OpenCensus has exporter implementations for the following, users
+can implement their own exporters by implementing the exporter interfaces
+([stats](https://godoc.org/go.opencensus.io/stats/view#Exporter),
+[trace](https://godoc.org/go.opencensus.io/trace#Exporter)):
+
+* [Prometheus][exporter-prom] for stats
+* [OpenZipkin][exporter-zipkin] for traces
+* [Stackdriver][exporter-stackdriver] Monitoring for stats and Trace for traces
+* [Jaeger][exporter-jaeger] for traces
+* [AWS X-Ray][exporter-xray] for traces
+* [Datadog][exporter-datadog] for stats and traces
+* [Graphite][exporter-graphite] for stats
+* [Honeycomb][exporter-honeycomb] for traces
+
+## Overview
+
+![OpenCensus Overview](https://i.imgur.com/cf4ElHE.jpg)
+
+In a microservices environment, a user request may go through
+multiple services until there is a response. OpenCensus allows
+you to instrument your services and collect diagnostics data all
+through your services end-to-end.
+
+## Tags
+
+Tags represent propagated key-value pairs. They are propagated using `context.Context`
+in the same process or can be encoded to be transmitted on the wire. Usually, this will
+be handled by an integration plugin, e.g. `ocgrpc.ServerHandler` and `ocgrpc.ClientHandler`
+for gRPC.
+
+Package `tag` allows adding or modifying tags in the current context.
+
+[embedmd]:# (internal/readme/tags.go new)
+```go
+ctx, err = tag.New(ctx,
+ tag.Insert(osKey, "macOS-10.12.5"),
+ tag.Upsert(userIDKey, "cde36753ed"),
+)
+if err != nil {
+ log.Fatal(err)
+}
+```
+
+## Stats
+
+OpenCensus is a low-overhead framework even if instrumentation is always enabled.
+In order to be so, it is optimized to make recording of data points fast
+and separate from the data aggregation.
+
+OpenCensus stats collection happens in two stages:
+
+* Definition of measures and recording of data points
+* Definition of views and aggregation of the recorded data
+
+### Recording
+
+Measurements are data points associated with a measure.
+Recording implicitly tags the set of Measurements with the tags from the
+provided context:
+
+[embedmd]:# (internal/readme/stats.go record)
+```go
+stats.Record(ctx, videoSize.M(102478))
+```
+
+### Views
+
+Views are how Measures are aggregated. You can think of them as queries over the
+set of recorded data points (measurements).
+
+Views have two parts: the tags to group by and the aggregation type used.
+
+Currently three types of aggregations are supported:
+* CountAggregation is used to count the number of times a sample was recorded.
+* DistributionAggregation is used to provide a histogram of the values of the samples.
+* SumAggregation is used to sum up all sample values.
+
+[embedmd]:# (internal/readme/stats.go aggs)
+```go
+distAgg := view.Distribution(1<<32, 2<<32, 3<<32)
+countAgg := view.Count()
+sumAgg := view.Sum()
+```
+
+Here we create a view with the DistributionAggregation over our measure.
+
+[embedmd]:# (internal/readme/stats.go view)
+```go
+if err := view.Register(&view.View{
+ Name: "example.com/video_size_distribution",
+ Description: "distribution of processed video size over time",
+ Measure: videoSize,
+ Aggregation: view.Distribution(1<<32, 2<<32, 3<<32),
+}); err != nil {
+ log.Fatalf("Failed to register view: %v", err)
+}
+```
+
+Register begins collecting data for the view. Registered views' data will be
+exported via the registered exporters.
+
+## Traces
+
+A distributed trace tracks the progression of a single user request as
+it is handled by the services and processes that make up an application.
+Each step is called a span in the trace. Spans include metadata about the step,
+including especially the time spent in the step, called the span’s latency.
+
+Below you see a trace and several spans underneath it.
+
+![Traces and spans](https://i.imgur.com/7hZwRVj.png)
+
+### Spans
+
+Span is the unit step in a trace. Each span has a name, latency, status and
+additional metadata.
+
+Below we are starting a span for a cache read and ending it
+when we are done:
+
+[embedmd]:# (internal/readme/trace.go startend)
+```go
+ctx, span := trace.StartSpan(ctx, "cache.Get")
+defer span.End()
+
+// Do work to get from cache.
+```
+
+### Propagation
+
+Spans can have parents or can be root spans if they don't have any parents.
+The current span is propagated in-process and across the network to allow associating
+new child spans with the parent.
+
+In the same process, `context.Context` is used to propagate spans.
+`trace.StartSpan` creates a new span as a root if the current context
+doesn't contain a span. Or, it creates a child of the span that is
+already in current context. The returned context can be used to keep
+propagating the newly created span in the current context.
+
+[embedmd]:# (internal/readme/trace.go startend)
+```go
+ctx, span := trace.StartSpan(ctx, "cache.Get")
+defer span.End()
+
+// Do work to get from cache.
+```
+
+Across the network, OpenCensus provides different propagation
+methods for different protocols.
+
+* gRPC integrations use the OpenCensus' [binary propagation format](https://godoc.org/go.opencensus.io/trace/propagation).
+* HTTP integrations use Zipkin's [B3](https://github.com/openzipkin/b3-propagation)
+ by default but can be configured to use a custom propagation method by setting another
+ [propagation.HTTPFormat](https://godoc.org/go.opencensus.io/trace/propagation#HTTPFormat).
+
+## Execution Tracer
+
+With Go 1.11, OpenCensus Go will support integration with the Go execution tracer.
+See [Debugging Latency in Go](https://medium.com/observability/debugging-latency-in-go-1-11-9f97a7910d68)
+for an example of their mutual use.
+
+## Profiles
+
+OpenCensus tags can be applied as profiler labels
+for users who are on Go 1.9 and above.
+
+[embedmd]:# (internal/readme/tags.go profiler)
+```go
+ctx, err = tag.New(ctx,
+ tag.Insert(osKey, "macOS-10.12.5"),
+ tag.Insert(userIDKey, "fff0989878"),
+)
+if err != nil {
+ log.Fatal(err)
+}
+tag.Do(ctx, func(ctx context.Context) {
+ // Do work.
+ // When profiling is on, samples will be
+ // recorded with the key/values from the tag map.
+})
+```
+
+A screenshot of the CPU profile from the program above:
+
+![CPU profile](https://i.imgur.com/jBKjlkw.png)
+
+## Deprecation Policy
+
+Before version 1.0.0, the following deprecation policy will be observed:
+
+No backwards-incompatible changes will be made except for the removal of symbols that have
+been marked as *Deprecated* for at least one minor release (e.g. 0.9.0 to 0.10.0). A release
+removing the *Deprecated* functionality will be made no sooner than 28 days after the first
+release in which the functionality was marked *Deprecated*.
+
+[travis-image]: https://travis-ci.org/census-instrumentation/opencensus-go.svg?branch=master
+[travis-url]: https://travis-ci.org/census-instrumentation/opencensus-go
+[appveyor-image]: https://ci.appveyor.com/api/projects/status/vgtt29ps1783ig38?svg=true
+[appveyor-url]: https://ci.appveyor.com/project/opencensusgoteam/opencensus-go/branch/master
+[godoc-image]: https://godoc.org/go.opencensus.io?status.svg
+[godoc-url]: https://godoc.org/go.opencensus.io
+[gitter-image]: https://badges.gitter.im/census-instrumentation/lobby.svg
+[gitter-url]: https://gitter.im/census-instrumentation/lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
+
+
+[new-ex]: https://godoc.org/go.opencensus.io/tag#example-NewMap
+[new-replace-ex]: https://godoc.org/go.opencensus.io/tag#example-NewMap--Replace
+
+[exporter-prom]: https://godoc.org/contrib.go.opencensus.io/exporter/prometheus
+[exporter-stackdriver]: https://godoc.org/contrib.go.opencensus.io/exporter/stackdriver
+[exporter-zipkin]: https://godoc.org/contrib.go.opencensus.io/exporter/zipkin
+[exporter-jaeger]: https://godoc.org/contrib.go.opencensus.io/exporter/jaeger
+[exporter-xray]: https://github.com/census-ecosystem/opencensus-go-exporter-aws
+[exporter-datadog]: https://github.com/DataDog/opencensus-go-exporter-datadog
+[exporter-graphite]: https://github.com/census-ecosystem/opencensus-go-exporter-graphite
+[exporter-honeycomb]: https://github.com/honeycombio/opencensus-exporter
diff --git a/vendor/go.opencensus.io/appveyor.yml b/vendor/go.opencensus.io/appveyor.yml
new file mode 100644
index 000000000..12bd7c4c7
--- /dev/null
+++ b/vendor/go.opencensus.io/appveyor.yml
@@ -0,0 +1,25 @@
+version: "{build}"
+
+platform: x64
+
+clone_folder: c:\gopath\src\go.opencensus.io
+
+environment:
+ GOPATH: 'c:\gopath'
+ GOVERSION: '1.11'
+ GO111MODULE: 'on'
+ CGO_ENABLED: '0' # See: https://github.com/appveyor/ci/issues/2613
+
+install:
+ - set PATH=%GOPATH%\bin;c:\go\bin;%PATH%
+ - choco upgrade golang --version 1.11.5 # Temporary fix because of a go.sum bug in 1.11
+ - go version
+ - go env
+
+build: false
+deploy: false
+
+test_script:
+ - cd %APPVEYOR_BUILD_FOLDER%
+ - go build -v .\...
+ - go test -v .\... # No -race because cgo is disabled
diff --git a/vendor/go.opencensus.io/go.mod b/vendor/go.opencensus.io/go.mod
new file mode 100644
index 000000000..cb4de80f3
--- /dev/null
+++ b/vendor/go.opencensus.io/go.mod
@@ -0,0 +1,12 @@
+module go.opencensus.io
+
+require (
+ github.com/golang/protobuf v1.3.1
+ github.com/google/go-cmp v0.3.0
+ github.com/hashicorp/golang-lru v0.5.1
+ golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09
+ golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd // indirect
+ golang.org/x/text v0.3.2 // indirect
+ google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb // indirect
+ google.golang.org/grpc v1.20.1
+)
diff --git a/vendor/go.opencensus.io/go.sum b/vendor/go.opencensus.io/go.sum
new file mode 100644
index 000000000..0b948c2b4
--- /dev/null
+++ b/vendor/go.opencensus.io/go.sum
@@ -0,0 +1,61 @@
+cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
+github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
+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/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
+github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
+github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
+github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
+github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=
+github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
+golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
+golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
+golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09 h1:KaQtG+aDELoNmXYas3TVkGNYRuq8JQ1aa7LJt8EXVyo=
+golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
+golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
+golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20181108010431-42b317875d0f h1:Bl/8QSvNqXvPGPGXa2z5xUTmV7VDcZyvRZ+QQXkXTZQ=
+golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6 h1:bjcUS9ztw9kFmmIxJInhon/0Is3p+EHBKNgquIzo1OI=
+golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd h1:r7DufRZuZbWB7j439YfAzP8RPDa9unLkpwQKUYbIMPI=
+golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
+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=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
+golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
+golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
+google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+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-20190425155659-357c62f0e4bb h1:i1Ppqkc3WQXikh8bXiwHqAN5Rv3/qDCcRk0/Otx73BY=
+google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
+google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8=
+google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8=
+google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
+google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
+google.golang.org/grpc v1.20.1 h1:Hz2g2wirWK7H0qIIhGIqRGTuMwTE8HEKFnDZZ7lm9NU=
+google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
+honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
diff --git a/vendor/go.opencensus.io/internal/internal.go b/vendor/go.opencensus.io/internal/internal.go
new file mode 100644
index 000000000..9a638781c
--- /dev/null
+++ b/vendor/go.opencensus.io/internal/internal.go
@@ -0,0 +1,37 @@
+// Copyright 2017, OpenCensus Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package internal // import "go.opencensus.io/internal"
+
+import (
+ "fmt"
+ "time"
+
+ opencensus "go.opencensus.io"
+)
+
+// UserAgent is the user agent to be added to the outgoing
+// requests from the exporters.
+var UserAgent = fmt.Sprintf("opencensus-go/%s", opencensus.Version())
+
+// MonotonicEndTime returns the end time at present
+// but offset from start, monotonically.
+//
+// The monotonic clock is used in subtractions hence
+// the duration since start added back to start gives
+// end as a monotonic time.
+// See https://golang.org/pkg/time/#hdr-Monotonic_Clocks
+func MonotonicEndTime(start time.Time) time.Time {
+ return start.Add(time.Now().Sub(start))
+}
diff --git a/vendor/go.opencensus.io/internal/sanitize.go b/vendor/go.opencensus.io/internal/sanitize.go
new file mode 100644
index 000000000..de8ccf236
--- /dev/null
+++ b/vendor/go.opencensus.io/internal/sanitize.go
@@ -0,0 +1,50 @@
+// Copyright 2017, OpenCensus Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package internal
+
+import (
+ "strings"
+ "unicode"
+)
+
+const labelKeySizeLimit = 100
+
+// Sanitize returns a string that is trunacated to 100 characters if it's too
+// long, and replaces non-alphanumeric characters to underscores.
+func Sanitize(s string) string {
+ if len(s) == 0 {
+ return s
+ }
+ if len(s) > labelKeySizeLimit {
+ s = s[:labelKeySizeLimit]
+ }
+ s = strings.Map(sanitizeRune, s)
+ if unicode.IsDigit(rune(s[0])) {
+ s = "key_" + s
+ }
+ if s[0] == '_' {
+ s = "key" + s
+ }
+ return s
+}
+
+// converts anything that is not a letter or digit to an underscore
+func sanitizeRune(r rune) rune {
+ if unicode.IsLetter(r) || unicode.IsDigit(r) {
+ return r
+ }
+ // Everything else turns into an underscore
+ return '_'
+}
diff --git a/vendor/go.opencensus.io/internal/traceinternals.go b/vendor/go.opencensus.io/internal/traceinternals.go
new file mode 100644
index 000000000..073af7b47
--- /dev/null
+++ b/vendor/go.opencensus.io/internal/traceinternals.go
@@ -0,0 +1,53 @@
+// Copyright 2017, OpenCensus Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package internal
+
+import (
+ "time"
+)
+
+// Trace allows internal access to some trace functionality.
+// TODO(#412): remove this
+var Trace interface{}
+
+// LocalSpanStoreEnabled true if the local span store is enabled.
+var LocalSpanStoreEnabled bool
+
+// BucketConfiguration stores the number of samples to store for span buckets
+// for successful and failed spans for a particular span name.
+type BucketConfiguration struct {
+ Name string
+ MaxRequestsSucceeded int
+ MaxRequestsErrors int
+}
+
+// PerMethodSummary is a summary of the spans stored for a single span name.
+type PerMethodSummary struct {
+ Active int
+ LatencyBuckets []LatencyBucketSummary
+ ErrorBuckets []ErrorBucketSummary
+}
+
+// LatencyBucketSummary is a summary of a latency bucket.
+type LatencyBucketSummary struct {
+ MinLatency, MaxLatency time.Duration
+ Size int
+}
+
+// ErrorBucketSummary is a summary of an error bucket.
+type ErrorBucketSummary struct {
+ ErrorCode int32
+ Size int
+}
diff --git a/vendor/go.opencensus.io/opencensus.go b/vendor/go.opencensus.io/opencensus.go
new file mode 100644
index 000000000..626d73645
--- /dev/null
+++ b/vendor/go.opencensus.io/opencensus.go
@@ -0,0 +1,21 @@
+// Copyright 2017, OpenCensus Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package opencensus contains Go support for OpenCensus.
+package opencensus // import "go.opencensus.io"
+
+// Version is the current release version of OpenCensus in use.
+func Version() string {
+ return "0.22.0"
+}
diff --git a/vendor/go.opencensus.io/trace/basetypes.go b/vendor/go.opencensus.io/trace/basetypes.go
new file mode 100644
index 000000000..0c54492a2
--- /dev/null
+++ b/vendor/go.opencensus.io/trace/basetypes.go
@@ -0,0 +1,119 @@
+// Copyright 2017, OpenCensus Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package trace
+
+import (
+ "fmt"
+ "time"
+)
+
+type (
+ // TraceID is a 16-byte identifier for a set of spans.
+ TraceID [16]byte
+
+ // SpanID is an 8-byte identifier for a single span.
+ SpanID [8]byte
+)
+
+func (t TraceID) String() string {
+ return fmt.Sprintf("%02x", t[:])
+}
+
+func (s SpanID) String() string {
+ return fmt.Sprintf("%02x", s[:])
+}
+
+// Annotation represents a text annotation with a set of attributes and a timestamp.
+type Annotation struct {
+ Time time.Time
+ Message string
+ Attributes map[string]interface{}
+}
+
+// Attribute represents a key-value pair on a span, link or annotation.
+// Construct with one of: BoolAttribute, Int64Attribute, or StringAttribute.
+type Attribute struct {
+ key string
+ value interface{}
+}
+
+// BoolAttribute returns a bool-valued attribute.
+func BoolAttribute(key string, value bool) Attribute {
+ return Attribute{key: key, value: value}
+}
+
+// Int64Attribute returns an int64-valued attribute.
+func Int64Attribute(key string, value int64) Attribute {
+ return Attribute{key: key, value: value}
+}
+
+// Float64Attribute returns a float64-valued attribute.
+func Float64Attribute(key string, value float64) Attribute {
+ return Attribute{key: key, value: value}
+}
+
+// StringAttribute returns a string-valued attribute.
+func StringAttribute(key string, value string) Attribute {
+ return Attribute{key: key, value: value}
+}
+
+// LinkType specifies the relationship between the span that had the link
+// added, and the linked span.
+type LinkType int32
+
+// LinkType values.
+const (
+ LinkTypeUnspecified LinkType = iota // The relationship of the two spans is unknown.
+ LinkTypeChild // The linked span is a child of the current span.
+ LinkTypeParent // The linked span is the parent of the current span.
+)
+
+// Link represents a reference from one span to another span.
+type Link struct {
+ TraceID TraceID
+ SpanID SpanID
+ Type LinkType
+ // Attributes is a set of attributes on the link.
+ Attributes map[string]interface{}
+}
+
+// MessageEventType specifies the type of message event.
+type MessageEventType int32
+
+// MessageEventType values.
+const (
+ MessageEventTypeUnspecified MessageEventType = iota // Unknown event type.
+ MessageEventTypeSent // Indicates a sent RPC message.
+ MessageEventTypeRecv // Indicates a received RPC message.
+)
+
+// MessageEvent represents an event describing a message sent or received on the network.
+type MessageEvent struct {
+ Time time.Time
+ EventType MessageEventType
+ MessageID int64
+ UncompressedByteSize int64
+ CompressedByteSize int64
+}
+
+// Status is the status of a Span.
+type Status struct {
+ // Code is a status code. Zero indicates success.
+ //
+ // If Code will be propagated to Google APIs, it ideally should be a value from
+ // https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto .
+ Code int32
+ Message string
+}
diff --git a/vendor/go.opencensus.io/trace/config.go b/vendor/go.opencensus.io/trace/config.go
new file mode 100644
index 000000000..775f8274f
--- /dev/null
+++ b/vendor/go.opencensus.io/trace/config.go
@@ -0,0 +1,86 @@
+// Copyright 2018, OpenCensus Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package trace
+
+import (
+ "sync"
+
+ "go.opencensus.io/trace/internal"
+)
+
+// Config represents the global tracing configuration.
+type Config struct {
+ // DefaultSampler is the default sampler used when creating new spans.
+ DefaultSampler Sampler
+
+ // IDGenerator is for internal use only.
+ IDGenerator internal.IDGenerator
+
+ // MaxAnnotationEventsPerSpan is max number of annotation events per span
+ MaxAnnotationEventsPerSpan int
+
+ // MaxMessageEventsPerSpan is max number of message events per span
+ MaxMessageEventsPerSpan int
+
+ // MaxAnnotationEventsPerSpan is max number of attributes per span
+ MaxAttributesPerSpan int
+
+ // MaxLinksPerSpan is max number of links per span
+ MaxLinksPerSpan int
+}
+
+var configWriteMu sync.Mutex
+
+const (
+ // DefaultMaxAnnotationEventsPerSpan is default max number of annotation events per span
+ DefaultMaxAnnotationEventsPerSpan = 32
+
+ // DefaultMaxMessageEventsPerSpan is default max number of message events per span
+ DefaultMaxMessageEventsPerSpan = 128
+
+ // DefaultMaxAttributesPerSpan is default max number of attributes per span
+ DefaultMaxAttributesPerSpan = 32
+
+ // DefaultMaxLinksPerSpan is default max number of links per span
+ DefaultMaxLinksPerSpan = 32
+)
+
+// ApplyConfig applies changes to the global tracing configuration.
+//
+// Fields not provided in the given config are going to be preserved.
+func ApplyConfig(cfg Config) {
+ configWriteMu.Lock()
+ defer configWriteMu.Unlock()
+ c := *config.Load().(*Config)
+ if cfg.DefaultSampler != nil {
+ c.DefaultSampler = cfg.DefaultSampler
+ }
+ if cfg.IDGenerator != nil {
+ c.IDGenerator = cfg.IDGenerator
+ }
+ if cfg.MaxAnnotationEventsPerSpan > 0 {
+ c.MaxAnnotationEventsPerSpan = cfg.MaxAnnotationEventsPerSpan
+ }
+ if cfg.MaxMessageEventsPerSpan > 0 {
+ c.MaxMessageEventsPerSpan = cfg.MaxMessageEventsPerSpan
+ }
+ if cfg.MaxAttributesPerSpan > 0 {
+ c.MaxAttributesPerSpan = cfg.MaxAttributesPerSpan
+ }
+ if cfg.MaxLinksPerSpan > 0 {
+ c.MaxLinksPerSpan = cfg.MaxLinksPerSpan
+ }
+ config.Store(&c)
+}
diff --git a/vendor/go.opencensus.io/trace/doc.go b/vendor/go.opencensus.io/trace/doc.go
new file mode 100644
index 000000000..04b1ee4f3
--- /dev/null
+++ b/vendor/go.opencensus.io/trace/doc.go
@@ -0,0 +1,53 @@
+// Copyright 2017, OpenCensus Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+/*
+Package trace contains support for OpenCensus distributed tracing.
+
+The following assumes a basic familiarity with OpenCensus concepts.
+See http://opencensus.io
+
+
+Exporting Traces
+
+To export collected tracing data, register at least one exporter. You can use
+one of the provided exporters or write your own.
+
+ trace.RegisterExporter(exporter)
+
+By default, traces will be sampled relatively rarely. To change the sampling
+frequency for your entire program, call ApplyConfig. Use a ProbabilitySampler
+to sample a subset of traces, or use AlwaysSample to collect a trace on every run:
+
+ trace.ApplyConfig(trace.Config{DefaultSampler: trace.AlwaysSample()})
+
+Be careful about using trace.AlwaysSample in a production application with
+significant traffic: a new trace will be started and exported for every request.
+
+Adding Spans to a Trace
+
+A trace consists of a tree of spans. In Go, the current span is carried in a
+context.Context.
+
+It is common to want to capture all the activity of a function call in a span. For
+this to work, the function must take a context.Context as a parameter. Add these two
+lines to the top of the function:
+
+ ctx, span := trace.StartSpan(ctx, "example.com/Run")
+ defer span.End()
+
+StartSpan will create a new top-level span if the context
+doesn't contain another span, otherwise it will create a child span.
+*/
+package trace // import "go.opencensus.io/trace"
diff --git a/vendor/go.opencensus.io/trace/evictedqueue.go b/vendor/go.opencensus.io/trace/evictedqueue.go
new file mode 100644
index 000000000..ffc264f23
--- /dev/null
+++ b/vendor/go.opencensus.io/trace/evictedqueue.go
@@ -0,0 +1,38 @@
+// Copyright 2019, OpenCensus Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package trace
+
+type evictedQueue struct {
+ queue []interface{}
+ capacity int
+ droppedCount int
+}
+
+func newEvictedQueue(capacity int) *evictedQueue {
+ eq := &evictedQueue{
+ capacity: capacity,
+ queue: make([]interface{}, 0),
+ }
+
+ return eq
+}
+
+func (eq *evictedQueue) add(value interface{}) {
+ if len(eq.queue) == eq.capacity {
+ eq.queue = eq.queue[1:]
+ eq.droppedCount++
+ }
+ eq.queue = append(eq.queue, value)
+}
diff --git a/vendor/go.opencensus.io/trace/export.go b/vendor/go.opencensus.io/trace/export.go
new file mode 100644
index 000000000..e0d9a4b99
--- /dev/null
+++ b/vendor/go.opencensus.io/trace/export.go
@@ -0,0 +1,97 @@
+// Copyright 2017, OpenCensus Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package trace
+
+import (
+ "sync"
+ "sync/atomic"
+ "time"
+)
+
+// Exporter is a type for functions that receive sampled trace spans.
+//
+// The ExportSpan method should be safe for concurrent use and should return
+// quickly; if an Exporter takes a significant amount of time to process a
+// SpanData, that work should be done on another goroutine.
+//
+// The SpanData should not be modified, but a pointer to it can be kept.
+type Exporter interface {
+ ExportSpan(s *SpanData)
+}
+
+type exportersMap map[Exporter]struct{}
+
+var (
+ exporterMu sync.Mutex
+ exporters atomic.Value
+)
+
+// RegisterExporter adds to the list of Exporters that will receive sampled
+// trace spans.
+//
+// Binaries can register exporters, libraries shouldn't register exporters.
+func RegisterExporter(e Exporter) {
+ exporterMu.Lock()
+ new := make(exportersMap)
+ if old, ok := exporters.Load().(exportersMap); ok {
+ for k, v := range old {
+ new[k] = v
+ }
+ }
+ new[e] = struct{}{}
+ exporters.Store(new)
+ exporterMu.Unlock()
+}
+
+// UnregisterExporter removes from the list of Exporters the Exporter that was
+// registered with the given name.
+func UnregisterExporter(e Exporter) {
+ exporterMu.Lock()
+ new := make(exportersMap)
+ if old, ok := exporters.Load().(exportersMap); ok {
+ for k, v := range old {
+ new[k] = v
+ }
+ }
+ delete(new, e)
+ exporters.Store(new)
+ exporterMu.Unlock()
+}
+
+// SpanData contains all the information collected by a Span.
+type SpanData struct {
+ SpanContext
+ ParentSpanID SpanID
+ SpanKind int
+ Name string
+ StartTime time.Time
+ // The wall clock time of EndTime will be adjusted to always be offset
+ // from StartTime by the duration of the span.
+ EndTime time.Time
+ // The values of Attributes each have type string, bool, or int64.
+ Attributes map[string]interface{}
+ Annotations []Annotation
+ MessageEvents []MessageEvent
+ Status
+ Links []Link
+ HasRemoteParent bool
+ DroppedAttributeCount int
+ DroppedAnnotationCount int
+ DroppedMessageEventCount int
+ DroppedLinkCount int
+
+ // ChildSpanCount holds the number of child span created for this span.
+ ChildSpanCount int
+}
diff --git a/vendor/go.opencensus.io/trace/internal/internal.go b/vendor/go.opencensus.io/trace/internal/internal.go
new file mode 100644
index 000000000..7e808d8f3
--- /dev/null
+++ b/vendor/go.opencensus.io/trace/internal/internal.go
@@ -0,0 +1,22 @@
+// Copyright 2018, OpenCensus Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package internal provides trace internals.
+package internal
+
+// IDGenerator allows custom generators for TraceId and SpanId.
+type IDGenerator interface {
+ NewTraceID() [16]byte
+ NewSpanID() [8]byte
+}
diff --git a/vendor/go.opencensus.io/trace/lrumap.go b/vendor/go.opencensus.io/trace/lrumap.go
new file mode 100644
index 000000000..3f80a3368
--- /dev/null
+++ b/vendor/go.opencensus.io/trace/lrumap.go
@@ -0,0 +1,37 @@
+// Copyright 2019, OpenCensus Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package trace
+
+import (
+ "github.com/hashicorp/golang-lru/simplelru"
+)
+
+type lruMap struct {
+ simpleLruMap *simplelru.LRU
+ droppedCount int
+}
+
+func newLruMap(size int) *lruMap {
+ lm := &lruMap{}
+ lm.simpleLruMap, _ = simplelru.NewLRU(size, nil)
+ return lm
+}
+
+func (lm *lruMap) add(key, value interface{}) {
+ evicted := lm.simpleLruMap.Add(key, value)
+ if evicted {
+ lm.droppedCount++
+ }
+}
diff --git a/vendor/go.opencensus.io/trace/sampling.go b/vendor/go.opencensus.io/trace/sampling.go
new file mode 100644
index 000000000..71c10f9e3
--- /dev/null
+++ b/vendor/go.opencensus.io/trace/sampling.go
@@ -0,0 +1,75 @@
+// Copyright 2017, OpenCensus Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package trace
+
+import (
+ "encoding/binary"
+)
+
+const defaultSamplingProbability = 1e-4
+
+// Sampler decides whether a trace should be sampled and exported.
+type Sampler func(SamplingParameters) SamplingDecision
+
+// SamplingParameters contains the values passed to a Sampler.
+type SamplingParameters struct {
+ ParentContext SpanContext
+ TraceID TraceID
+ SpanID SpanID
+ Name string
+ HasRemoteParent bool
+}
+
+// SamplingDecision is the value returned by a Sampler.
+type SamplingDecision struct {
+ Sample bool
+}
+
+// ProbabilitySampler returns a Sampler that samples a given fraction of traces.
+//
+// It also samples spans whose parents are sampled.
+func ProbabilitySampler(fraction float64) Sampler {
+ if !(fraction >= 0) {
+ fraction = 0
+ } else if fraction >= 1 {
+ return AlwaysSample()
+ }
+
+ traceIDUpperBound := uint64(fraction * (1 << 63))
+ return Sampler(func(p SamplingParameters) SamplingDecision {
+ if p.ParentContext.IsSampled() {
+ return SamplingDecision{Sample: true}
+ }
+ x := binary.BigEndian.Uint64(p.TraceID[0:8]) >> 1
+ return SamplingDecision{Sample: x < traceIDUpperBound}
+ })
+}
+
+// AlwaysSample returns a Sampler that samples every trace.
+// Be careful about using this sampler in a production application with
+// significant traffic: a new trace will be started and exported for every
+// request.
+func AlwaysSample() Sampler {
+ return func(p SamplingParameters) SamplingDecision {
+ return SamplingDecision{Sample: true}
+ }
+}
+
+// NeverSample returns a Sampler that samples no traces.
+func NeverSample() Sampler {
+ return func(p SamplingParameters) SamplingDecision {
+ return SamplingDecision{Sample: false}
+ }
+}
diff --git a/vendor/go.opencensus.io/trace/spanbucket.go b/vendor/go.opencensus.io/trace/spanbucket.go
new file mode 100644
index 000000000..fbabad34c
--- /dev/null
+++ b/vendor/go.opencensus.io/trace/spanbucket.go
@@ -0,0 +1,130 @@
+// Copyright 2017, OpenCensus Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package trace
+
+import (
+ "time"
+)
+
+// samplePeriod is the minimum time between accepting spans in a single bucket.
+const samplePeriod = time.Second
+
+// defaultLatencies contains the default latency bucket bounds.
+// TODO: consider defaults, make configurable
+var defaultLatencies = [...]time.Duration{
+ 10 * time.Microsecond,
+ 100 * time.Microsecond,
+ time.Millisecond,
+ 10 * time.Millisecond,
+ 100 * time.Millisecond,
+ time.Second,
+ 10 * time.Second,
+ time.Minute,
+}
+
+// bucket is a container for a set of spans for a particular error code or latency range.
+type bucket struct {
+ nextTime time.Time // next time we can accept a span
+ buffer []*SpanData // circular buffer of spans
+ nextIndex int // location next SpanData should be placed in buffer
+ overflow bool // whether the circular buffer has wrapped around
+}
+
+func makeBucket(bufferSize int) bucket {
+ return bucket{
+ buffer: make([]*SpanData, bufferSize),
+ }
+}
+
+// add adds a span to the bucket, if nextTime has been reached.
+func (b *bucket) add(s *SpanData) {
+ if s.EndTime.Before(b.nextTime) {
+ return
+ }
+ if len(b.buffer) == 0 {
+ return
+ }
+ b.nextTime = s.EndTime.Add(samplePeriod)
+ b.buffer[b.nextIndex] = s
+ b.nextIndex++
+ if b.nextIndex == len(b.buffer) {
+ b.nextIndex = 0
+ b.overflow = true
+ }
+}
+
+// size returns the number of spans in the bucket.
+func (b *bucket) size() int {
+ if b.overflow {
+ return len(b.buffer)
+ }
+ return b.nextIndex
+}
+
+// span returns the ith span in the bucket.
+func (b *bucket) span(i int) *SpanData {
+ if !b.overflow {
+ return b.buffer[i]
+ }
+ if i < len(b.buffer)-b.nextIndex {
+ return b.buffer[b.nextIndex+i]
+ }
+ return b.buffer[b.nextIndex+i-len(b.buffer)]
+}
+
+// resize changes the size of the bucket to n, keeping up to n existing spans.
+func (b *bucket) resize(n int) {
+ cur := b.size()
+ newBuffer := make([]*SpanData, n)
+ if cur < n {
+ for i := 0; i < cur; i++ {
+ newBuffer[i] = b.span(i)
+ }
+ b.buffer = newBuffer
+ b.nextIndex = cur
+ b.overflow = false
+ return
+ }
+ for i := 0; i < n; i++ {
+ newBuffer[i] = b.span(i + cur - n)
+ }
+ b.buffer = newBuffer
+ b.nextIndex = 0
+ b.overflow = true
+}
+
+// latencyBucket returns the appropriate bucket number for a given latency.
+func latencyBucket(latency time.Duration) int {
+ i := 0
+ for i < len(defaultLatencies) && latency >= defaultLatencies[i] {
+ i++
+ }
+ return i
+}
+
+// latencyBucketBounds returns the lower and upper bounds for a latency bucket
+// number.
+//
+// The lower bound is inclusive, the upper bound is exclusive (except for the
+// last bucket.)
+func latencyBucketBounds(index int) (lower time.Duration, upper time.Duration) {
+ if index == 0 {
+ return 0, defaultLatencies[index]
+ }
+ if index == len(defaultLatencies) {
+ return defaultLatencies[index-1], 1<<63 - 1
+ }
+ return defaultLatencies[index-1], defaultLatencies[index]
+}
diff --git a/vendor/go.opencensus.io/trace/spanstore.go b/vendor/go.opencensus.io/trace/spanstore.go
new file mode 100644
index 000000000..c442d9902
--- /dev/null
+++ b/vendor/go.opencensus.io/trace/spanstore.go
@@ -0,0 +1,306 @@
+// Copyright 2017, OpenCensus Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package trace
+
+import (
+ "sync"
+ "time"
+
+ "go.opencensus.io/internal"
+)
+
+const (
+ maxBucketSize = 100000
+ defaultBucketSize = 10
+)
+
+var (
+ ssmu sync.RWMutex // protects spanStores
+ spanStores = make(map[string]*spanStore)
+)
+
+// This exists purely to avoid exposing internal methods used by z-Pages externally.
+type internalOnly struct{}
+
+func init() {
+ //TODO(#412): remove
+ internal.Trace = &internalOnly{}
+}
+
+// ReportActiveSpans returns the active spans for the given name.
+func (i internalOnly) ReportActiveSpans(name string) []*SpanData {
+ s := spanStoreForName(name)
+ if s == nil {
+ return nil
+ }
+ var out []*SpanData
+ s.mu.Lock()
+ defer s.mu.Unlock()
+ for span := range s.active {
+ out = append(out, span.makeSpanData())
+ }
+ return out
+}
+
+// ReportSpansByError returns a sample of error spans.
+//
+// If code is nonzero, only spans with that status code are returned.
+func (i internalOnly) ReportSpansByError(name string, code int32) []*SpanData {
+ s := spanStoreForName(name)
+ if s == nil {
+ return nil
+ }
+ var out []*SpanData
+ s.mu.Lock()
+ defer s.mu.Unlock()
+ if code != 0 {
+ if b, ok := s.errors[code]; ok {
+ for _, sd := range b.buffer {
+ if sd == nil {
+ break
+ }
+ out = append(out, sd)
+ }
+ }
+ } else {
+ for _, b := range s.errors {
+ for _, sd := range b.buffer {
+ if sd == nil {
+ break
+ }
+ out = append(out, sd)
+ }
+ }
+ }
+ return out
+}
+
+// ConfigureBucketSizes sets the number of spans to keep per latency and error
+// bucket for different span names.
+func (i internalOnly) ConfigureBucketSizes(bcs []internal.BucketConfiguration) {
+ for _, bc := range bcs {
+ latencyBucketSize := bc.MaxRequestsSucceeded
+ if latencyBucketSize < 0 {
+ latencyBucketSize = 0
+ }
+ if latencyBucketSize > maxBucketSize {
+ latencyBucketSize = maxBucketSize
+ }
+ errorBucketSize := bc.MaxRequestsErrors
+ if errorBucketSize < 0 {
+ errorBucketSize = 0
+ }
+ if errorBucketSize > maxBucketSize {
+ errorBucketSize = maxBucketSize
+ }
+ spanStoreSetSize(bc.Name, latencyBucketSize, errorBucketSize)
+ }
+}
+
+// ReportSpansPerMethod returns a summary of what spans are being stored for each span name.
+func (i internalOnly) ReportSpansPerMethod() map[string]internal.PerMethodSummary {
+ out := make(map[string]internal.PerMethodSummary)
+ ssmu.RLock()
+ defer ssmu.RUnlock()
+ for name, s := range spanStores {
+ s.mu.Lock()
+ p := internal.PerMethodSummary{
+ Active: len(s.active),
+ }
+ for code, b := range s.errors {
+ p.ErrorBuckets = append(p.ErrorBuckets, internal.ErrorBucketSummary{
+ ErrorCode: code,
+ Size: b.size(),
+ })
+ }
+ for i, b := range s.latency {
+ min, max := latencyBucketBounds(i)
+ p.LatencyBuckets = append(p.LatencyBuckets, internal.LatencyBucketSummary{
+ MinLatency: min,
+ MaxLatency: max,
+ Size: b.size(),
+ })
+ }
+ s.mu.Unlock()
+ out[name] = p
+ }
+ return out
+}
+
+// ReportSpansByLatency returns a sample of successful spans.
+//
+// minLatency is the minimum latency of spans to be returned.
+// maxLatency, if nonzero, is the maximum latency of spans to be returned.
+func (i internalOnly) ReportSpansByLatency(name string, minLatency, maxLatency time.Duration) []*SpanData {
+ s := spanStoreForName(name)
+ if s == nil {
+ return nil
+ }
+ var out []*SpanData
+ s.mu.Lock()
+ defer s.mu.Unlock()
+ for i, b := range s.latency {
+ min, max := latencyBucketBounds(i)
+ if i+1 != len(s.latency) && max <= minLatency {
+ continue
+ }
+ if maxLatency != 0 && maxLatency < min {
+ continue
+ }
+ for _, sd := range b.buffer {
+ if sd == nil {
+ break
+ }
+ if minLatency != 0 || maxLatency != 0 {
+ d := sd.EndTime.Sub(sd.StartTime)
+ if d < minLatency {
+ continue
+ }
+ if maxLatency != 0 && d > maxLatency {
+ continue
+ }
+ }
+ out = append(out, sd)
+ }
+ }
+ return out
+}
+
+// spanStore keeps track of spans stored for a particular span name.
+//
+// It contains all active spans; a sample of spans for failed requests,
+// categorized by error code; and a sample of spans for successful requests,
+// bucketed by latency.
+type spanStore struct {
+ mu sync.Mutex // protects everything below.
+ active map[*Span]struct{}
+ errors map[int32]*bucket
+ latency []bucket
+ maxSpansPerErrorBucket int
+}
+
+// newSpanStore creates a span store.
+func newSpanStore(name string, latencyBucketSize int, errorBucketSize int) *spanStore {
+ s := &spanStore{
+ active: make(map[*Span]struct{}),
+ latency: make([]bucket, len(defaultLatencies)+1),
+ maxSpansPerErrorBucket: errorBucketSize,
+ }
+ for i := range s.latency {
+ s.latency[i] = makeBucket(latencyBucketSize)
+ }
+ return s
+}
+
+// spanStoreForName returns the spanStore for the given name.
+//
+// It returns nil if it doesn't exist.
+func spanStoreForName(name string) *spanStore {
+ var s *spanStore
+ ssmu.RLock()
+ s, _ = spanStores[name]
+ ssmu.RUnlock()
+ return s
+}
+
+// spanStoreForNameCreateIfNew returns the spanStore for the given name.
+//
+// It creates it if it didn't exist.
+func spanStoreForNameCreateIfNew(name string) *spanStore {
+ ssmu.RLock()
+ s, ok := spanStores[name]
+ ssmu.RUnlock()
+ if ok {
+ return s
+ }
+ ssmu.Lock()
+ defer ssmu.Unlock()
+ s, ok = spanStores[name]
+ if ok {
+ return s
+ }
+ s = newSpanStore(name, defaultBucketSize, defaultBucketSize)
+ spanStores[name] = s
+ return s
+}
+
+// spanStoreSetSize resizes the spanStore for the given name.
+//
+// It creates it if it didn't exist.
+func spanStoreSetSize(name string, latencyBucketSize int, errorBucketSize int) {
+ ssmu.RLock()
+ s, ok := spanStores[name]
+ ssmu.RUnlock()
+ if ok {
+ s.resize(latencyBucketSize, errorBucketSize)
+ return
+ }
+ ssmu.Lock()
+ defer ssmu.Unlock()
+ s, ok = spanStores[name]
+ if ok {
+ s.resize(latencyBucketSize, errorBucketSize)
+ return
+ }
+ s = newSpanStore(name, latencyBucketSize, errorBucketSize)
+ spanStores[name] = s
+}
+
+func (s *spanStore) resize(latencyBucketSize int, errorBucketSize int) {
+ s.mu.Lock()
+ for i := range s.latency {
+ s.latency[i].resize(latencyBucketSize)
+ }
+ for _, b := range s.errors {
+ b.resize(errorBucketSize)
+ }
+ s.maxSpansPerErrorBucket = errorBucketSize
+ s.mu.Unlock()
+}
+
+// add adds a span to the active bucket of the spanStore.
+func (s *spanStore) add(span *Span) {
+ s.mu.Lock()
+ s.active[span] = struct{}{}
+ s.mu.Unlock()
+}
+
+// finished removes a span from the active set, and adds a corresponding
+// SpanData to a latency or error bucket.
+func (s *spanStore) finished(span *Span, sd *SpanData) {
+ latency := sd.EndTime.Sub(sd.StartTime)
+ if latency < 0 {
+ latency = 0
+ }
+ code := sd.Status.Code
+
+ s.mu.Lock()
+ delete(s.active, span)
+ if code == 0 {
+ s.latency[latencyBucket(latency)].add(sd)
+ } else {
+ if s.errors == nil {
+ s.errors = make(map[int32]*bucket)
+ }
+ if b := s.errors[code]; b != nil {
+ b.add(sd)
+ } else {
+ b := makeBucket(s.maxSpansPerErrorBucket)
+ s.errors[code] = &b
+ b.add(sd)
+ }
+ }
+ s.mu.Unlock()
+}
diff --git a/vendor/go.opencensus.io/trace/status_codes.go b/vendor/go.opencensus.io/trace/status_codes.go
new file mode 100644
index 000000000..ec60effd1
--- /dev/null
+++ b/vendor/go.opencensus.io/trace/status_codes.go
@@ -0,0 +1,37 @@
+// Copyright 2018, OpenCensus Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package trace
+
+// Status codes for use with Span.SetStatus. These correspond to the status
+// codes used by gRPC defined here: https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto
+const (
+ StatusCodeOK = 0
+ StatusCodeCancelled = 1
+ StatusCodeUnknown = 2
+ StatusCodeInvalidArgument = 3
+ StatusCodeDeadlineExceeded = 4
+ StatusCodeNotFound = 5
+ StatusCodeAlreadyExists = 6
+ StatusCodePermissionDenied = 7
+ StatusCodeResourceExhausted = 8
+ StatusCodeFailedPrecondition = 9
+ StatusCodeAborted = 10
+ StatusCodeOutOfRange = 11
+ StatusCodeUnimplemented = 12
+ StatusCodeInternal = 13
+ StatusCodeUnavailable = 14
+ StatusCodeDataLoss = 15
+ StatusCodeUnauthenticated = 16
+)
diff --git a/vendor/go.opencensus.io/trace/trace.go b/vendor/go.opencensus.io/trace/trace.go
new file mode 100644
index 000000000..38ead7bf0
--- /dev/null
+++ b/vendor/go.opencensus.io/trace/trace.go
@@ -0,0 +1,598 @@
+// Copyright 2017, OpenCensus Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package trace
+
+import (
+ "context"
+ crand "crypto/rand"
+ "encoding/binary"
+ "fmt"
+ "math/rand"
+ "sync"
+ "sync/atomic"
+ "time"
+
+ "go.opencensus.io/internal"
+ "go.opencensus.io/trace/tracestate"
+)
+
+// Span represents a span of a trace. It has an associated SpanContext, and
+// stores data accumulated while the span is active.
+//
+// Ideally users should interact with Spans by calling the functions in this
+// package that take a Context parameter.
+type Span struct {
+ // data contains information recorded about the span.
+ //
+ // It will be non-nil if we are exporting the span or recording events for it.
+ // Otherwise, data is nil, and the Span is simply a carrier for the
+ // SpanContext, so that the trace ID is propagated.
+ data *SpanData
+ mu sync.Mutex // protects the contents of *data (but not the pointer value.)
+ spanContext SpanContext
+
+ // lruAttributes are capped at configured limit. When the capacity is reached an oldest entry
+ // is removed to create room for a new entry.
+ lruAttributes *lruMap
+
+ // annotations are stored in FIFO queue capped by configured limit.
+ annotations *evictedQueue
+
+ // messageEvents are stored in FIFO queue capped by configured limit.
+ messageEvents *evictedQueue
+
+ // links are stored in FIFO queue capped by configured limit.
+ links *evictedQueue
+
+ // spanStore is the spanStore this span belongs to, if any, otherwise it is nil.
+ *spanStore
+ endOnce sync.Once
+
+ executionTracerTaskEnd func() // ends the execution tracer span
+}
+
+// IsRecordingEvents returns true if events are being recorded for this span.
+// Use this check to avoid computing expensive annotations when they will never
+// be used.
+func (s *Span) IsRecordingEvents() bool {
+ if s == nil {
+ return false
+ }
+ return s.data != nil
+}
+
+// TraceOptions contains options associated with a trace span.
+type TraceOptions uint32
+
+// IsSampled returns true if the span will be exported.
+func (sc SpanContext) IsSampled() bool {
+ return sc.TraceOptions.IsSampled()
+}
+
+// setIsSampled sets the TraceOptions bit that determines whether the span will be exported.
+func (sc *SpanContext) setIsSampled(sampled bool) {
+ if sampled {
+ sc.TraceOptions |= 1
+ } else {
+ sc.TraceOptions &= ^TraceOptions(1)
+ }
+}
+
+// IsSampled returns true if the span will be exported.
+func (t TraceOptions) IsSampled() bool {
+ return t&1 == 1
+}
+
+// SpanContext contains the state that must propagate across process boundaries.
+//
+// SpanContext is not an implementation of context.Context.
+// TODO: add reference to external Census docs for SpanContext.
+type SpanContext struct {
+ TraceID TraceID
+ SpanID SpanID
+ TraceOptions TraceOptions
+ Tracestate *tracestate.Tracestate
+}
+
+type contextKey struct{}
+
+// FromContext returns the Span stored in a context, or nil if there isn't one.
+func FromContext(ctx context.Context) *Span {
+ s, _ := ctx.Value(contextKey{}).(*Span)
+ return s
+}
+
+// NewContext returns a new context with the given Span attached.
+func NewContext(parent context.Context, s *Span) context.Context {
+ return context.WithValue(parent, contextKey{}, s)
+}
+
+// All available span kinds. Span kind must be either one of these values.
+const (
+ SpanKindUnspecified = iota
+ SpanKindServer
+ SpanKindClient
+)
+
+// StartOptions contains options concerning how a span is started.
+type StartOptions struct {
+ // Sampler to consult for this Span. If provided, it is always consulted.
+ //
+ // If not provided, then the behavior differs based on whether
+ // the parent of this Span is remote, local, or there is no parent.
+ // In the case of a remote parent or no parent, the
+ // default sampler (see Config) will be consulted. Otherwise,
+ // when there is a non-remote parent, no new sampling decision will be made:
+ // we will preserve the sampling of the parent.
+ Sampler Sampler
+
+ // SpanKind represents the kind of a span. If none is set,
+ // SpanKindUnspecified is used.
+ SpanKind int
+}
+
+// StartOption apply changes to StartOptions.
+type StartOption func(*StartOptions)
+
+// WithSpanKind makes new spans to be created with the given kind.
+func WithSpanKind(spanKind int) StartOption {
+ return func(o *StartOptions) {
+ o.SpanKind = spanKind
+ }
+}
+
+// WithSampler makes new spans to be be created with a custom sampler.
+// Otherwise, the global sampler is used.
+func WithSampler(sampler Sampler) StartOption {
+ return func(o *StartOptions) {
+ o.Sampler = sampler
+ }
+}
+
+// StartSpan starts a new child span of the current span in the context. If
+// there is no span in the context, creates a new trace and span.
+//
+// Returned context contains the newly created span. You can use it to
+// propagate the returned span in process.
+func StartSpan(ctx context.Context, name string, o ...StartOption) (context.Context, *Span) {
+ var opts StartOptions
+ var parent SpanContext
+ if p := FromContext(ctx); p != nil {
+ p.addChild()
+ parent = p.spanContext
+ }
+ for _, op := range o {
+ op(&opts)
+ }
+ span := startSpanInternal(name, parent != SpanContext{}, parent, false, opts)
+
+ ctx, end := startExecutionTracerTask(ctx, name)
+ span.executionTracerTaskEnd = end
+ return NewContext(ctx, span), span
+}
+
+// StartSpanWithRemoteParent starts a new child span of the span from the given parent.
+//
+// If the incoming context contains a parent, it ignores. StartSpanWithRemoteParent is
+// preferred for cases where the parent is propagated via an incoming request.
+//
+// Returned context contains the newly created span. You can use it to
+// propagate the returned span in process.
+func StartSpanWithRemoteParent(ctx context.Context, name string, parent SpanContext, o ...StartOption) (context.Context, *Span) {
+ var opts StartOptions
+ for _, op := range o {
+ op(&opts)
+ }
+ span := startSpanInternal(name, parent != SpanContext{}, parent, true, opts)
+ ctx, end := startExecutionTracerTask(ctx, name)
+ span.executionTracerTaskEnd = end
+ return NewContext(ctx, span), span
+}
+
+func startSpanInternal(name string, hasParent bool, parent SpanContext, remoteParent bool, o StartOptions) *Span {
+ span := &Span{}
+ span.spanContext = parent
+
+ cfg := config.Load().(*Config)
+
+ if !hasParent {
+ span.spanContext.TraceID = cfg.IDGenerator.NewTraceID()
+ }
+ span.spanContext.SpanID = cfg.IDGenerator.NewSpanID()
+ sampler := cfg.DefaultSampler
+
+ if !hasParent || remoteParent || o.Sampler != nil {
+ // If this span is the child of a local span and no Sampler is set in the
+ // options, keep the parent's TraceOptions.
+ //
+ // Otherwise, consult the Sampler in the options if it is non-nil, otherwise
+ // the default sampler.
+ if o.Sampler != nil {
+ sampler = o.Sampler
+ }
+ span.spanContext.setIsSampled(sampler(SamplingParameters{
+ ParentContext: parent,
+ TraceID: span.spanContext.TraceID,
+ SpanID: span.spanContext.SpanID,
+ Name: name,
+ HasRemoteParent: remoteParent}).Sample)
+ }
+
+ if !internal.LocalSpanStoreEnabled && !span.spanContext.IsSampled() {
+ return span
+ }
+
+ span.data = &SpanData{
+ SpanContext: span.spanContext,
+ StartTime: time.Now(),
+ SpanKind: o.SpanKind,
+ Name: name,
+ HasRemoteParent: remoteParent,
+ }
+ span.lruAttributes = newLruMap(cfg.MaxAttributesPerSpan)
+ span.annotations = newEvictedQueue(cfg.MaxAnnotationEventsPerSpan)
+ span.messageEvents = newEvictedQueue(cfg.MaxMessageEventsPerSpan)
+ span.links = newEvictedQueue(cfg.MaxLinksPerSpan)
+
+ if hasParent {
+ span.data.ParentSpanID = parent.SpanID
+ }
+ if internal.LocalSpanStoreEnabled {
+ var ss *spanStore
+ ss = spanStoreForNameCreateIfNew(name)
+ if ss != nil {
+ span.spanStore = ss
+ ss.add(span)
+ }
+ }
+
+ return span
+}
+
+// End ends the span.
+func (s *Span) End() {
+ if s == nil {
+ return
+ }
+ if s.executionTracerTaskEnd != nil {
+ s.executionTracerTaskEnd()
+ }
+ if !s.IsRecordingEvents() {
+ return
+ }
+ s.endOnce.Do(func() {
+ exp, _ := exporters.Load().(exportersMap)
+ mustExport := s.spanContext.IsSampled() && len(exp) > 0
+ if s.spanStore != nil || mustExport {
+ sd := s.makeSpanData()
+ sd.EndTime = internal.MonotonicEndTime(sd.StartTime)
+ if s.spanStore != nil {
+ s.spanStore.finished(s, sd)
+ }
+ if mustExport {
+ for e := range exp {
+ e.ExportSpan(sd)
+ }
+ }
+ }
+ })
+}
+
+// makeSpanData produces a SpanData representing the current state of the Span.
+// It requires that s.data is non-nil.
+func (s *Span) makeSpanData() *SpanData {
+ var sd SpanData
+ s.mu.Lock()
+ sd = *s.data
+ if s.lruAttributes.simpleLruMap.Len() > 0 {
+ sd.Attributes = s.lruAttributesToAttributeMap()
+ sd.DroppedAttributeCount = s.lruAttributes.droppedCount
+ }
+ if len(s.annotations.queue) > 0 {
+ sd.Annotations = s.interfaceArrayToAnnotationArray()
+ sd.DroppedAnnotationCount = s.annotations.droppedCount
+ }
+ if len(s.messageEvents.queue) > 0 {
+ sd.MessageEvents = s.interfaceArrayToMessageEventArray()
+ sd.DroppedMessageEventCount = s.messageEvents.droppedCount
+ }
+ if len(s.links.queue) > 0 {
+ sd.Links = s.interfaceArrayToLinksArray()
+ sd.DroppedLinkCount = s.links.droppedCount
+ }
+ s.mu.Unlock()
+ return &sd
+}
+
+// SpanContext returns the SpanContext of the span.
+func (s *Span) SpanContext() SpanContext {
+ if s == nil {
+ return SpanContext{}
+ }
+ return s.spanContext
+}
+
+// SetName sets the name of the span, if it is recording events.
+func (s *Span) SetName(name string) {
+ if !s.IsRecordingEvents() {
+ return
+ }
+ s.mu.Lock()
+ s.data.Name = name
+ s.mu.Unlock()
+}
+
+// SetStatus sets the status of the span, if it is recording events.
+func (s *Span) SetStatus(status Status) {
+ if !s.IsRecordingEvents() {
+ return
+ }
+ s.mu.Lock()
+ s.data.Status = status
+ s.mu.Unlock()
+}
+
+func (s *Span) interfaceArrayToLinksArray() []Link {
+ linksArr := make([]Link, 0)
+ for _, value := range s.links.queue {
+ linksArr = append(linksArr, value.(Link))
+ }
+ return linksArr
+}
+
+func (s *Span) interfaceArrayToMessageEventArray() []MessageEvent {
+ messageEventArr := make([]MessageEvent, 0)
+ for _, value := range s.messageEvents.queue {
+ messageEventArr = append(messageEventArr, value.(MessageEvent))
+ }
+ return messageEventArr
+}
+
+func (s *Span) interfaceArrayToAnnotationArray() []Annotation {
+ annotationArr := make([]Annotation, 0)
+ for _, value := range s.annotations.queue {
+ annotationArr = append(annotationArr, value.(Annotation))
+ }
+ return annotationArr
+}
+
+func (s *Span) lruAttributesToAttributeMap() map[string]interface{} {
+ attributes := make(map[string]interface{})
+ for _, key := range s.lruAttributes.simpleLruMap.Keys() {
+ value, ok := s.lruAttributes.simpleLruMap.Get(key)
+ if ok {
+ keyStr := key.(string)
+ attributes[keyStr] = value
+ }
+ }
+ return attributes
+}
+
+func (s *Span) copyToCappedAttributes(attributes []Attribute) {
+ for _, a := range attributes {
+ s.lruAttributes.add(a.key, a.value)
+ }
+}
+
+func (s *Span) addChild() {
+ if !s.IsRecordingEvents() {
+ return
+ }
+ s.mu.Lock()
+ s.data.ChildSpanCount++
+ s.mu.Unlock()
+}
+
+// AddAttributes sets attributes in the span.
+//
+// Existing attributes whose keys appear in the attributes parameter are overwritten.
+func (s *Span) AddAttributes(attributes ...Attribute) {
+ if !s.IsRecordingEvents() {
+ return
+ }
+ s.mu.Lock()
+ s.copyToCappedAttributes(attributes)
+ s.mu.Unlock()
+}
+
+// copyAttributes copies a slice of Attributes into a map.
+func copyAttributes(m map[string]interface{}, attributes []Attribute) {
+ for _, a := range attributes {
+ m[a.key] = a.value
+ }
+}
+
+func (s *Span) lazyPrintfInternal(attributes []Attribute, format string, a ...interface{}) {
+ now := time.Now()
+ msg := fmt.Sprintf(format, a...)
+ var m map[string]interface{}
+ s.mu.Lock()
+ if len(attributes) != 0 {
+ m = make(map[string]interface{})
+ copyAttributes(m, attributes)
+ }
+ s.annotations.add(Annotation{
+ Time: now,
+ Message: msg,
+ Attributes: m,
+ })
+ s.mu.Unlock()
+}
+
+func (s *Span) printStringInternal(attributes []Attribute, str string) {
+ now := time.Now()
+ var a map[string]interface{}
+ s.mu.Lock()
+ if len(attributes) != 0 {
+ a = make(map[string]interface{})
+ copyAttributes(a, attributes)
+ }
+ s.annotations.add(Annotation{
+ Time: now,
+ Message: str,
+ Attributes: a,
+ })
+ s.mu.Unlock()
+}
+
+// Annotate adds an annotation with attributes.
+// Attributes can be nil.
+func (s *Span) Annotate(attributes []Attribute, str string) {
+ if !s.IsRecordingEvents() {
+ return
+ }
+ s.printStringInternal(attributes, str)
+}
+
+// Annotatef adds an annotation with attributes.
+func (s *Span) Annotatef(attributes []Attribute, format string, a ...interface{}) {
+ if !s.IsRecordingEvents() {
+ return
+ }
+ s.lazyPrintfInternal(attributes, format, a...)
+}
+
+// AddMessageSendEvent adds a message send event to the span.
+//
+// messageID is an identifier for the message, which is recommended to be
+// unique in this span and the same between the send event and the receive
+// event (this allows to identify a message between the sender and receiver).
+// For example, this could be a sequence id.
+func (s *Span) AddMessageSendEvent(messageID, uncompressedByteSize, compressedByteSize int64) {
+ if !s.IsRecordingEvents() {
+ return
+ }
+ now := time.Now()
+ s.mu.Lock()
+ s.messageEvents.add(MessageEvent{
+ Time: now,
+ EventType: MessageEventTypeSent,
+ MessageID: messageID,
+ UncompressedByteSize: uncompressedByteSize,
+ CompressedByteSize: compressedByteSize,
+ })
+ s.mu.Unlock()
+}
+
+// AddMessageReceiveEvent adds a message receive event to the span.
+//
+// messageID is an identifier for the message, which is recommended to be
+// unique in this span and the same between the send event and the receive
+// event (this allows to identify a message between the sender and receiver).
+// For example, this could be a sequence id.
+func (s *Span) AddMessageReceiveEvent(messageID, uncompressedByteSize, compressedByteSize int64) {
+ if !s.IsRecordingEvents() {
+ return
+ }
+ now := time.Now()
+ s.mu.Lock()
+ s.messageEvents.add(MessageEvent{
+ Time: now,
+ EventType: MessageEventTypeRecv,
+ MessageID: messageID,
+ UncompressedByteSize: uncompressedByteSize,
+ CompressedByteSize: compressedByteSize,
+ })
+ s.mu.Unlock()
+}
+
+// AddLink adds a link to the span.
+func (s *Span) AddLink(l Link) {
+ if !s.IsRecordingEvents() {
+ return
+ }
+ s.mu.Lock()
+ s.links.add(l)
+ s.mu.Unlock()
+}
+
+func (s *Span) String() string {
+ if s == nil {
+ return "<nil>"
+ }
+ if s.data == nil {
+ return fmt.Sprintf("span %s", s.spanContext.SpanID)
+ }
+ s.mu.Lock()
+ str := fmt.Sprintf("span %s %q", s.spanContext.SpanID, s.data.Name)
+ s.mu.Unlock()
+ return str
+}
+
+var config atomic.Value // access atomically
+
+func init() {
+ gen := &defaultIDGenerator{}
+ // initialize traceID and spanID generators.
+ var rngSeed int64
+ for _, p := range []interface{}{
+ &rngSeed, &gen.traceIDAdd, &gen.nextSpanID, &gen.spanIDInc,
+ } {
+ binary.Read(crand.Reader, binary.LittleEndian, p)
+ }
+ gen.traceIDRand = rand.New(rand.NewSource(rngSeed))
+ gen.spanIDInc |= 1
+
+ config.Store(&Config{
+ DefaultSampler: ProbabilitySampler(defaultSamplingProbability),
+ IDGenerator: gen,
+ MaxAttributesPerSpan: DefaultMaxAttributesPerSpan,
+ MaxAnnotationEventsPerSpan: DefaultMaxAnnotationEventsPerSpan,
+ MaxMessageEventsPerSpan: DefaultMaxMessageEventsPerSpan,
+ MaxLinksPerSpan: DefaultMaxLinksPerSpan,
+ })
+}
+
+type defaultIDGenerator struct {
+ sync.Mutex
+
+ // Please keep these as the first fields
+ // so that these 8 byte fields will be aligned on addresses
+ // divisible by 8, on both 32-bit and 64-bit machines when
+ // performing atomic increments and accesses.
+ // See:
+ // * https://github.com/census-instrumentation/opencensus-go/issues/587
+ // * https://github.com/census-instrumentation/opencensus-go/issues/865
+ // * https://golang.org/pkg/sync/atomic/#pkg-note-BUG
+ nextSpanID uint64
+ spanIDInc uint64
+
+ traceIDAdd [2]uint64
+ traceIDRand *rand.Rand
+}
+
+// NewSpanID returns a non-zero span ID from a randomly-chosen sequence.
+func (gen *defaultIDGenerator) NewSpanID() [8]byte {
+ var id uint64
+ for id == 0 {
+ id = atomic.AddUint64(&gen.nextSpanID, gen.spanIDInc)
+ }
+ var sid [8]byte
+ binary.LittleEndian.PutUint64(sid[:], id)
+ return sid
+}
+
+// NewTraceID returns a non-zero trace ID from a randomly-chosen sequence.
+// mu should be held while this function is called.
+func (gen *defaultIDGenerator) NewTraceID() [16]byte {
+ var tid [16]byte
+ // Construct the trace ID from two outputs of traceIDRand, with a constant
+ // added to each half for additional entropy.
+ gen.Lock()
+ binary.LittleEndian.PutUint64(tid[0:8], gen.traceIDRand.Uint64()+gen.traceIDAdd[0])
+ binary.LittleEndian.PutUint64(tid[8:16], gen.traceIDRand.Uint64()+gen.traceIDAdd[1])
+ gen.Unlock()
+ return tid
+}
diff --git a/vendor/go.opencensus.io/trace/trace_go11.go b/vendor/go.opencensus.io/trace/trace_go11.go
new file mode 100644
index 000000000..b7d8aaf28
--- /dev/null
+++ b/vendor/go.opencensus.io/trace/trace_go11.go
@@ -0,0 +1,32 @@
+// Copyright 2018, OpenCensus Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// +build go1.11
+
+package trace
+
+import (
+ "context"
+ t "runtime/trace"
+)
+
+func startExecutionTracerTask(ctx context.Context, name string) (context.Context, func()) {
+ if !t.IsEnabled() {
+ // Avoid additional overhead if
+ // runtime/trace is not enabled.
+ return ctx, func() {}
+ }
+ nctx, task := t.NewTask(ctx, name)
+ return nctx, task.End
+}
diff --git a/vendor/go.opencensus.io/trace/trace_nongo11.go b/vendor/go.opencensus.io/trace/trace_nongo11.go
new file mode 100644
index 000000000..e25419859
--- /dev/null
+++ b/vendor/go.opencensus.io/trace/trace_nongo11.go
@@ -0,0 +1,25 @@
+// Copyright 2018, OpenCensus Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// +build !go1.11
+
+package trace
+
+import (
+ "context"
+)
+
+func startExecutionTracerTask(ctx context.Context, name string) (context.Context, func()) {
+ return ctx, func() {}
+}
diff --git a/vendor/go.opencensus.io/trace/tracestate/tracestate.go b/vendor/go.opencensus.io/trace/tracestate/tracestate.go
new file mode 100644
index 000000000..2d6c713eb
--- /dev/null
+++ b/vendor/go.opencensus.io/trace/tracestate/tracestate.go
@@ -0,0 +1,147 @@
+// Copyright 2018, OpenCensus Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package tracestate implements support for the Tracestate header of the
+// W3C TraceContext propagation format.
+package tracestate
+
+import (
+ "fmt"
+ "regexp"
+)
+
+const (
+ keyMaxSize = 256
+ valueMaxSize = 256
+ maxKeyValuePairs = 32
+)
+
+const (
+ keyWithoutVendorFormat = `[a-z][_0-9a-z\-\*\/]{0,255}`
+ keyWithVendorFormat = `[a-z][_0-9a-z\-\*\/]{0,240}@[a-z][_0-9a-z\-\*\/]{0,13}`
+ keyFormat = `(` + keyWithoutVendorFormat + `)|(` + keyWithVendorFormat + `)`
+ valueFormat = `[\x20-\x2b\x2d-\x3c\x3e-\x7e]{0,255}[\x21-\x2b\x2d-\x3c\x3e-\x7e]`
+)
+
+var keyValidationRegExp = regexp.MustCompile(`^(` + keyFormat + `)$`)
+var valueValidationRegExp = regexp.MustCompile(`^(` + valueFormat + `)$`)
+
+// Tracestate represents tracing-system specific context in a list of key-value pairs. Tracestate allows different
+// vendors propagate additional information and inter-operate with their legacy Id formats.
+type Tracestate struct {
+ entries []Entry
+}
+
+// Entry represents one key-value pair in a list of key-value pair of Tracestate.
+type Entry struct {
+ // Key is an opaque string up to 256 characters printable. It MUST begin with a lowercase letter,
+ // and can only contain lowercase letters a-z, digits 0-9, underscores _, dashes -, asterisks *, and
+ // forward slashes /.
+ Key string
+
+ // Value is an opaque string up to 256 characters printable ASCII RFC0020 characters (i.e., the
+ // range 0x20 to 0x7E) except comma , and =.
+ Value string
+}
+
+// Entries returns a slice of Entry.
+func (ts *Tracestate) Entries() []Entry {
+ if ts == nil {
+ return nil
+ }
+ return ts.entries
+}
+
+func (ts *Tracestate) remove(key string) *Entry {
+ for index, entry := range ts.entries {
+ if entry.Key == key {
+ ts.entries = append(ts.entries[:index], ts.entries[index+1:]...)
+ return &entry
+ }
+ }
+ return nil
+}
+
+func (ts *Tracestate) add(entries []Entry) error {
+ for _, entry := range entries {
+ ts.remove(entry.Key)
+ }
+ if len(ts.entries)+len(entries) > maxKeyValuePairs {
+ return fmt.Errorf("adding %d key-value pairs to current %d pairs exceeds the limit of %d",
+ len(entries), len(ts.entries), maxKeyValuePairs)
+ }
+ ts.entries = append(entries, ts.entries...)
+ return nil
+}
+
+func isValid(entry Entry) bool {
+ return keyValidationRegExp.MatchString(entry.Key) &&
+ valueValidationRegExp.MatchString(entry.Value)
+}
+
+func containsDuplicateKey(entries ...Entry) (string, bool) {
+ keyMap := make(map[string]int)
+ for _, entry := range entries {
+ if _, ok := keyMap[entry.Key]; ok {
+ return entry.Key, true
+ }
+ keyMap[entry.Key] = 1
+ }
+ return "", false
+}
+
+func areEntriesValid(entries ...Entry) (*Entry, bool) {
+ for _, entry := range entries {
+ if !isValid(entry) {
+ return &entry, false
+ }
+ }
+ return nil, true
+}
+
+// New creates a Tracestate object from a parent and/or entries (key-value pair).
+// Entries from the parent are copied if present. The entries passed to this function
+// are inserted in front of those copied from the parent. If an entry copied from the
+// parent contains the same key as one of the entry in entries then the entry copied
+// from the parent is removed. See add func.
+//
+// An error is returned with nil Tracestate if
+// 1. one or more entry in entries is invalid.
+// 2. two or more entries in the input entries have the same key.
+// 3. the number of entries combined from the parent and the input entries exceeds maxKeyValuePairs.
+// (duplicate entry is counted only once).
+func New(parent *Tracestate, entries ...Entry) (*Tracestate, error) {
+ if parent == nil && len(entries) == 0 {
+ return nil, nil
+ }
+ if entry, ok := areEntriesValid(entries...); !ok {
+ return nil, fmt.Errorf("key-value pair {%s, %s} is invalid", entry.Key, entry.Value)
+ }
+
+ if key, duplicate := containsDuplicateKey(entries...); duplicate {
+ return nil, fmt.Errorf("contains duplicate keys (%s)", key)
+ }
+
+ tracestate := Tracestate{}
+
+ if parent != nil && len(parent.entries) > 0 {
+ tracestate.entries = append([]Entry{}, parent.entries...)
+ }
+
+ err := tracestate.add(entries)
+ if err != nil {
+ return nil, err
+ }
+ return &tracestate, nil
+}