diff --git a/.github/ISSUE_TEMPLATE/bug_report_instrumentation_otelbeego.md b/.github/ISSUE_TEMPLATE/bug_report_instrumentation_otelbeego.md deleted file mode 100644 index 211e4fb8161..00000000000 --- a/.github/ISSUE_TEMPLATE/bug_report_instrumentation_otelbeego.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -name: '[instrumentation: otelbeego] Bug report' -about: Create a report of invalid behavior about the otelbeego package to help us improve -title: '' -labels: 'bug, area: instrumentation, instrumentation: otelbeego' - ---- - -### Description - -A clear and concise description of what the bug is. - -### Environment - -- OS: [e.g. iOS] -- Architecture: [e.g. x86, i386] -- Go Version: [e.g. 1.15] -- `otelbeego` version: [e.g. v0.14.0, 3c7face] - -### Steps To Reproduce - -1. Using this code ... -2. Run ... -3. See error ... - -### Expected behavior - -A clear and concise description of what you expected to happen. diff --git a/.github/ISSUE_TEMPLATE/bug_report_instrumentation_otelgocql.md b/.github/ISSUE_TEMPLATE/bug_report_instrumentation_otelgocql.md deleted file mode 100644 index da3e856c8f3..00000000000 --- a/.github/ISSUE_TEMPLATE/bug_report_instrumentation_otelgocql.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -name: '[instrumentation: otelgocql] Bug report' -about: Create a report of invalid behavior about the otelgocql package to help us improve -title: '' -labels: 'bug, area: instrumentation, instrumentation: otelgocql' - ---- - -### Description - -A clear and concise description of what the bug is. - -### Environment - -- OS: [e.g. iOS] -- Architecture: [e.g. x86, i386] -- Go Version: [e.g. 1.15] -- `otelgocql` version: [e.g. v0.14.0, 3c7face] - -### Steps To Reproduce - -1. Using this code ... -2. Run ... -3. See error ... - -### Expected behavior - -A clear and concise description of what you expected to happen. diff --git a/.github/ISSUE_TEMPLATE/bug_report_instrumentation_otelkit.md b/.github/ISSUE_TEMPLATE/bug_report_instrumentation_otelkit.md deleted file mode 100644 index 03744bc9e56..00000000000 --- a/.github/ISSUE_TEMPLATE/bug_report_instrumentation_otelkit.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -name: '[instrumentation: otelkit] Bug report' -about: Create a report of invalid behavior about the otelkit package to help us improve -title: '' -labels: 'bug, area: instrumentation, instrumentation: otelkit' - ---- - -### Description - -A clear and concise description of what the bug is. - -### Environment - -- OS: [e.g. iOS] -- Architecture: [e.g. x86, i386] -- Go Version: [e.g. 1.15] -- `otelkit` version: [e.g. v0.14.0, 3c7face] - -### Steps To Reproduce - -1. Using this code ... -2. Run ... -3. See error ... - -### Expected behavior - -A clear and concise description of what you expected to happen. diff --git a/.github/ISSUE_TEMPLATE/bug_report_instrumentation_otelmemcache.md b/.github/ISSUE_TEMPLATE/bug_report_instrumentation_otelmemcache.md deleted file mode 100644 index a670d851130..00000000000 --- a/.github/ISSUE_TEMPLATE/bug_report_instrumentation_otelmemcache.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -name: '[instrumentation: otelmemcache] Bug report' -about: Create a report of invalid behavior about the otelmemcache package to help us improve -title: '' -labels: 'bug, area: instrumentation, instrumentation: otelmemcache' - ---- - -### Description - -A clear and concise description of what the bug is. - -### Environment - -- OS: [e.g. iOS] -- Architecture: [e.g. x86, i386] -- Go Version: [e.g. 1.15] -- `otelmemcache` version: [e.g. v0.14.0, 3c7face] - -### Steps To Reproduce - -1. Using this code ... -2. Run ... -3. See error ... - -### Expected behavior - -A clear and concise description of what you expected to happen. diff --git a/.github/ISSUE_TEMPLATE/bug_report_instrumentation_otelsarama.md b/.github/ISSUE_TEMPLATE/bug_report_instrumentation_otelsarama.md deleted file mode 100644 index 5bee6343c77..00000000000 --- a/.github/ISSUE_TEMPLATE/bug_report_instrumentation_otelsarama.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -name: '[instrumentation: otelsarama] Bug report' -about: Create a report of invalid behavior about the otelsarama package to help us improve -title: '' -labels: 'bug, area: instrumentation, instrumentation: otelsarama' - ---- - -### Description - -A clear and concise description of what the bug is. - -### Environment - -- OS: [e.g. iOS] -- Architecture: [e.g. x86, i386] -- Go Version: [e.g. 1.15] -- `otelsarama` version: [e.g. v0.14.0, 3c7face] - -### Steps To Reproduce - -1. Using this code ... -2. Run ... -3. See error ... - -### Expected behavior - -A clear and concise description of what you expected to happen. diff --git a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelbeego.md b/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelbeego.md deleted file mode 100644 index 9d6f196d130..00000000000 --- a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelbeego.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -name: '[instrumentation: otelbeego] Feature request' -about: Suggest an idea for the otelbeego package -title: '' -labels: enhancement -labels: 'enhancement, area: instrumentation, instrumentation: otelbeego' - ---- - -### Problem Statement - -A clear and concise description of what the problem is. -Ex. I'm always frustrated when [...] - -### Proposed Solution - -A clear and concise description of what you want to happen. - -#### Alternatives - -A clear and concise description of any alternative solutions or features you've considered. - -#### Prior Art - -A clear and concise list of any similar and existing solutions from other projects that provide context to possible solutions. - -### Additional Context - -Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelgin.md b/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelgin.md index 532b6668dc2..d9798597024 100644 --- a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelgin.md +++ b/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelgin.md @@ -1,9 +1,9 @@ --- -name: '[instrumentation: otelgocql] Feature request' -about: Suggest an idea for the otelgocql package +name: '[instrumentation: otelgin] Feature request' +about: Suggest an idea for the otelgin package title: '' labels: enhancement -labels: 'enhancement, area: instrumentation, instrumentation: otelgocql' +labels: 'enhancement, area: instrumentation, instrumentation: otelgin' --- diff --git a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelgocql.md b/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelgocql.md deleted file mode 100644 index d02ecad0eb4..00000000000 --- a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelgocql.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -name: '[instrumentation: otelgrpc] Feature request' -about: Suggest an idea for the otelgrpc package -title: '' -labels: enhancement -labels: 'enhancement, area: instrumentation, instrumentation: otelgrpc' - ---- - -### Problem Statement - -A clear and concise description of what the problem is. -Ex. I'm always frustrated when [...] - -### Proposed Solution - -A clear and concise description of what you want to happen. - -#### Alternatives - -A clear and concise description of any alternative solutions or features you've considered. - -#### Prior Art - -A clear and concise list of any similar and existing solutions from other projects that provide context to possible solutions. - -### Additional Context - -Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelgrpc.md b/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelgrpc.md index 3138521865c..d02ecad0eb4 100644 --- a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelgrpc.md +++ b/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelgrpc.md @@ -1,9 +1,9 @@ --- -name: '[instrumentation: otelhttp] Feature request' -about: Suggest an idea for the otelhttp package +name: '[instrumentation: otelgrpc] Feature request' +about: Suggest an idea for the otelgrpc package title: '' labels: enhancement -labels: 'enhancement, area: instrumentation, instrumentation: otelhttp' +labels: 'enhancement, area: instrumentation, instrumentation: otelgrpc' --- diff --git a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelhttp.md b/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelhttp.md index 7ef8c76c117..3138521865c 100644 --- a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelhttp.md +++ b/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelhttp.md @@ -1,9 +1,9 @@ --- -name: '[instrumentation: otelhttptrace] Feature request' -about: Suggest an idea for the otelhttptrace package +name: '[instrumentation: otelhttp] Feature request' +about: Suggest an idea for the otelhttp package title: '' labels: enhancement -labels: 'enhancement, area: instrumentation, instrumentation: otelhttptrace' +labels: 'enhancement, area: instrumentation, instrumentation: otelhttp' --- diff --git a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelhttptrace.md b/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelhttptrace.md index 931ae0586f0..7ef8c76c117 100644 --- a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelhttptrace.md +++ b/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelhttptrace.md @@ -1,9 +1,9 @@ --- -name: '[instrumentation: otelkit] Feature request' -about: Suggest an idea for the otelkit package +name: '[instrumentation: otelhttptrace] Feature request' +about: Suggest an idea for the otelhttptrace package title: '' labels: enhancement -labels: 'enhancement, area: instrumentation, instrumentation: otelkit' +labels: 'enhancement, area: instrumentation, instrumentation: otelhttptrace' --- diff --git a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelkit.md b/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelkit.md deleted file mode 100644 index 387878a23cc..00000000000 --- a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelkit.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -name: '[instrumentation: otellambda] Feature request' -about: Suggest an idea for the otellambda package -title: '' -labels: enhancement -labels: 'enhancement, area: instrumentation, instrumentation: otellambda' - ---- - -### Problem Statement - -A clear and concise description of what the problem is. -Ex. I'm always frustrated when [...] - -### Proposed Solution - -A clear and concise description of what you want to happen. - -#### Alternatives - -A clear and concise description of any alternative solutions or features you've considered. - -#### Prior Art - -A clear and concise list of any similar and existing solutions from other projects that provide context to possible solutions. - -### Additional Context - -Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otellambda.md b/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otellambda.md index 0994e2ced31..387878a23cc 100644 --- a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otellambda.md +++ b/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otellambda.md @@ -1,9 +1,9 @@ --- -name: '[instrumentation: otelmacaron] Feature request' -about: Suggest an idea for the otelmacaron package +name: '[instrumentation: otellambda] Feature request' +about: Suggest an idea for the otellambda package title: '' labels: enhancement -labels: 'enhancement, area: instrumentation, instrumentation: otelmacaron' +labels: 'enhancement, area: instrumentation, instrumentation: otellambda' --- diff --git a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelmacaron.md b/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelmacaron.md index aebe958d6ee..0994e2ced31 100644 --- a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelmacaron.md +++ b/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelmacaron.md @@ -1,9 +1,9 @@ --- -name: '[instrumentation: otelmemcache] Feature request' -about: Suggest an idea for the otelmemcache package +name: '[instrumentation: otelmacaron] Feature request' +about: Suggest an idea for the otelmacaron package title: '' labels: enhancement -labels: 'enhancement, area: instrumentation, instrumentation: otelmemcache' +labels: 'enhancement, area: instrumentation, instrumentation: otelmacaron' --- diff --git a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelmemcache.md b/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelmemcache.md deleted file mode 100644 index 7b26f4f0729..00000000000 --- a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelmemcache.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -name: '[instrumentation: otelmongo] Feature request' -about: Suggest an idea for the otelmongo package -title: '' -labels: enhancement -labels: 'enhancement, area: instrumentation, instrumentation: otelmongo' - ---- - -### Problem Statement - -A clear and concise description of what the problem is. -Ex. I'm always frustrated when [...] - -### Proposed Solution - -A clear and concise description of what you want to happen. - -#### Alternatives - -A clear and concise description of any alternative solutions or features you've considered. - -#### Prior Art - -A clear and concise list of any similar and existing solutions from other projects that provide context to possible solutions. - -### Additional Context - -Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelmongo.md b/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelmongo.md index 3da68fa9489..7b26f4f0729 100644 --- a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelmongo.md +++ b/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelmongo.md @@ -1,9 +1,9 @@ --- -name: '[instrumentation: otelmux] Feature request' -about: Suggest an idea for the otelmux package +name: '[instrumentation: otelmongo] Feature request' +about: Suggest an idea for the otelmongo package title: '' labels: enhancement -labels: 'enhancement, area: instrumentation, instrumentation: otelmux' +labels: 'enhancement, area: instrumentation, instrumentation: otelmongo' --- diff --git a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelmux.md b/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelmux.md index a87fdcd4044..3da68fa9489 100644 --- a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelmux.md +++ b/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelmux.md @@ -1,9 +1,9 @@ --- -name: '[instrumentation: otelrestful] Feature request' -about: Suggest an idea for the otelrestful package +name: '[instrumentation: otelmux] Feature request' +about: Suggest an idea for the otelmux package title: '' labels: enhancement -labels: 'enhancement, area: instrumentation, instrumentation: otelrestful' +labels: 'enhancement, area: instrumentation, instrumentation: otelmux' --- diff --git a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelrestful.md b/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelrestful.md index 6bb09dde13a..a87fdcd4044 100644 --- a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelrestful.md +++ b/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelrestful.md @@ -1,9 +1,9 @@ --- -name: '[instrumentation: otelsarama] Feature request' -about: Suggest an idea for the otelsarama package +name: '[instrumentation: otelrestful] Feature request' +about: Suggest an idea for the otelrestful package title: '' labels: enhancement -labels: 'enhancement, area: instrumentation, instrumentation: otelsarama' +labels: 'enhancement, area: instrumentation, instrumentation: otelrestful' --- diff --git a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelsarama.md b/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelsarama.md deleted file mode 100644 index c36bfee8af6..00000000000 --- a/.github/ISSUE_TEMPLATE/feature_request_instrumentation_otelsarama.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -name: '[instrumentation: runtime] Feature request' -about: Suggest an idea for the runtime package -title: '' -labels: enhancement -labels: 'enhancement, area: instrumentation, instrumentation: runtime' - ---- - -### Problem Statement - -A clear and concise description of what the problem is. -Ex. I'm always frustrated when [...] - -### Proposed Solution - -A clear and concise description of what you want to happen. - -#### Alternatives - -A clear and concise description of any alternative solutions or features you've considered. - -#### Prior Art - -A clear and concise list of any similar and existing solutions from other projects that provide context to possible solutions. - -### Additional Context - -Add any other context or screenshots about the feature request here. diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d22c4379727..e470ef81719 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -10,33 +10,6 @@ updates: schedule: interval: weekly day: sunday - - package-ecosystem: docker - directory: /instrumentation/github.com/Shopify/sarama/otelsarama/example/consumer - labels: - - dependencies - - docker - - Skip Changelog - schedule: - interval: weekly - day: sunday - - package-ecosystem: docker - directory: /instrumentation/github.com/Shopify/sarama/otelsarama/example/producer - labels: - - dependencies - - docker - - Skip Changelog - schedule: - interval: weekly - day: sunday - - package-ecosystem: docker - directory: /instrumentation/github.com/astaxie/beego/otelbeego/example - labels: - - dependencies - - docker - - Skip Changelog - schedule: - interval: weekly - day: sunday - package-ecosystem: docker directory: /instrumentation/github.com/aws/aws-lambda-go/otellambda/example labels: @@ -55,15 +28,6 @@ updates: schedule: interval: weekly day: sunday - - package-ecosystem: docker - directory: /instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example - labels: - - dependencies - - docker - - Skip Changelog - schedule: - interval: weekly - day: sunday - package-ecosystem: docker directory: /instrumentation/github.com/emicklei/go-restful/otelrestful/example labels: @@ -82,15 +46,6 @@ updates: schedule: interval: weekly day: sunday - - package-ecosystem: docker - directory: /instrumentation/github.com/go-kit/kit/otelkit/example - labels: - - dependencies - - docker - - Skip Changelog - schedule: - interval: weekly - day: sunday - package-ecosystem: docker directory: /instrumentation/github.com/gorilla/mux/otelmux/example labels: @@ -226,60 +181,6 @@ updates: schedule: interval: weekly day: sunday - - package-ecosystem: gomod - directory: /instrumentation/github.com/Shopify/sarama/otelsarama - labels: - - dependencies - - go - - Skip Changelog - schedule: - interval: weekly - day: sunday - - package-ecosystem: gomod - directory: /instrumentation/github.com/Shopify/sarama/otelsarama/example - labels: - - dependencies - - go - - Skip Changelog - schedule: - interval: weekly - day: sunday - - package-ecosystem: gomod - directory: /instrumentation/github.com/Shopify/sarama/otelsarama/test - labels: - - dependencies - - go - - Skip Changelog - schedule: - interval: weekly - day: sunday - - package-ecosystem: gomod - directory: /instrumentation/github.com/astaxie/beego/otelbeego - labels: - - dependencies - - go - - Skip Changelog - schedule: - interval: weekly - day: sunday - - package-ecosystem: gomod - directory: /instrumentation/github.com/astaxie/beego/otelbeego/example - labels: - - dependencies - - go - - Skip Changelog - schedule: - interval: weekly - day: sunday - - package-ecosystem: gomod - directory: /instrumentation/github.com/astaxie/beego/otelbeego/test - labels: - - dependencies - - go - - Skip Changelog - schedule: - interval: weekly - day: sunday - package-ecosystem: gomod directory: /instrumentation/github.com/aws/aws-lambda-go/otellambda labels: @@ -343,33 +244,6 @@ updates: schedule: interval: weekly day: sunday - - package-ecosystem: gomod - directory: /instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache - labels: - - dependencies - - go - - Skip Changelog - schedule: - interval: weekly - day: sunday - - package-ecosystem: gomod - directory: /instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example - labels: - - dependencies - - go - - Skip Changelog - schedule: - interval: weekly - day: sunday - - package-ecosystem: gomod - directory: /instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/test - labels: - - dependencies - - go - - Skip Changelog - schedule: - interval: weekly - day: sunday - package-ecosystem: gomod directory: /instrumentation/github.com/emicklei/go-restful/otelrestful labels: @@ -424,60 +298,6 @@ updates: schedule: interval: weekly day: sunday - - package-ecosystem: gomod - directory: /instrumentation/github.com/go-kit/kit/otelkit - labels: - - dependencies - - go - - Skip Changelog - schedule: - interval: weekly - day: sunday - - package-ecosystem: gomod - directory: /instrumentation/github.com/go-kit/kit/otelkit/example - labels: - - dependencies - - go - - Skip Changelog - schedule: - interval: weekly - day: sunday - - package-ecosystem: gomod - directory: /instrumentation/github.com/go-kit/kit/otelkit/test - labels: - - dependencies - - go - - Skip Changelog - schedule: - interval: weekly - day: sunday - - package-ecosystem: gomod - directory: /instrumentation/github.com/gocql/gocql/otelgocql - labels: - - dependencies - - go - - Skip Changelog - schedule: - interval: weekly - day: sunday - - package-ecosystem: gomod - directory: /instrumentation/github.com/gocql/gocql/otelgocql/example - labels: - - dependencies - - go - - Skip Changelog - schedule: - interval: weekly - day: sunday - - package-ecosystem: gomod - directory: /instrumentation/github.com/gocql/gocql/otelgocql/test - labels: - - dependencies - - go - - Skip Changelog - schedule: - interval: weekly - day: sunday - package-ecosystem: gomod directory: /instrumentation/github.com/gorilla/mux/otelmux labels: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c7b0bb137f..0bc37a32b31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -165,7 +165,7 @@ jobs: integration: strategy: matrix: - target: [test-gocql, test-mongo-driver, test-gomemcache] + target: [test-mongo-driver] runs-on: ubuntu-latest steps: - name: Install Go diff --git a/CHANGELOG.md b/CHANGELOG.md index f6a363215fa..e1f2801dd47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Removed - The high cardinality attributes `net.sock.peer.addr`, `net.sock.peer.port`, `http.user_agent`, `enduser.id`, and `http.client_ip` were removed from the metrics generated by `go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp`. (#4277) +- The deprecated `go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego` module is removed. (#4295) +- The deprecated `go.opentelemetry.io/contrib/instrumentation/github.com/go-kit/kit/otelkit` module is removed. (#4295) +- The deprecated `go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama` module is removed. (#4295) +- The deprecated `go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache` module is removed. (#4295) +- The deprecated `go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql` module is removed. (#4295) ## [1.18.0/0.43.0/0.12.0] - 2023-08-28 diff --git a/CODEOWNERS b/CODEOWNERS index 9d2aec7c634..5151257eeb0 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -27,17 +27,12 @@ detectors/gcp/ @open-te exporters/autoexport @open-telemetry/go-approvers @MikeGoldsmith @pellared -instrumentation/github.com/astaxie/beego/otelbeego/ @open-telemetry/go-approvers instrumentation/github.com/aws/aws-lambda-go/otellambda/ @open-telemetry/go-approvers @Aneurysm9 instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/ @open-telemetry/go-approvers @Aneurysm9 -instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/ @open-telemetry/go-approvers instrumentation/github.com/emicklei/go-restful/otelrestful/ @open-telemetry/go-approvers instrumentation/github.com/gin-gonic/gin/otelgin/ @open-telemetry/go-approvers @hanyuancheung -instrumentation/github.com/go-kit/kit/otelkit/ @open-telemetry/go-approvers -instrumentation/github.com/gocql/gocql/otelgocql/ @open-telemetry/go-approvers instrumentation/github.com/gorilla/mux/otelmux/ @open-telemetry/go-approvers instrumentation/github.com/labstack/echo/otelecho/ @open-telemetry/go-approvers -instrumentation/github.com/Shopify/sarama/otelsarama/ @open-telemetry/go-approvers @pellared @hanyuancheung instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/ @open-telemetry/go-approvers instrumentation/google.golang.org/grpc/otelgrpc/ @open-telemetry/go-approvers @dashpole @hanyuancheung instrumentation/gopkg.in/macaron.v1/otelmacaron/ @open-telemetry/go-approvers diff --git a/Makefile b/Makefile index b67ab65e5ae..d89870b89ec 100644 --- a/Makefile +++ b/Makefile @@ -239,23 +239,6 @@ test-coverage/%: && $$CMD ./... \ && $(GO) tool cover -html=coverage.out -o coverage.html; -.PHONY: test-gocql -test-gocql: - @if ./tools/should_build.sh gocql; then \ - set -e; \ - docker run --name cass-integ --rm -p 9042:9042 -d cassandra:3; \ - CMD=cassandra IMG_NAME=cass-integ ./tools/wait.sh; \ - (cd instrumentation/github.com/gocql/gocql/otelgocql/test/ && \ - $(GO) test \ - -covermode=$(COVERAGE_MODE) \ - -coverprofile=$(COVERAGE_PROFILE) \ - -coverpkg=go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql/... \ - ./... \ - && $(GO) tool cover -html=$(COVERAGE_PROFILE) -o coverage.html); \ - cp ./instrumentation/github.com/gocql/gocql/otelgocql/test/coverage.out ./; \ - docker stop cass-integ; \ - fi - .PHONY: test-mongo-driver test-mongo-driver: @if ./tools/should_build.sh mongo-driver; then \ @@ -273,23 +256,6 @@ test-mongo-driver: docker stop mongo-integ; \ fi -.PHONY: test-gomemcache -test-gomemcache: - @if ./tools/should_build.sh gomemcache; then \ - set -e; \ - docker run --name gomemcache-integ --rm -p 11211:11211 -d memcached; \ - CMD=gomemcache IMG_NAME=gomemcache-integ ./tools/wait.sh; \ - (cd instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/test && \ - $(GO) test \ - -covermode=$(COVERAGE_MODE) \ - -coverprofile=$(COVERAGE_PROFILE) \ - -coverpkg=go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/... \ - ./... \ - && $(GO) tool cover -html=$(COVERAGE_PROFILE) -o coverage.html); \ - docker stop gomemcache-integ ; \ - cp ./instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/test/coverage.out ./; \ - fi - # Releasing .PHONY: gorelease diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/consumer.go b/instrumentation/github.com/Shopify/sarama/otelsarama/consumer.go deleted file mode 100644 index 1c295e18205..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/consumer.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright The OpenTelemetry 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 otelsarama // import "go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama" - -import ( - "github.com/Shopify/sarama" -) - -type partitionConsumer struct { - sarama.PartitionConsumer - dispatcher consumerMessagesDispatcher -} - -// Messages returns the read channel for the messages that are returned by -// the broker. -func (pc *partitionConsumer) Messages() <-chan *sarama.ConsumerMessage { - return pc.dispatcher.Messages() -} - -// WrapPartitionConsumer wraps a sarama.PartitionConsumer causing each received -// message to be traced. -func WrapPartitionConsumer(pc sarama.PartitionConsumer, opts ...Option) sarama.PartitionConsumer { - cfg := newConfig(opts...) - - dispatcher := newConsumerMessagesDispatcherWrapper(pc, cfg) - go dispatcher.Run() - wrapped := &partitionConsumer{ - PartitionConsumer: pc, - dispatcher: dispatcher, - } - return wrapped -} - -type consumer struct { - sarama.Consumer - - opts []Option -} - -// ConsumePartition invokes Consumer.ConsumePartition and wraps the resulting -// PartitionConsumer. -func (c *consumer) ConsumePartition(topic string, partition int32, offset int64) (sarama.PartitionConsumer, error) { - pc, err := c.Consumer.ConsumePartition(topic, partition, offset) - if err != nil { - return nil, err - } - return WrapPartitionConsumer(pc, c.opts...), nil -} - -// WrapConsumer wraps a sarama.Consumer wrapping any PartitionConsumer created -// via Consumer.ConsumePartition. -func WrapConsumer(c sarama.Consumer, opts ...Option) sarama.Consumer { - return &consumer{ - Consumer: c, - opts: opts, - } -} diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/consumer_group.go b/instrumentation/github.com/Shopify/sarama/otelsarama/consumer_group.go deleted file mode 100644 index 8f4a4e39de7..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/consumer_group.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright The OpenTelemetry 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 otelsarama // import "go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama" - -import ( - "github.com/Shopify/sarama" -) - -type consumerGroupHandler struct { - sarama.ConsumerGroupHandler - - cfg config -} - -// ConsumeClaim wraps the session and claim to add instruments for messages. -// It implements parts of `ConsumerGroupHandler`. -func (h *consumerGroupHandler) ConsumeClaim(session sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error { - // Wrap claim - dispatcher := newConsumerMessagesDispatcherWrapper(claim, h.cfg) - go dispatcher.Run() - claim = &consumerGroupClaim{ - ConsumerGroupClaim: claim, - dispatcher: dispatcher, - } - - return h.ConsumerGroupHandler.ConsumeClaim(session, claim) -} - -// WrapConsumerGroupHandler wraps a sarama.ConsumerGroupHandler causing each received -// message to be traced. -func WrapConsumerGroupHandler(handler sarama.ConsumerGroupHandler, opts ...Option) sarama.ConsumerGroupHandler { - cfg := newConfig(opts...) - - return &consumerGroupHandler{ - ConsumerGroupHandler: handler, - cfg: cfg, - } -} - -type consumerGroupClaim struct { - sarama.ConsumerGroupClaim - dispatcher consumerMessagesDispatcher -} - -func (c *consumerGroupClaim) Messages() <-chan *sarama.ConsumerMessage { - return c.dispatcher.Messages() -} diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/consumer_group_test.go b/instrumentation/github.com/Shopify/sarama/otelsarama/consumer_group_test.go deleted file mode 100644 index e1cda3946a7..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/consumer_group_test.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright The OpenTelemetry 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 otelsarama - -// TODO: add test for consumer group -// Currently, sarama does not have a mock consumer group, so it's hard to -// write a unit test. -// Related PR: https://github.com/Shopify/sarama/pull/1750 diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/consumer_test.go b/instrumentation/github.com/Shopify/sarama/otelsarama/consumer_test.go deleted file mode 100644 index 3a6aa22e018..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/consumer_test.go +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright The OpenTelemetry 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 otelsarama - -import ( - "testing" - - "github.com/Shopify/sarama" - "github.com/Shopify/sarama/mocks" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/trace" -) - -const ( - topic = "test-topic" -) - -func TestConsumerConsumePartitionWithError(t *testing.T) { - // Mock partition consumer controller - mockConsumer := mocks.NewConsumer(t, sarama.NewConfig()) - mockConsumer.ExpectConsumePartition(topic, 0, 0) - - consumer := WrapConsumer(mockConsumer) - _, err := consumer.ConsumePartition(topic, 0, 0) - assert.NoError(t, err) - // Consume twice - _, err = consumer.ConsumePartition(topic, 0, 0) - assert.Error(t, err) -} - -func BenchmarkWrapPartitionConsumer(b *testing.B) { - // Mock provider - provider := trace.NewNoopTracerProvider() - - mockPartitionConsumer, partitionConsumer := createMockPartitionConsumer(b) - - partitionConsumer = WrapPartitionConsumer(partitionConsumer, WithTracerProvider(provider)) - message := sarama.ConsumerMessage{Key: []byte("foo")} - - b.ReportAllocs() - b.ResetTimer() - - for i := 0; i < b.N; i++ { - mockPartitionConsumer.YieldMessage(&message) - <-partitionConsumer.Messages() - } -} - -func BenchmarkMockPartitionConsumer(b *testing.B) { - mockPartitionConsumer, partitionConsumer := createMockPartitionConsumer(b) - - message := sarama.ConsumerMessage{Key: []byte("foo")} - - b.ReportAllocs() - b.ResetTimer() - - for i := 0; i < b.N; i++ { - mockPartitionConsumer.YieldMessage(&message) - <-partitionConsumer.Messages() - } -} - -func createMockPartitionConsumer(b *testing.B) (*mocks.PartitionConsumer, sarama.PartitionConsumer) { - // Mock partition consumer controller - consumer := mocks.NewConsumer(b, sarama.NewConfig()) - mockPartitionConsumer := consumer.ExpectConsumePartition(topic, 0, 0) - - // Create partition consumer - partitionConsumer, err := consumer.ConsumePartition(topic, 0, 0) - require.NoError(b, err) - return mockPartitionConsumer, partitionConsumer -} diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/dispatcher.go b/instrumentation/github.com/Shopify/sarama/otelsarama/dispatcher.go deleted file mode 100644 index 531e194b809..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/dispatcher.go +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright The OpenTelemetry 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 otelsarama // import "go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama" - -import ( - "context" - "fmt" - "strconv" - - "github.com/Shopify/sarama" - - "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" - "go.opentelemetry.io/otel/trace" -) - -type consumerMessagesDispatcher interface { - Messages() <-chan *sarama.ConsumerMessage -} - -type consumerMessagesDispatcherWrapper struct { - d consumerMessagesDispatcher - messages chan *sarama.ConsumerMessage - - cfg config -} - -func newConsumerMessagesDispatcherWrapper(d consumerMessagesDispatcher, cfg config) *consumerMessagesDispatcherWrapper { - return &consumerMessagesDispatcherWrapper{ - d: d, - messages: make(chan *sarama.ConsumerMessage), - cfg: cfg, - } -} - -// Messages returns the read channel for the messages that are returned by -// the broker. -func (w *consumerMessagesDispatcherWrapper) Messages() <-chan *sarama.ConsumerMessage { - return w.messages -} - -func (w *consumerMessagesDispatcherWrapper) Run() { - msgs := w.d.Messages() - - for msg := range msgs { - // Extract a span context from message to link. - carrier := NewConsumerMessageCarrier(msg) - parentSpanContext := w.cfg.Propagators.Extract(context.Background(), carrier) - - // Create a span. - attrs := []attribute.KeyValue{ - semconv.MessagingSystem("kafka"), - semconv.MessagingDestinationKindTopic, - semconv.MessagingDestinationName(msg.Topic), - semconv.MessagingOperationReceive, - semconv.MessagingMessageID(strconv.FormatInt(msg.Offset, 10)), - semconv.MessagingKafkaSourcePartition(int(msg.Partition)), - } - opts := []trace.SpanStartOption{ - trace.WithAttributes(attrs...), - trace.WithSpanKind(trace.SpanKindConsumer), - } - newCtx, span := w.cfg.Tracer.Start(parentSpanContext, fmt.Sprintf("%s receive", msg.Topic), opts...) - - // Inject current span context, so consumers can use it to propagate span. - w.cfg.Propagators.Inject(newCtx, carrier) - - // Send messages back to user. - w.messages <- msg - - span.End() - } - close(w.messages) -} diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/doc.go b/instrumentation/github.com/Shopify/sarama/otelsarama/doc.go deleted file mode 100644 index e8fbd30efa9..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/doc.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright The OpenTelemetry 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 otelsarama instruments the github.com/Shopify/sarama package. -// -// The consumer's span will be created as a child of the producer's span. -// -// Context propagation only works on Kafka versions higher than 0.11.0.0 which supports record headers. -// (https://archive.apache.org/dist/kafka/0.11.0.0/RELEASE_NOTES.html) -// -// Based on: https://github.com/DataDog/dd-trace-go/tree/v1/contrib/Shopify/sarama -// -// Deprecated: This module is no longer supported. -// github.com/Shopify/sarama moved to github.com/IBM/sarama. -package otelsarama // import "go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama" diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/example/README.md b/instrumentation/github.com/Shopify/sarama/otelsarama/example/README.md deleted file mode 100644 index e19ce0fab05..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/example/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# Kafka Sarama instrumentation example - -A Kafka producer and consumer using Sarama with instrumentation. - -These instructions expect you have -[docker-compose](https://docs.docker.com/compose/) installed. - -Bring up the `Kafka` and `ZooKeeper` services to run the -example: - -```sh -docker-compose up -d zoo kafka -``` - -Then up the `kafka-producer` service to produce a message into Kafka: - -```sh -docker-compose up kafka-producer -``` - -At last, up the `kafka-consumer` service to consume messages from Kafka: - -```sh -docker-compose up kafka-consumer -``` - -Shut down the services when you are finished with the example: - -```sh -docker-compose down -``` diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/example/consumer/Dockerfile b/instrumentation/github.com/Shopify/sarama/otelsarama/example/consumer/Dockerfile deleted file mode 100644 index 62e3bce18f2..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/example/consumer/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright The OpenTelemetry 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. -FROM golang:alpine AS base -COPY . /src/ -WORKDIR /src/instrumentation/github.com/Shopify/sarama/otelsarama/example - -FROM base AS kafka-consumer -RUN go install ./consumer/consumer.go -CMD ["/go/bin/consumer"] - diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/example/consumer/consumer.go b/instrumentation/github.com/Shopify/sarama/otelsarama/example/consumer/consumer.go deleted file mode 100644 index 5b8dede80c0..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/example/consumer/consumer.go +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright The OpenTelemetry 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 main - -import ( - "context" - "flag" - "fmt" - "log" - "os" - "os/signal" - "strings" - "time" - - "github.com/Shopify/sarama" - - "go.opentelemetry.io/otel" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" - "go.opentelemetry.io/otel/trace" - - "go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama" //nolint:staticcheck // This is deprecated and will be removed in the next release. - "go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama/example" -) - -var ( - brokers = flag.String("brokers", os.Getenv("KAFKA_PEERS"), "The Kafka brokers to connect to, as a comma separated list") -) - -func main() { - tp, err := example.InitTracer() - if err != nil { - log.Fatal(err) - } - defer func() { - if err := tp.Shutdown(context.Background()); err != nil { - log.Printf("Error shutting down tracer provider: %v", err) - } - }() - flag.Parse() - - if *brokers == "" { - flag.PrintDefaults() - os.Exit(1) - } - - brokerList := strings.Split(*brokers, ",") - log.Printf("Kafka brokers: %s", strings.Join(brokerList, ", ")) - - ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt) - defer cancel() - if err := startConsumerGroup(ctx, brokerList); err != nil { - log.Fatal(err) - } - - <-ctx.Done() -} - -func startConsumerGroup(ctx context.Context, brokerList []string) error { - consumerGroupHandler := Consumer{} - // Wrap instrumentation - handler := otelsarama.WrapConsumerGroupHandler(&consumerGroupHandler) - - config := sarama.NewConfig() - config.Version = sarama.V2_5_0_0 - config.Consumer.Offsets.Initial = sarama.OffsetOldest - - // Create consumer group - consumerGroup, err := sarama.NewConsumerGroup(brokerList, "example", config) - if err != nil { - return fmt.Errorf("starting consumer group: %w", err) - } - - err = consumerGroup.Consume(ctx, []string{example.KafkaTopic}, handler) - if err != nil { - return fmt.Errorf("consuming via handler: %w", err) - } - return nil -} - -func printMessage(msg *sarama.ConsumerMessage) { - // Extract tracing info from message - ctx := otel.GetTextMapPropagator().Extract(context.Background(), otelsarama.NewConsumerMessageCarrier(msg)) - - tr := otel.Tracer("consumer") - _, span := tr.Start(ctx, "consume message", trace.WithAttributes( - semconv.MessagingOperationProcess, - )) - defer span.End() - - // Emulate Work loads - time.Sleep(1 * time.Second) - - log.Println("Successful to read message: ", string(msg.Value)) -} - -// Consumer represents a Sarama consumer group consumer. -type Consumer struct { -} - -// Setup is run at the beginning of a new session, before ConsumeClaim. -func (consumer *Consumer) Setup(sarama.ConsumerGroupSession) error { - return nil -} - -// Cleanup is run at the end of a session, once all ConsumeClaim goroutines have exited. -func (consumer *Consumer) Cleanup(sarama.ConsumerGroupSession) error { - return nil -} - -// ConsumeClaim must start a consumer loop of ConsumerGroupClaim's Messages(). -func (consumer *Consumer) ConsumeClaim(session sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error { - // NOTE: - // Do not move the code below to a goroutine. - // The `ConsumeClaim` itself is called within a goroutine, see: - // https://github.com/Shopify/sarama/blob/master/consumer_group.go#L27-L29 - for message := range claim.Messages() { - printMessage(message) - session.MarkMessage(message, "") - } - - return nil -} diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/example/docker-compose.yml b/instrumentation/github.com/Shopify/sarama/otelsarama/example/docker-compose.yml deleted file mode 100644 index d3473031f0a..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/example/docker-compose.yml +++ /dev/null @@ -1,75 +0,0 @@ -# Copyright The OpenTelemetry 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. -version: "3.7" -services: - zoo: - image: zookeeper:3.4.9 - hostname: zoo - ports: - - "2181:2181" - environment: - ZOO_MY_ID: 1 - ZOO_PORT: 2181 - ZOO_SERVERS: server.1=zoo:2888:3888 - networks: - - example - kafka: - # Kafka version 2.5.0 - image: confluentinc/cp-kafka:5.5.0 - hostname: kafka - ports: - - "9092:9092" - environment: - KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka:19092,LISTENER_DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9092 - KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT - KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL - KAFKA_ZOOKEEPER_CONNECT: "zoo:2181" - KAFKA_BROKER_ID: 1 - KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO" - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 - depends_on: - - zoo - networks: - - example - - kafka-producer: - build: - dockerfile: $PWD/producer/Dockerfile - context: ../../../../../.. - command: - - "/bin/sh" - - "-c" - - "/go/bin/producer" - environment: - KAFKA_PEERS: kafka:19092 - depends_on: - - kafka - networks: - - example - kafka-consumer: - build: - dockerfile: $PWD/consumer/Dockerfile - context: ../../../../../.. - command: - - "/bin/sh" - - "-c" - - "/go/bin/consumer" - environment: - KAFKA_PEERS: kafka:19092 - depends_on: - - kafka - networks: - - example -networks: - example: \ No newline at end of file diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/example/go.mod b/instrumentation/github.com/Shopify/sarama/otelsarama/example/go.mod deleted file mode 100644 index 6ed1322e311..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/example/go.mod +++ /dev/null @@ -1,41 +0,0 @@ -// Deprecated: This module is no longer supported. -// github.com/Shopify/sarama moved to github.com/IBM/sarama. -module go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama/example - -go 1.18 - -replace go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama => ../ - -require ( - github.com/Shopify/sarama v1.38.1 - go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama v0.43.0 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 -) - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/eapache/go-resiliency v1.3.0 // indirect - github.com/eapache/go-xerial-snappy v0.0.0-20230111030713-bf00bc1b83b6 // indirect - github.com/eapache/queue v1.1.0 // indirect - github.com/go-logr/logr v1.2.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/snappy v0.0.4 // indirect - github.com/hashicorp/errwrap v1.0.0 // indirect - github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-uuid v1.0.3 // indirect - github.com/jcmturner/aescts/v2 v2.0.0 // indirect - github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect - github.com/jcmturner/gofork v1.7.6 // indirect - github.com/jcmturner/gokrb5/v8 v8.4.3 // indirect - github.com/jcmturner/rpc/v2 v2.0.3 // indirect - github.com/klauspost/compress v1.15.14 // indirect - github.com/pierrec/lz4/v4 v4.1.17 // indirect - github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect - golang.org/x/crypto v0.13.0 // indirect - golang.org/x/net v0.15.0 // indirect - golang.org/x/sys v0.12.0 // indirect -) diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/example/go.sum b/instrumentation/github.com/Shopify/sarama/otelsarama/example/go.sum deleted file mode 100644 index 1fb2ee1e220..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/example/go.sum +++ /dev/null @@ -1,94 +0,0 @@ -github.com/Shopify/sarama v1.38.1 h1:lqqPUPQZ7zPqYlWpTh+LQ9bhYNu2xJL6k1SJN4WVe2A= -github.com/Shopify/sarama v1.38.1/go.mod h1:iwv9a67Ha8VNa+TifujYoWGxWnu2kNVAQdSdZ4X2o5g= -github.com/Shopify/toxiproxy/v2 v2.5.0 h1:i4LPT+qrSlKNtQf5QliVjdP08GyAH8+BUIc9gT0eahc= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/eapache/go-resiliency v1.3.0 h1:RRL0nge+cWGlxXbUzJ7yMcq6w2XBEr19dCN6HECGaT0= -github.com/eapache/go-resiliency v1.3.0/go.mod h1:5yPzW0MIvSe0JDsv0v+DvcjEv2FyD6iZYSs1ZI+iQho= -github.com/eapache/go-xerial-snappy v0.0.0-20230111030713-bf00bc1b83b6 h1:8yY/I9ndfrgrXUbOGObLHKBR4Fl3nZXwM2c7OYTT8hM= -github.com/eapache/go-xerial-snappy v0.0.0-20230111030713-bf00bc1b83b6/go.mod h1:YvSRo5mw33fLEx1+DlK6L2VV43tJt5Eyel9n9XBcR+0= -github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc= -github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= -github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= -github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= -github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= -github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/jcmturner/aescts/v2 v2.0.0 h1:9YKLH6ey7H4eDBXW8khjYslgyqG2xZikXP0EQFKrle8= -github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= -github.com/jcmturner/dnsutils/v2 v2.0.0 h1:lltnkeZGL0wILNvrNiVCR6Ro5PGU/SeBvVO/8c/iPbo= -github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM= -github.com/jcmturner/gofork v1.7.6 h1:QH0l3hzAU1tfT3rZCnW5zXl+orbkNMMRGJfdJjHVETg= -github.com/jcmturner/gofork v1.7.6/go.mod h1:1622LH6i/EZqLloHfE7IeZ0uEJwMSUyQ/nDd82IeqRo= -github.com/jcmturner/goidentity/v6 v6.0.1 h1:VKnZd2oEIMorCTsFBnJWbExfNN7yZr3EhJAxwOkZg6o= -github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg= -github.com/jcmturner/gokrb5/v8 v8.4.3 h1:iTonLeSJOn7MVUtyMT+arAn5AKAPrkilzhGw8wE/Tq8= -github.com/jcmturner/gokrb5/v8 v8.4.3/go.mod h1:dqRwJGXznQrzw6cWmyo6kH+E7jksEQG/CyVWsJEsJO0= -github.com/jcmturner/rpc/v2 v2.0.3 h1:7FXXj8Ti1IaVFpSAziCZWNzbNuZmnvw/i6CqLNdWfZY= -github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= -github.com/klauspost/compress v1.15.14 h1:i7WCKDToww0wA+9qrUZ1xOjp218vfFo3nTU6UHp+gOc= -github.com/klauspost/compress v1.15.14/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= -github.com/pierrec/lz4/v4 v4.1.17 h1:kV4Ip+/hUBC+8T6+2EgburRtkE9ef4nbY3f4dFhGjMc= -github.com/pierrec/lz4/v4 v4.1.17/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= -github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -go.opentelemetry.io/otel v1.17.0 h1:MW+phZ6WZ5/uk2nd93ANk/6yJ+dVrvNWUjGhnnFU5jM= -go.opentelemetry.io/otel v1.17.0/go.mod h1:I2vmBGtFaODIVMBSTPVDlJSzBDNf93k60E6Ft0nyjo0= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.17.0 h1:Ut6hgtYcASHwCzRHkXEtSsM251cXJPW+Z9DyLwEn6iI= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.17.0/go.mod h1:TYeE+8d5CjrgBa0ZuRaDeMpIC1xZ7atg4g+nInjuSjc= -go.opentelemetry.io/otel/metric v1.17.0 h1:iG6LGVz5Gh+IuO0jmgvpTB6YVrCGngi8QGm+pMd8Pdc= -go.opentelemetry.io/otel/metric v1.17.0/go.mod h1:h4skoxdZI17AxwITdmdZjjYJQH5nzijUUjm+wtPph5o= -go.opentelemetry.io/otel/sdk v1.17.0 h1:FLN2X66Ke/k5Sg3V623Q7h7nt3cHXaW1FOvKKrW0IpE= -go.opentelemetry.io/otel/sdk v1.17.0/go.mod h1:U87sE0f5vQB7hwUoW98pW5Rz4ZDuCFBZFNUBlSgmDFQ= -go.opentelemetry.io/otel/trace v1.17.0 h1:/SWhSRHmDPOImIAetP1QAeMnZYiQXrTy4fMMYOdSKWQ= -go.opentelemetry.io/otel/trace v1.17.0/go.mod h1:I/4vKTgFclIsXRVucpH25X0mpFSczM7aHeaz0ZBLWjY= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220725212005-46097bf591d3/go.mod h1:AaygXjzTFtRAg2ttMY5RMuhpJ3cNnI0XpyFJD1iQRSM= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/example/init.go b/instrumentation/github.com/Shopify/sarama/otelsarama/example/init.go deleted file mode 100644 index 0f578658579..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/example/init.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright The OpenTelemetry 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 example // import "go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama/example" - -import ( - "go.opentelemetry.io/otel" - stdout "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" - "go.opentelemetry.io/otel/propagation" - sdktrace "go.opentelemetry.io/otel/sdk/trace" -) - -const ( - // KafkaTopic name. - KafkaTopic = "sarama-instrumentation-example" -) - -// InitTracer creates and registers globally a new TracerProvider. -func InitTracer() (*sdktrace.TracerProvider, error) { - exporter, err := stdout.New(stdout.WithPrettyPrint()) - if err != nil { - return nil, err - } - tp := sdktrace.NewTracerProvider( - sdktrace.WithSampler(sdktrace.AlwaysSample()), - sdktrace.WithBatcher(exporter), - ) - otel.SetTracerProvider(tp) - otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{})) - return tp, nil -} diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/example/producer/Dockerfile b/instrumentation/github.com/Shopify/sarama/otelsarama/example/producer/Dockerfile deleted file mode 100644 index 8cc7c41d6f8..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/example/producer/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright The OpenTelemetry 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. -FROM golang:alpine AS base -COPY . /src/ -WORKDIR /src/instrumentation/github.com/Shopify/sarama/otelsarama/example - -FROM base AS kafka-producer -RUN go install ./producer/producer.go -CMD ["/go/bin/producer"] diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/example/producer/producer.go b/instrumentation/github.com/Shopify/sarama/otelsarama/example/producer/producer.go deleted file mode 100644 index 9aa6a2e944f..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/example/producer/producer.go +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright The OpenTelemetry 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 main - -import ( - "context" - "flag" - "fmt" - "log" - "math/rand" - "os" - "strings" - "time" - - "github.com/Shopify/sarama" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/codes" - - "go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama" //nolint:staticcheck // This is deprecated and will be removed in the next release. - "go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama/example" -) - -var ( - brokers = flag.String("brokers", os.Getenv("KAFKA_PEERS"), "The Kafka brokers to connect to, as a comma separated list") -) - -func main() { - tp, err := example.InitTracer() - if err != nil { - log.Fatal(err) - } - defer func() { - if err := tp.Shutdown(context.Background()); err != nil { - log.Printf("Error shutting down tracer provider: %v", err) - } - }() - flag.Parse() - - if *brokers == "" { - flag.PrintDefaults() - os.Exit(1) - } - - brokerList := strings.Split(*brokers, ",") - log.Printf("Kafka brokers: %s", strings.Join(brokerList, ", ")) - - producer, err := newAccessLogProducer(brokerList) - if err != nil { - log.Fatal(err) - } - - // Create root span - tr := otel.Tracer("producer") - ctx, span := tr.Start(context.Background(), "produce message") - defer span.End() - - // Inject tracing info into message - rng := rand.New(rand.NewSource(time.Now().Unix())) - msg := sarama.ProducerMessage{ - Topic: example.KafkaTopic, - Key: sarama.StringEncoder("random_number"), - Value: sarama.StringEncoder(fmt.Sprintf("%d", rng.Intn(1000))), - } - otel.GetTextMapPropagator().Inject(ctx, otelsarama.NewProducerMessageCarrier(&msg)) - - producer.Input() <- &msg - successMsg := <-producer.Successes() - log.Println("Successful to write message, offset:", successMsg.Offset) - - err = producer.Close() - if err != nil { - span.SetStatus(codes.Error, err.Error()) - log.Fatalln("Failed to close producer:", err) - } -} - -func newAccessLogProducer(brokerList []string) (sarama.AsyncProducer, error) { - config := sarama.NewConfig() - config.Version = sarama.V2_5_0_0 - // So we can know the partition and offset of messages. - config.Producer.Return.Successes = true - - producer, err := sarama.NewAsyncProducer(brokerList, config) - if err != nil { - return nil, fmt.Errorf("starting Sarama producer: %w", err) - } - - // Wrap instrumentation - producer = otelsarama.WrapAsyncProducer(config, producer) - - // We will log to STDOUT if we're not able to produce messages. - go func() { - for err := range producer.Errors() { - log.Println("Failed to write message:", err) - } - }() - - return producer, nil -} diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/go.mod b/instrumentation/github.com/Shopify/sarama/otelsarama/go.mod deleted file mode 100644 index 89c37468807..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/go.mod +++ /dev/null @@ -1,40 +0,0 @@ -// Deprecated: This module is no longer supported. -// github.com/Shopify/sarama moved to github.com/IBM/sarama. -module go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama - -go 1.19 - -require ( - github.com/Shopify/sarama v1.38.1 - github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 -) - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/eapache/go-resiliency v1.3.0 // indirect - github.com/eapache/go-xerial-snappy v0.0.0-20230111030713-bf00bc1b83b6 // indirect - github.com/eapache/queue v1.1.0 // indirect - github.com/go-logr/logr v1.2.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/snappy v0.0.4 // indirect - github.com/hashicorp/errwrap v1.0.0 // indirect - github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-uuid v1.0.3 // indirect - github.com/jcmturner/aescts/v2 v2.0.0 // indirect - github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect - github.com/jcmturner/gofork v1.7.6 // indirect - github.com/jcmturner/gokrb5/v8 v8.4.3 // indirect - github.com/jcmturner/rpc/v2 v2.0.3 // indirect - github.com/klauspost/compress v1.15.14 // indirect - github.com/kr/text v0.2.0 // indirect - github.com/pierrec/lz4/v4 v4.1.17 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect - github.com/rogpeppe/go-internal v1.9.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect - golang.org/x/crypto v0.13.0 // indirect - golang.org/x/net v0.15.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/go.sum b/instrumentation/github.com/Shopify/sarama/otelsarama/go.sum deleted file mode 100644 index 6cc40843d2e..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/go.sum +++ /dev/null @@ -1,96 +0,0 @@ -github.com/Shopify/sarama v1.38.1 h1:lqqPUPQZ7zPqYlWpTh+LQ9bhYNu2xJL6k1SJN4WVe2A= -github.com/Shopify/sarama v1.38.1/go.mod h1:iwv9a67Ha8VNa+TifujYoWGxWnu2kNVAQdSdZ4X2o5g= -github.com/Shopify/toxiproxy/v2 v2.5.0 h1:i4LPT+qrSlKNtQf5QliVjdP08GyAH8+BUIc9gT0eahc= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/eapache/go-resiliency v1.3.0 h1:RRL0nge+cWGlxXbUzJ7yMcq6w2XBEr19dCN6HECGaT0= -github.com/eapache/go-resiliency v1.3.0/go.mod h1:5yPzW0MIvSe0JDsv0v+DvcjEv2FyD6iZYSs1ZI+iQho= -github.com/eapache/go-xerial-snappy v0.0.0-20230111030713-bf00bc1b83b6 h1:8yY/I9ndfrgrXUbOGObLHKBR4Fl3nZXwM2c7OYTT8hM= -github.com/eapache/go-xerial-snappy v0.0.0-20230111030713-bf00bc1b83b6/go.mod h1:YvSRo5mw33fLEx1+DlK6L2VV43tJt5Eyel9n9XBcR+0= -github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc= -github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= -github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= -github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= -github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= -github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/jcmturner/aescts/v2 v2.0.0 h1:9YKLH6ey7H4eDBXW8khjYslgyqG2xZikXP0EQFKrle8= -github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= -github.com/jcmturner/dnsutils/v2 v2.0.0 h1:lltnkeZGL0wILNvrNiVCR6Ro5PGU/SeBvVO/8c/iPbo= -github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM= -github.com/jcmturner/gofork v1.7.6 h1:QH0l3hzAU1tfT3rZCnW5zXl+orbkNMMRGJfdJjHVETg= -github.com/jcmturner/gofork v1.7.6/go.mod h1:1622LH6i/EZqLloHfE7IeZ0uEJwMSUyQ/nDd82IeqRo= -github.com/jcmturner/goidentity/v6 v6.0.1 h1:VKnZd2oEIMorCTsFBnJWbExfNN7yZr3EhJAxwOkZg6o= -github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg= -github.com/jcmturner/gokrb5/v8 v8.4.3 h1:iTonLeSJOn7MVUtyMT+arAn5AKAPrkilzhGw8wE/Tq8= -github.com/jcmturner/gokrb5/v8 v8.4.3/go.mod h1:dqRwJGXznQrzw6cWmyo6kH+E7jksEQG/CyVWsJEsJO0= -github.com/jcmturner/rpc/v2 v2.0.3 h1:7FXXj8Ti1IaVFpSAziCZWNzbNuZmnvw/i6CqLNdWfZY= -github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= -github.com/klauspost/compress v1.15.14 h1:i7WCKDToww0wA+9qrUZ1xOjp218vfFo3nTU6UHp+gOc= -github.com/klauspost/compress v1.15.14/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pierrec/lz4/v4 v4.1.17 h1:kV4Ip+/hUBC+8T6+2EgburRtkE9ef4nbY3f4dFhGjMc= -github.com/pierrec/lz4/v4 v4.1.17/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= -github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -go.opentelemetry.io/otel v1.17.0 h1:MW+phZ6WZ5/uk2nd93ANk/6yJ+dVrvNWUjGhnnFU5jM= -go.opentelemetry.io/otel v1.17.0/go.mod h1:I2vmBGtFaODIVMBSTPVDlJSzBDNf93k60E6Ft0nyjo0= -go.opentelemetry.io/otel/metric v1.17.0 h1:iG6LGVz5Gh+IuO0jmgvpTB6YVrCGngi8QGm+pMd8Pdc= -go.opentelemetry.io/otel/metric v1.17.0/go.mod h1:h4skoxdZI17AxwITdmdZjjYJQH5nzijUUjm+wtPph5o= -go.opentelemetry.io/otel/trace v1.17.0 h1:/SWhSRHmDPOImIAetP1QAeMnZYiQXrTy4fMMYOdSKWQ= -go.opentelemetry.io/otel/trace v1.17.0/go.mod h1:I/4vKTgFclIsXRVucpH25X0mpFSczM7aHeaz0ZBLWjY= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220725212005-46097bf591d3/go.mod h1:AaygXjzTFtRAg2ttMY5RMuhpJ3cNnI0XpyFJD1iQRSM= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/message.go b/instrumentation/github.com/Shopify/sarama/otelsarama/message.go deleted file mode 100644 index a38e45a6df1..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/message.go +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright The OpenTelemetry 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 otelsarama // import "go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama" - -import ( - "github.com/Shopify/sarama" - - "go.opentelemetry.io/otel/propagation" -) - -var _ propagation.TextMapCarrier = (*ProducerMessageCarrier)(nil) -var _ propagation.TextMapCarrier = (*ConsumerMessageCarrier)(nil) - -// ProducerMessageCarrier injects and extracts traces from a sarama.ProducerMessage. -type ProducerMessageCarrier struct { - msg *sarama.ProducerMessage -} - -// NewProducerMessageCarrier creates a new ProducerMessageCarrier. -func NewProducerMessageCarrier(msg *sarama.ProducerMessage) ProducerMessageCarrier { - return ProducerMessageCarrier{msg: msg} -} - -// Get retrieves a single value for a given key. -func (c ProducerMessageCarrier) Get(key string) string { - for _, h := range c.msg.Headers { - if string(h.Key) == key { - return string(h.Value) - } - } - return "" -} - -// Set sets a header. -func (c ProducerMessageCarrier) Set(key, val string) { - // Ensure uniqueness of keys - for i := 0; i < len(c.msg.Headers); i++ { - if string(c.msg.Headers[i].Key) == key { - c.msg.Headers = append(c.msg.Headers[:i], c.msg.Headers[i+1:]...) - i-- - } - } - c.msg.Headers = append(c.msg.Headers, sarama.RecordHeader{ - Key: []byte(key), - Value: []byte(val), - }) -} - -// Keys returns a slice of all key identifiers in the carrier. -func (c ProducerMessageCarrier) Keys() []string { - out := make([]string, len(c.msg.Headers)) - for i, h := range c.msg.Headers { - out[i] = string(h.Key) - } - return out -} - -// ConsumerMessageCarrier injects and extracts traces from a sarama.ConsumerMessage. -type ConsumerMessageCarrier struct { - msg *sarama.ConsumerMessage -} - -// NewConsumerMessageCarrier creates a new ConsumerMessageCarrier. -func NewConsumerMessageCarrier(msg *sarama.ConsumerMessage) ConsumerMessageCarrier { - return ConsumerMessageCarrier{msg: msg} -} - -// Get retrieves a single value for a given key. -func (c ConsumerMessageCarrier) Get(key string) string { - for _, h := range c.msg.Headers { - if h != nil && string(h.Key) == key { - return string(h.Value) - } - } - return "" -} - -// Set sets a header. -func (c ConsumerMessageCarrier) Set(key, val string) { - // Ensure uniqueness of keys - for i := 0; i < len(c.msg.Headers); i++ { - if c.msg.Headers[i] != nil && string(c.msg.Headers[i].Key) == key { - c.msg.Headers = append(c.msg.Headers[:i], c.msg.Headers[i+1:]...) - i-- - } - } - c.msg.Headers = append(c.msg.Headers, &sarama.RecordHeader{ - Key: []byte(key), - Value: []byte(val), - }) -} - -// Keys returns a slice of all key identifiers in the carrier. -func (c ConsumerMessageCarrier) Keys() []string { - out := make([]string, len(c.msg.Headers)) - for i, h := range c.msg.Headers { - out[i] = string(h.Key) - } - return out -} diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/message_test.go b/instrumentation/github.com/Shopify/sarama/otelsarama/message_test.go deleted file mode 100644 index 271a28cdfd0..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/message_test.go +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright The OpenTelemetry 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 otelsarama - -import ( - "testing" - - "github.com/Shopify/sarama" - "github.com/stretchr/testify/assert" -) - -func TestProducerMessageCarrierGet(t *testing.T) { - testCases := []struct { - name string - carrier ProducerMessageCarrier - key string - expected string - }{ - { - name: "exists", - carrier: ProducerMessageCarrier{msg: &sarama.ProducerMessage{Headers: []sarama.RecordHeader{ - {Key: []byte("foo"), Value: []byte("bar")}, - }}}, - key: "foo", - expected: "bar", - }, - { - name: "not exists", - carrier: ProducerMessageCarrier{msg: &sarama.ProducerMessage{Headers: []sarama.RecordHeader{}}}, - key: "foo", - expected: "", - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - result := tc.carrier.Get(tc.key) - assert.Equal(t, tc.expected, result) - }) - } -} - -func TestProducerMessageCarrierSet(t *testing.T) { - msg := sarama.ProducerMessage{Headers: []sarama.RecordHeader{ - {Key: []byte("foo"), Value: []byte("bar")}, - }} - carrier := ProducerMessageCarrier{msg: &msg} - - carrier.Set("foo", "bar2") - carrier.Set("foo2", "bar2") - carrier.Set("foo2", "bar3") - carrier.Set("foo3", "bar4") - - assert.ElementsMatch(t, carrier.msg.Headers, []sarama.RecordHeader{ - {Key: []byte("foo"), Value: []byte("bar2")}, - {Key: []byte("foo2"), Value: []byte("bar3")}, - {Key: []byte("foo3"), Value: []byte("bar4")}, - }) -} - -func TestProducerMessageCarrierKeys(t *testing.T) { - testCases := []struct { - name string - carrier ProducerMessageCarrier - expected []string - }{ - { - name: "one", - carrier: ProducerMessageCarrier{msg: &sarama.ProducerMessage{Headers: []sarama.RecordHeader{ - {Key: []byte("foo"), Value: []byte("bar")}, - }}}, - expected: []string{"foo"}, - }, - { - name: "none", - carrier: ProducerMessageCarrier{msg: &sarama.ProducerMessage{Headers: []sarama.RecordHeader{}}}, - expected: []string{}, - }, - { - name: "many", - carrier: ProducerMessageCarrier{msg: &sarama.ProducerMessage{Headers: []sarama.RecordHeader{ - {Key: []byte("foo"), Value: []byte("bar")}, - {Key: []byte("baz"), Value: []byte("quux")}, - }}}, - expected: []string{"foo", "baz"}, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - result := tc.carrier.Keys() - assert.Equal(t, tc.expected, result) - }) - } -} - -func TestConsumerMessageCarrierGet(t *testing.T) { - testCases := []struct { - name string - carrier ConsumerMessageCarrier - key string - expected string - }{ - { - name: "exists", - carrier: ConsumerMessageCarrier{msg: &sarama.ConsumerMessage{Headers: []*sarama.RecordHeader{ - {Key: []byte("foo"), Value: []byte("bar")}, - }}}, - key: "foo", - expected: "bar", - }, - { - name: "not exists", - carrier: ConsumerMessageCarrier{msg: &sarama.ConsumerMessage{Headers: []*sarama.RecordHeader{}}}, - key: "foo", - expected: "", - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - result := tc.carrier.Get(tc.key) - assert.Equal(t, tc.expected, result) - }) - } -} - -func TestConsumerMessageCarrierSet(t *testing.T) { - msg := sarama.ConsumerMessage{Headers: []*sarama.RecordHeader{ - {Key: []byte("foo"), Value: []byte("bar")}, - }} - carrier := ConsumerMessageCarrier{msg: &msg} - - carrier.Set("foo", "bar2") - carrier.Set("foo2", "bar2") - carrier.Set("foo2", "bar3") - carrier.Set("foo3", "bar4") - - assert.ElementsMatch(t, carrier.msg.Headers, []*sarama.RecordHeader{ - {Key: []byte("foo"), Value: []byte("bar2")}, - {Key: []byte("foo2"), Value: []byte("bar3")}, - {Key: []byte("foo3"), Value: []byte("bar4")}, - }) -} - -func TestConsumerMessageCarrierKeys(t *testing.T) { - testCases := []struct { - name string - carrier ConsumerMessageCarrier - expected []string - }{ - { - name: "one", - carrier: ConsumerMessageCarrier{msg: &sarama.ConsumerMessage{Headers: []*sarama.RecordHeader{ - {Key: []byte("foo"), Value: []byte("bar")}, - }}}, - expected: []string{"foo"}, - }, - { - name: "none", - carrier: ConsumerMessageCarrier{msg: &sarama.ConsumerMessage{Headers: []*sarama.RecordHeader{}}}, - expected: []string{}, - }, - { - name: "many", - carrier: ConsumerMessageCarrier{msg: &sarama.ConsumerMessage{Headers: []*sarama.RecordHeader{ - {Key: []byte("foo"), Value: []byte("bar")}, - {Key: []byte("baz"), Value: []byte("quux")}, - }}}, - expected: []string{"foo", "baz"}, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - result := tc.carrier.Keys() - assert.Equal(t, tc.expected, result) - }) - } -} diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/option.go b/instrumentation/github.com/Shopify/sarama/otelsarama/option.go deleted file mode 100644 index e7667c7f8fb..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/option.go +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright The OpenTelemetry 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 otelsarama // import "go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama" - -import ( - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/propagation" - "go.opentelemetry.io/otel/trace" -) - -const defaultTracerName = "go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama" - -type config struct { - TracerProvider trace.TracerProvider - Propagators propagation.TextMapPropagator - - Tracer trace.Tracer -} - -// newConfig returns a config with all Options set. -func newConfig(opts ...Option) config { - cfg := config{ - Propagators: otel.GetTextMapPropagator(), - TracerProvider: otel.GetTracerProvider(), - } - for _, opt := range opts { - opt.apply(&cfg) - } - - cfg.Tracer = cfg.TracerProvider.Tracer( - defaultTracerName, - trace.WithInstrumentationVersion(Version()), - ) - - return cfg -} - -// Option interface used for setting optional config properties. -type Option interface { - apply(*config) -} - -type optionFunc func(*config) - -func (fn optionFunc) apply(c *config) { - fn(c) -} - -// WithTracerProvider specifies a tracer provider to use for creating a tracer. -// If none is specified, the global provider is used. -func WithTracerProvider(provider trace.TracerProvider) Option { - return optionFunc(func(cfg *config) { - if provider != nil { - cfg.TracerProvider = provider - } - }) -} - -// WithPropagators specifies propagators to use for extracting -// information from the HTTP requests. If none are specified, global -// ones will be used. -func WithPropagators(propagators propagation.TextMapPropagator) Option { - return optionFunc(func(cfg *config) { - if propagators != nil { - cfg.Propagators = propagators - } - }) -} diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/option_test.go b/instrumentation/github.com/Shopify/sarama/otelsarama/option_test.go deleted file mode 100644 index 4fa2bf02e71..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/option_test.go +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright The OpenTelemetry 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 otelsarama - -import ( - "context" - "testing" - - "github.com/stretchr/testify/assert" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/propagation" - "go.opentelemetry.io/otel/trace" -) - -// We need a fake tracer provider to ensure the one passed in options is the one used afterwards. -// In order to avoid adding the SDK as a dependency, we use this mock. -type fakeTracerProvider struct{} - -func (fakeTracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.Tracer { - return fakeTracer{ - name: name, - } -} - -type fakeTracer struct { - name string -} - -func (fakeTracer) Start(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span) { - return ctx, nil -} - -func TestNewConfig(t *testing.T) { - tp := fakeTracerProvider{} - prop := propagation.NewCompositeTextMapPropagator() - - testCases := []struct { - name string - opts []Option - expected config - }{ - { - name: "with provider", - opts: []Option{ - WithTracerProvider(tp), - }, - expected: config{ - TracerProvider: tp, - Tracer: tp.Tracer(defaultTracerName, trace.WithInstrumentationVersion(Version())), - Propagators: otel.GetTextMapPropagator(), - }, - }, - { - name: "with empty provider", - opts: []Option{ - WithTracerProvider(nil), - }, - expected: config{ - TracerProvider: otel.GetTracerProvider(), - Tracer: otel.GetTracerProvider().Tracer(defaultTracerName, trace.WithInstrumentationVersion(Version())), - Propagators: otel.GetTextMapPropagator(), - }, - }, - { - name: "with propagators", - opts: []Option{ - WithPropagators(prop), - }, - expected: config{ - TracerProvider: otel.GetTracerProvider(), - Tracer: otel.GetTracerProvider().Tracer(defaultTracerName, trace.WithInstrumentationVersion(Version())), - Propagators: prop, - }, - }, - { - name: "with empty propagators", - opts: []Option{ - WithPropagators(nil), - }, - expected: config{ - TracerProvider: otel.GetTracerProvider(), - Tracer: otel.GetTracerProvider().Tracer(defaultTracerName, trace.WithInstrumentationVersion(Version())), - Propagators: otel.GetTextMapPropagator(), - }, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - result := newConfig(tc.opts...) - assert.Equal(t, tc.expected, result) - }) - } -} diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/producer.go b/instrumentation/github.com/Shopify/sarama/otelsarama/producer.go deleted file mode 100644 index 66b350a01ef..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/producer.go +++ /dev/null @@ -1,317 +0,0 @@ -// Copyright The OpenTelemetry 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 otelsarama // import "go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama" - -import ( - "context" - "encoding/binary" - "fmt" - "strconv" - "sync" - - "github.com/Shopify/sarama" - - "go.opentelemetry.io/otel/codes" - - "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" - "go.opentelemetry.io/otel/trace" -) - -type syncProducer struct { - sarama.SyncProducer - cfg config - saramaConfig *sarama.Config -} - -// SendMessage calls sarama.SyncProducer.SendMessage and traces the request. -func (p *syncProducer) SendMessage(msg *sarama.ProducerMessage) (partition int32, offset int64, err error) { - span := startProducerSpan(p.cfg, p.saramaConfig.Version, msg) - partition, offset, err = p.SyncProducer.SendMessage(msg) - finishProducerSpan(span, partition, offset, err) - return partition, offset, err -} - -// SendMessages calls sarama.SyncProducer.SendMessages and traces the requests. -func (p *syncProducer) SendMessages(msgs []*sarama.ProducerMessage) error { - // Although there's only one call made to the SyncProducer, the messages are - // treated individually, so we create a span for each one - spans := make([]trace.Span, len(msgs)) - for i, msg := range msgs { - spans[i] = startProducerSpan(p.cfg, p.saramaConfig.Version, msg) - } - err := p.SyncProducer.SendMessages(msgs) - for i, span := range spans { - finishProducerSpan(span, msgs[i].Partition, msgs[i].Offset, err) - } - return err -} - -// WrapSyncProducer wraps a sarama.SyncProducer so that all produced messages -// are traced. -func WrapSyncProducer(saramaConfig *sarama.Config, producer sarama.SyncProducer, opts ...Option) sarama.SyncProducer { - cfg := newConfig(opts...) - if saramaConfig == nil { - saramaConfig = sarama.NewConfig() - } - - return &syncProducer{ - SyncProducer: producer, - cfg: cfg, - saramaConfig: saramaConfig, - } -} - -type asyncProducer struct { - sarama.AsyncProducer - input chan *sarama.ProducerMessage - successes chan *sarama.ProducerMessage - errors chan *sarama.ProducerError - closeErr chan error - closeSig chan struct{} - closeAsyncSig chan struct{} -} - -// Input returns the input channel. -func (p *asyncProducer) Input() chan<- *sarama.ProducerMessage { - return p.input -} - -// Successes returns the successes channel. -func (p *asyncProducer) Successes() <-chan *sarama.ProducerMessage { - return p.successes -} - -// Errors returns the errors channel. -func (p *asyncProducer) Errors() <-chan *sarama.ProducerError { - return p.errors -} - -// AsyncClose async close producer. -func (p *asyncProducer) AsyncClose() { - close(p.input) - close(p.closeAsyncSig) -} - -// Close shuts down the producer and waits for any buffered messages to be -// flushed. -// -// Due to the implement of sarama, some messages may lose successes or errors status -// while closing. -func (p *asyncProducer) Close() error { - close(p.input) - close(p.closeSig) - return <-p.closeErr -} - -type producerMessageContext struct { - span trace.Span - metadataBackup interface{} -} - -// WrapAsyncProducer wraps a sarama.AsyncProducer so that all produced messages -// are traced. It requires the underlying sarama Config, so we can know whether -// or not successes will be returned. -// -// If `Return.Successes` is false, there is no way to know partition and offset of -// the message. -func WrapAsyncProducer(saramaConfig *sarama.Config, p sarama.AsyncProducer, opts ...Option) sarama.AsyncProducer { - cfg := newConfig(opts...) - if saramaConfig == nil { - saramaConfig = sarama.NewConfig() - } - - wrapped := &asyncProducer{ - AsyncProducer: p, - input: make(chan *sarama.ProducerMessage), - successes: make(chan *sarama.ProducerMessage), - errors: make(chan *sarama.ProducerError), - closeErr: make(chan error), - closeSig: make(chan struct{}), - closeAsyncSig: make(chan struct{}), - } - - var ( - mtx sync.Mutex - producerMessageContexts = make(map[interface{}]producerMessageContext) - ) - - // Spawn Input producer goroutine. - go func() { - for { - select { - case <-wrapped.closeSig: - wrapped.closeErr <- p.Close() - return - case <-wrapped.closeAsyncSig: - p.AsyncClose() - return - case msg, ok := <-wrapped.input: - if !ok { - continue // wait for closeAsyncSig - } - span := startProducerSpan(cfg, saramaConfig.Version, msg) - - // Create message context, backend message metadata - mc := producerMessageContext{ - metadataBackup: msg.Metadata, - span: span, - } - - // Remember metadata using span ID as a cache key - msg.Metadata = span.SpanContext().SpanID() - if saramaConfig.Producer.Return.Successes { - mtx.Lock() - producerMessageContexts[msg.Metadata] = mc - mtx.Unlock() - } else { - // If returning successes isn't enabled, we just finish the - // span right away because there's no way to know when it will - // be done. - mc.span.End() - } - - p.Input() <- msg - } - } - }() - - // Sarama will consume all the successes and errors by itself while closing, - // so we need to end these spans ourselves. - var cleanupWg sync.WaitGroup - - // Spawn Successes consumer goroutine. - cleanupWg.Add(1) - go func() { - defer func() { - close(wrapped.successes) - cleanupWg.Done() - }() - for msg := range p.Successes() { - key := msg.Metadata - mtx.Lock() - if mc, ok := producerMessageContexts[key]; ok { - delete(producerMessageContexts, key) - finishProducerSpan(mc.span, msg.Partition, msg.Offset, nil) - msg.Metadata = mc.metadataBackup // Restore message metadata - } - mtx.Unlock() - wrapped.successes <- msg - } - }() - - // Spawn Errors consumer goroutine. - cleanupWg.Add(1) - go func() { - defer func() { - close(wrapped.errors) - cleanupWg.Done() - }() - for errMsg := range p.Errors() { - key := errMsg.Msg.Metadata - mtx.Lock() - if mc, ok := producerMessageContexts[key]; ok { - delete(producerMessageContexts, key) - finishProducerSpan(mc.span, errMsg.Msg.Partition, errMsg.Msg.Offset, errMsg.Err) - errMsg.Msg.Metadata = mc.metadataBackup // Restore message metadata - } - mtx.Unlock() - wrapped.errors <- errMsg - } - }() - - // Spawn spans cleanup goroutine. - go func() { - // wait until both consumer goroutines are closed - cleanupWg.Wait() - // end all remaining spans - mtx.Lock() - for _, mc := range producerMessageContexts { - mc.span.End() - } - mtx.Unlock() - }() - - return wrapped -} - -// msgPayloadSize returns the approximate estimate of message size in bytes. -// -// For kafka version <= 0.10, the message size is -// ~ 4(crc32) + 8(timestamp) + 4(key len) + 4(value len) + 4(message len) + 1(attrs) + 1(magic). -// -// For kafka version >= 0.11, the message size with varint encoding is -// ~ 5 * (crc32, key len, value len, message len, attrs) + timestamp + 1 byte (magic). -// + header key + header value + header key len + header value len. -func msgPayloadSize(msg *sarama.ProducerMessage, kafkaVersion sarama.KafkaVersion) int { - maximumRecordOverhead := 5*binary.MaxVarintLen32 + binary.MaxVarintLen64 + 1 - producerMessageOverhead := 26 - version := 1 - if kafkaVersion.IsAtLeast(sarama.V0_11_0_0) { - version = 2 - } - size := producerMessageOverhead - if version >= 2 { - size = maximumRecordOverhead - for _, h := range msg.Headers { - size += len(h.Key) + len(h.Value) + 2*binary.MaxVarintLen32 - } - } - if msg.Key != nil { - size += msg.Key.Length() - } - if msg.Value != nil { - size += msg.Value.Length() - } - return size -} - -func startProducerSpan(cfg config, version sarama.KafkaVersion, msg *sarama.ProducerMessage) trace.Span { - // If there's a span context in the message, use that as the parent context. - carrier := NewProducerMessageCarrier(msg) - ctx := cfg.Propagators.Extract(context.Background(), carrier) - - // Create a span. - attrs := []attribute.KeyValue{ - semconv.MessagingSystem("kafka"), - semconv.MessagingDestinationKindTopic, - semconv.MessagingDestinationName(msg.Topic), - semconv.MessagingMessagePayloadSizeBytes(msgPayloadSize(msg, version)), - semconv.MessagingOperationPublish, - } - opts := []trace.SpanStartOption{ - trace.WithAttributes(attrs...), - trace.WithSpanKind(trace.SpanKindProducer), - } - ctx, span := cfg.Tracer.Start(ctx, fmt.Sprintf("%s publish", msg.Topic), opts...) - - if version.IsAtLeast(sarama.V0_11_0_0) { - // Inject current span context, so consumers can use it to propagate span. - cfg.Propagators.Inject(ctx, carrier) - } - - return span -} - -func finishProducerSpan(span trace.Span, partition int32, offset int64, err error) { - span.SetAttributes( - semconv.MessagingMessageID(strconv.FormatInt(offset, 10)), - semconv.MessagingKafkaDestinationPartition(int(partition)), - ) - if err != nil { - span.SetStatus(codes.Error, err.Error()) - } - span.End() -} diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/producer_test.go b/instrumentation/github.com/Shopify/sarama/otelsarama/producer_test.go deleted file mode 100644 index e563eb0137f..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/producer_test.go +++ /dev/null @@ -1,225 +0,0 @@ -// Copyright The OpenTelemetry 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 otelsarama - -import ( - "testing" - "time" - - "github.com/Shopify/sarama" - "github.com/Shopify/sarama/mocks" - "github.com/stretchr/testify/assert" - - oteltrace "go.opentelemetry.io/otel/trace" -) - -func TestAsyncProducer_ConcurrencyEdgeCases(t *testing.T) { - cfg := newSaramaConfig() - testCases := []struct { - name string - newAsyncProducer func(t *testing.T) sarama.AsyncProducer - }{ - { - name: "original", - newAsyncProducer: func(t *testing.T) sarama.AsyncProducer { - return mocks.NewAsyncProducer(t, cfg) - }, - }, - { - name: "wrapped", - newAsyncProducer: func(t *testing.T) sarama.AsyncProducer { - var ap sarama.AsyncProducer = mocks.NewAsyncProducer(t, cfg) - ap = WrapAsyncProducer(cfg, ap) - return ap - }, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - t.Run("closes Successes and Error after Close", func(t *testing.T) { - timeout := time.NewTimer(time.Minute) - defer timeout.Stop() - p := tc.newAsyncProducer(t) - - p.Close() - - select { - case <-timeout.C: - t.Error("timeout - Successes channel was not closed") - case _, ok := <-p.Successes(): - if ok { - t.Error("message was send to Successes channel instead of being closed") - } - } - - select { - case <-timeout.C: - t.Error("timeout - Errors channel was not closed") - case _, ok := <-p.Errors(): - if ok { - t.Error("message was send to Errors channel instead of being closed") - } - } - }) - - t.Run("closes Successes and Error after AsyncClose", func(t *testing.T) { - timeout := time.NewTimer(time.Minute) - defer timeout.Stop() - p := tc.newAsyncProducer(t) - - p.AsyncClose() - - select { - case <-timeout.C: - t.Error("timeout - Successes channel was not closed") - case _, ok := <-p.Successes(): - if ok { - t.Error("message was send to Successes channel instead of being closed") - } - } - - select { - case <-timeout.C: - t.Error("timeout - Errors channel was not closed") - case _, ok := <-p.Errors(): - if ok { - t.Error("message was send to Errors channel instead of being closed") - } - } - }) - - t.Run("panic when sending to Input after Close", func(t *testing.T) { - p := tc.newAsyncProducer(t) - p.Close() - assert.Panics(t, func() { - p.Input() <- &sarama.ProducerMessage{Key: sarama.StringEncoder("foo")} - }) - }) - - t.Run("panic when sending to Input after AsyncClose", func(t *testing.T) { - p := tc.newAsyncProducer(t) - p.AsyncClose() - assert.Panics(t, func() { - p.Input() <- &sarama.ProducerMessage{Key: sarama.StringEncoder("foo")} - }) - }) - - t.Run("panic when calling Close after AsyncClose", func(t *testing.T) { - p := tc.newAsyncProducer(t) - p.AsyncClose() - assert.Panics(t, func() { - p.Close() - }) - }) - - t.Run("panic when calling AsyncClose after Close", func(t *testing.T) { - p := tc.newAsyncProducer(t) - p.Close() - assert.Panics(t, func() { - p.AsyncClose() - }) - }) - }) - } -} - -func newSaramaConfig() *sarama.Config { - cfg := sarama.NewConfig() - cfg.Version = sarama.V0_11_0_0 - return cfg -} - -func BenchmarkWrapSyncProducer(b *testing.B) { - // Mock provider - provider := oteltrace.NewNoopTracerProvider() - - cfg := newSaramaConfig() - // Mock sync producer - mockSyncProducer := mocks.NewSyncProducer(b, cfg) - - // Wrap sync producer - syncProducer := WrapSyncProducer(cfg, mockSyncProducer, WithTracerProvider(provider)) - message := sarama.ProducerMessage{Key: sarama.StringEncoder("foo")} - - b.ReportAllocs() - b.ResetTimer() - - for i := 0; i < b.N; i++ { - mockSyncProducer.ExpectSendMessageAndSucceed() - _, _, err := syncProducer.SendMessage(&message) - assert.NoError(b, err) - } -} - -func BenchmarkMockSyncProducer(b *testing.B) { - cfg := newSaramaConfig() - // Mock sync producer - mockSyncProducer := mocks.NewSyncProducer(b, cfg) - - // Wrap sync producer - syncProducer := mockSyncProducer - message := sarama.ProducerMessage{Key: sarama.StringEncoder("foo")} - - b.ReportAllocs() - b.ResetTimer() - - for i := 0; i < b.N; i++ { - mockSyncProducer.ExpectSendMessageAndSucceed() - _, _, err := syncProducer.SendMessage(&message) - assert.NoError(b, err) - } -} - -func BenchmarkWrapAsyncProducer(b *testing.B) { - // Mock provider - provider := oteltrace.NewNoopTracerProvider() - - cfg := newSaramaConfig() - cfg.Producer.Return.Successes = true - mockAsyncProducer := mocks.NewAsyncProducer(b, cfg) - - // Wrap sync producer - asyncProducer := WrapAsyncProducer(cfg, mockAsyncProducer, WithTracerProvider(provider)) - message := sarama.ProducerMessage{Key: sarama.StringEncoder("foo")} - - b.ReportAllocs() - b.ResetTimer() - - for i := 0; i < b.N; i++ { - mockAsyncProducer.ExpectInputAndSucceed() - asyncProducer.Input() <- &message - <-asyncProducer.Successes() - } -} - -func BenchmarkMockAsyncProducer(b *testing.B) { - cfg := newSaramaConfig() - cfg.Producer.Return.Successes = true - mockAsyncProducer := mocks.NewAsyncProducer(b, cfg) - - // Wrap sync producer - asyncProducer := mockAsyncProducer - message := sarama.ProducerMessage{Key: sarama.StringEncoder("foo")} - - b.ReportAllocs() - b.ResetTimer() - - for i := 0; i < b.N; i++ { - mockAsyncProducer.ExpectInputAndSucceed() - mockAsyncProducer.Input() <- &message - <-asyncProducer.Successes() - } -} diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/test/consumer_test.go b/instrumentation/github.com/Shopify/sarama/otelsarama/test/consumer_test.go deleted file mode 100644 index 056a1bebb5a..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/test/consumer_test.go +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright The OpenTelemetry 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 test - -import ( - "context" - "fmt" - "testing" - - "github.com/Shopify/sarama" - "github.com/Shopify/sarama/mocks" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama" //nolint:staticcheck // This is deprecated and will be removed in the next release. - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/propagation" - sdktrace "go.opentelemetry.io/otel/sdk/trace" - "go.opentelemetry.io/otel/sdk/trace/tracetest" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" - "go.opentelemetry.io/otel/trace" -) - -const ( - topic = "test-topic" -) - -func TestWrapPartitionConsumer(t *testing.T) { - propagators := propagation.TraceContext{} - // Mock provider - sr := tracetest.NewSpanRecorder() - provider := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sr)) - - // Mock partition consumer controller - consumer := mocks.NewConsumer(t, sarama.NewConfig()) - mockPartitionConsumer := consumer.ExpectConsumePartition(topic, 0, 0) - - // Create partition consumer - partitionConsumer, err := consumer.ConsumePartition(topic, 0, 0) - require.NoError(t, err) - - partitionConsumer = otelsarama.WrapPartitionConsumer(partitionConsumer, otelsarama.WithTracerProvider(provider), otelsarama.WithPropagators(propagators)) - - consumeAndCheck(t, provider.Tracer("test"), sr.Ended, mockPartitionConsumer, partitionConsumer) -} - -func TestWrapConsumer(t *testing.T) { - propagators := propagation.TraceContext{} - // Mock provider - sr := tracetest.NewSpanRecorder() - provider := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sr)) - - // Mock partition consumer controller - mockConsumer := mocks.NewConsumer(t, sarama.NewConfig()) - mockPartitionConsumer := mockConsumer.ExpectConsumePartition(topic, 0, 0) - - // Wrap consumer - consumer := otelsarama.WrapConsumer(mockConsumer, otelsarama.WithTracerProvider(provider), otelsarama.WithPropagators(propagators)) - - // Create partition consumer - partitionConsumer, err := consumer.ConsumePartition(topic, 0, 0) - require.NoError(t, err) - - consumeAndCheck(t, provider.Tracer("test"), sr.Ended, mockPartitionConsumer, partitionConsumer) -} - -func consumeAndCheck(t *testing.T, mt trace.Tracer, complFn func() []sdktrace.ReadOnlySpan, mockPartitionConsumer *mocks.PartitionConsumer, partitionConsumer sarama.PartitionConsumer) { - // Create message with span context - ctx, _ := mt.Start(context.Background(), "") - message := sarama.ConsumerMessage{Key: []byte("foo")} - propagators := propagation.TraceContext{} - propagators.Inject(ctx, otelsarama.NewConsumerMessageCarrier(&message)) - - // Produce message - mockPartitionConsumer.YieldMessage(&message) - mockPartitionConsumer.YieldMessage(&sarama.ConsumerMessage{Key: []byte("foo2")}) - - // Consume messages - msgList := make([]*sarama.ConsumerMessage, 2) - msgList[0] = <-partitionConsumer.Messages() - msgList[1] = <-partitionConsumer.Messages() - require.NoError(t, partitionConsumer.Close()) - // Wait for the channel to be closed - <-partitionConsumer.Messages() - - // Check spans length - spans := complFn() - assert.Len(t, spans, 2) - - expectedList := []struct { - attributeList []attribute.KeyValue - parentSpanID trace.SpanID - kind trace.SpanKind - msgKey []byte - }{ - { - attributeList: []attribute.KeyValue{ - semconv.MessagingSystem("kafka"), - semconv.MessagingDestinationKindTopic, - semconv.MessagingDestinationName("test-topic"), - semconv.MessagingOperationReceive, - semconv.MessagingMessageID("0"), - semconv.MessagingKafkaSourcePartition(0), - }, - parentSpanID: trace.SpanContextFromContext(ctx).SpanID(), - kind: trace.SpanKindConsumer, - msgKey: []byte("foo"), - }, - { - attributeList: []attribute.KeyValue{ - semconv.MessagingSystem("kafka"), - semconv.MessagingDestinationKindTopic, - semconv.MessagingDestinationName("test-topic"), - semconv.MessagingOperationReceive, - semconv.MessagingMessageID("1"), - semconv.MessagingKafkaSourcePartition(0), - }, - kind: trace.SpanKindConsumer, - msgKey: []byte("foo2"), - }, - } - - for i, expected := range expectedList { - t.Run(fmt.Sprint("index", i), func(t *testing.T) { - span := spans[i] - - assert.Equal(t, expected.parentSpanID, span.Parent().SpanID()) - - sc := trace.SpanContextFromContext(propagators.Extract(context.Background(), otelsarama.NewConsumerMessageCarrier(msgList[i]))) - // propagators.Extract always returns a remote SpanContext. - assert.Equal(t, sc, span.SpanContext().WithRemote(true)) - - assert.Equal(t, fmt.Sprintf("%s receive", topic), span.Name()) - assert.Equal(t, expected.kind, span.SpanKind()) - assert.Equal(t, expected.msgKey, msgList[i].Key) - for _, k := range expected.attributeList { - assert.Contains(t, span.Attributes(), k) - } - }) - } -} diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/test/doc.go b/instrumentation/github.com/Shopify/sarama/otelsarama/test/doc.go deleted file mode 100644 index e295537e761..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/test/doc.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright The OpenTelemetry 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 test validates the otelsarama instrumentation with the default SDK. - -This package is in a separate module from the instrumentation it tests to -isolate the dependency of the default SDK and not impose this as a transitive -dependency for users. -*/ -package test // import "go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama/test" diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/test/go.mod b/instrumentation/github.com/Shopify/sarama/otelsarama/test/go.mod deleted file mode 100644 index 5984c0f0782..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/test/go.mod +++ /dev/null @@ -1,41 +0,0 @@ -module go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama/test - -go 1.19 - -require ( - github.com/Shopify/sarama v1.38.1 - github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama v0.43.0 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 -) - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/eapache/go-resiliency v1.3.0 // indirect - github.com/eapache/go-xerial-snappy v0.0.0-20230111030713-bf00bc1b83b6 // indirect - github.com/eapache/queue v1.1.0 // indirect - github.com/go-logr/logr v1.2.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/snappy v0.0.4 // indirect - github.com/hashicorp/errwrap v1.0.0 // indirect - github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-uuid v1.0.3 // indirect - github.com/jcmturner/aescts/v2 v2.0.0 // indirect - github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect - github.com/jcmturner/gofork v1.7.6 // indirect - github.com/jcmturner/gokrb5/v8 v8.4.3 // indirect - github.com/jcmturner/rpc/v2 v2.0.3 // indirect - github.com/klauspost/compress v1.15.14 // indirect - github.com/pierrec/lz4/v4 v4.1.17 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect - golang.org/x/crypto v0.13.0 // indirect - golang.org/x/net v0.15.0 // indirect - golang.org/x/sys v0.12.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) - -replace go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama => ../ diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/test/go.sum b/instrumentation/github.com/Shopify/sarama/otelsarama/test/go.sum deleted file mode 100644 index f0688efc7ae..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/test/go.sum +++ /dev/null @@ -1,97 +0,0 @@ -github.com/Shopify/sarama v1.38.1 h1:lqqPUPQZ7zPqYlWpTh+LQ9bhYNu2xJL6k1SJN4WVe2A= -github.com/Shopify/sarama v1.38.1/go.mod h1:iwv9a67Ha8VNa+TifujYoWGxWnu2kNVAQdSdZ4X2o5g= -github.com/Shopify/toxiproxy/v2 v2.5.0 h1:i4LPT+qrSlKNtQf5QliVjdP08GyAH8+BUIc9gT0eahc= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/eapache/go-resiliency v1.3.0 h1:RRL0nge+cWGlxXbUzJ7yMcq6w2XBEr19dCN6HECGaT0= -github.com/eapache/go-resiliency v1.3.0/go.mod h1:5yPzW0MIvSe0JDsv0v+DvcjEv2FyD6iZYSs1ZI+iQho= -github.com/eapache/go-xerial-snappy v0.0.0-20230111030713-bf00bc1b83b6 h1:8yY/I9ndfrgrXUbOGObLHKBR4Fl3nZXwM2c7OYTT8hM= -github.com/eapache/go-xerial-snappy v0.0.0-20230111030713-bf00bc1b83b6/go.mod h1:YvSRo5mw33fLEx1+DlK6L2VV43tJt5Eyel9n9XBcR+0= -github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc= -github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= -github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= -github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= -github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= -github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/jcmturner/aescts/v2 v2.0.0 h1:9YKLH6ey7H4eDBXW8khjYslgyqG2xZikXP0EQFKrle8= -github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= -github.com/jcmturner/dnsutils/v2 v2.0.0 h1:lltnkeZGL0wILNvrNiVCR6Ro5PGU/SeBvVO/8c/iPbo= -github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM= -github.com/jcmturner/gofork v1.7.6 h1:QH0l3hzAU1tfT3rZCnW5zXl+orbkNMMRGJfdJjHVETg= -github.com/jcmturner/gofork v1.7.6/go.mod h1:1622LH6i/EZqLloHfE7IeZ0uEJwMSUyQ/nDd82IeqRo= -github.com/jcmturner/goidentity/v6 v6.0.1 h1:VKnZd2oEIMorCTsFBnJWbExfNN7yZr3EhJAxwOkZg6o= -github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg= -github.com/jcmturner/gokrb5/v8 v8.4.3 h1:iTonLeSJOn7MVUtyMT+arAn5AKAPrkilzhGw8wE/Tq8= -github.com/jcmturner/gokrb5/v8 v8.4.3/go.mod h1:dqRwJGXznQrzw6cWmyo6kH+E7jksEQG/CyVWsJEsJO0= -github.com/jcmturner/rpc/v2 v2.0.3 h1:7FXXj8Ti1IaVFpSAziCZWNzbNuZmnvw/i6CqLNdWfZY= -github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= -github.com/klauspost/compress v1.15.14 h1:i7WCKDToww0wA+9qrUZ1xOjp218vfFo3nTU6UHp+gOc= -github.com/klauspost/compress v1.15.14/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/pierrec/lz4/v4 v4.1.17 h1:kV4Ip+/hUBC+8T6+2EgburRtkE9ef4nbY3f4dFhGjMc= -github.com/pierrec/lz4/v4 v4.1.17/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= -github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -go.opentelemetry.io/otel v1.17.0 h1:MW+phZ6WZ5/uk2nd93ANk/6yJ+dVrvNWUjGhnnFU5jM= -go.opentelemetry.io/otel v1.17.0/go.mod h1:I2vmBGtFaODIVMBSTPVDlJSzBDNf93k60E6Ft0nyjo0= -go.opentelemetry.io/otel/metric v1.17.0 h1:iG6LGVz5Gh+IuO0jmgvpTB6YVrCGngi8QGm+pMd8Pdc= -go.opentelemetry.io/otel/metric v1.17.0/go.mod h1:h4skoxdZI17AxwITdmdZjjYJQH5nzijUUjm+wtPph5o= -go.opentelemetry.io/otel/sdk v1.17.0 h1:FLN2X66Ke/k5Sg3V623Q7h7nt3cHXaW1FOvKKrW0IpE= -go.opentelemetry.io/otel/sdk v1.17.0/go.mod h1:U87sE0f5vQB7hwUoW98pW5Rz4ZDuCFBZFNUBlSgmDFQ= -go.opentelemetry.io/otel/trace v1.17.0 h1:/SWhSRHmDPOImIAetP1QAeMnZYiQXrTy4fMMYOdSKWQ= -go.opentelemetry.io/otel/trace v1.17.0/go.mod h1:I/4vKTgFclIsXRVucpH25X0mpFSczM7aHeaz0ZBLWjY= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220725212005-46097bf591d3/go.mod h1:AaygXjzTFtRAg2ttMY5RMuhpJ3cNnI0XpyFJD1iQRSM= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/test/producer_test.go b/instrumentation/github.com/Shopify/sarama/otelsarama/test/producer_test.go deleted file mode 100644 index d4a97137e4a..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/test/producer_test.go +++ /dev/null @@ -1,388 +0,0 @@ -// Copyright The OpenTelemetry 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 test - -import ( - "context" - "errors" - "fmt" - "sync" - "testing" - - "github.com/Shopify/sarama" - "github.com/Shopify/sarama/mocks" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama" //nolint:staticcheck // This is deprecated and will be removed in the next release. - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/propagation" - "go.opentelemetry.io/otel/sdk/trace" - "go.opentelemetry.io/otel/sdk/trace/tracetest" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" - oteltrace "go.opentelemetry.io/otel/trace" -) - -func TestWrapSyncProducer(t *testing.T) { - propagators := propagation.TraceContext{} - var err error - - // Mock provider - sr := tracetest.NewSpanRecorder() - provider := trace.NewTracerProvider(trace.WithSpanProcessor(sr)) - - cfg := newSaramaConfig() - // Mock sync producer - mockSyncProducer := mocks.NewSyncProducer(t, cfg) - - // Wrap sync producer - syncProducer := otelsarama.WrapSyncProducer(cfg, mockSyncProducer, otelsarama.WithTracerProvider(provider), otelsarama.WithPropagators(propagators)) - - // Create message with span context - ctx, _ := provider.Tracer("test").Start(context.Background(), "") - messageWithSpanContext := sarama.ProducerMessage{Topic: topic, Key: sarama.StringEncoder("foo")} - propagators.Inject(ctx, otelsarama.NewProducerMessageCarrier(&messageWithSpanContext)) - - // Expected - expectedList := []struct { - attributeList []attribute.KeyValue - parentSpanID oteltrace.SpanID - kind oteltrace.SpanKind - }{ - { - attributeList: []attribute.KeyValue{ - semconv.MessagingSystem("kafka"), - semconv.MessagingDestinationKindTopic, - semconv.MessagingDestinationName(topic), - semconv.MessagingMessageID("1"), - semconv.MessagingKafkaDestinationPartition(0), - }, - parentSpanID: oteltrace.SpanContextFromContext(ctx).SpanID(), - kind: oteltrace.SpanKindProducer, - }, - { - attributeList: []attribute.KeyValue{ - semconv.MessagingSystem("kafka"), - semconv.MessagingDestinationKindTopic, - semconv.MessagingDestinationName(topic), - semconv.MessagingMessageID("2"), - semconv.MessagingKafkaDestinationPartition(0), - }, - kind: oteltrace.SpanKindProducer, - }, - { - attributeList: []attribute.KeyValue{ - semconv.MessagingSystem("kafka"), - semconv.MessagingDestinationKindTopic, - semconv.MessagingDestinationName(topic), - // TODO: The mock sync producer of sarama does not handle the offset while sending messages - // https://github.com/Shopify/sarama/pull/1747 - //semconv.MessagingMessageID("3"), - semconv.MessagingKafkaDestinationPartition(12), - }, - kind: oteltrace.SpanKindProducer, - }, - { - attributeList: []attribute.KeyValue{ - semconv.MessagingSystem("kafka"), - semconv.MessagingDestinationKindTopic, - semconv.MessagingDestinationName(topic), - //semconv.MessagingMessageID("4"), - semconv.MessagingKafkaDestinationPartition(25), - }, - kind: oteltrace.SpanKindProducer, - }, - } - for i := 0; i < len(expectedList); i++ { - mockSyncProducer.ExpectSendMessageAndSucceed() - } - - // Send message - msgList := []*sarama.ProducerMessage{ - &messageWithSpanContext, - {Topic: topic, Key: sarama.StringEncoder("foo2")}, - {Topic: topic, Key: sarama.StringEncoder("foo3")}, - {Topic: topic, Key: sarama.StringEncoder("foo4")}, - } - _, _, err = syncProducer.SendMessage(msgList[0]) - require.NoError(t, err) - _, _, err = syncProducer.SendMessage(msgList[1]) - require.NoError(t, err) - // Send messages - require.NoError(t, syncProducer.SendMessages(msgList[2:])) - - spanList := sr.Ended() - for i, expected := range expectedList { - span := spanList[i] - msg := msgList[i] - - // Check span - assert.True(t, span.SpanContext().IsValid()) - assert.Equal(t, expected.parentSpanID, span.Parent().SpanID()) - assert.Equal(t, fmt.Sprintf("%s publish", topic), span.Name()) - assert.Equal(t, expected.kind, span.SpanKind()) - for _, k := range expected.attributeList { - assert.Contains(t, span.Attributes(), k) - } - - // Check tracing propagation - remoteSpanFromMessage := oteltrace.SpanContextFromContext(propagators.Extract(context.Background(), otelsarama.NewProducerMessageCarrier(msg))) - assert.True(t, remoteSpanFromMessage.IsValid()) - } -} - -func TestWrapAsyncProducer(t *testing.T) { - propagators := propagation.TraceContext{} - // Create message with span context - createMessages := func(mt oteltrace.Tracer) []*sarama.ProducerMessage { - ctx, _ := mt.Start(context.Background(), "") - messageWithSpanContext := sarama.ProducerMessage{Topic: topic, Key: sarama.StringEncoder("foo")} - propagators.Inject(ctx, otelsarama.NewProducerMessageCarrier(&messageWithSpanContext)) - - return []*sarama.ProducerMessage{ - &messageWithSpanContext, - {Topic: topic, Key: sarama.StringEncoder("foo2")}, - } - } - - t.Run("without successes config", func(t *testing.T) { - // Mock provider - sr := tracetest.NewSpanRecorder() - provider := trace.NewTracerProvider(trace.WithSpanProcessor(sr)) - - cfg := newSaramaConfig() - mockAsyncProducer := mocks.NewAsyncProducer(t, cfg) - ap := otelsarama.WrapAsyncProducer(cfg, mockAsyncProducer, otelsarama.WithTracerProvider(provider), otelsarama.WithPropagators(propagators)) - - msgList := createMessages(provider.Tracer("test")) - // Send message - for _, msg := range msgList { - mockAsyncProducer.ExpectInputAndSucceed() - ap.Input() <- msg - } - - err := ap.Close() - require.NoError(t, err) - - spanList := sr.Ended() - - // Expected - expectedList := []struct { - attributeList []attribute.KeyValue - kind oteltrace.SpanKind - }{ - { - attributeList: []attribute.KeyValue{ - semconv.MessagingSystem("kafka"), - semconv.MessagingDestinationKindTopic, - semconv.MessagingDestinationName(topic), - }, - kind: oteltrace.SpanKindProducer, - }, - { - attributeList: []attribute.KeyValue{ - semconv.MessagingSystem("kafka"), - semconv.MessagingDestinationKindTopic, - semconv.MessagingDestinationName(topic), - }, - kind: oteltrace.SpanKindProducer, - }, - } - for i, expected := range expectedList { - span := spanList[i] - msg := msgList[i] - - // Check span - assert.True(t, span.SpanContext().IsValid()) - assert.Equal(t, fmt.Sprintf("%s publish", topic), span.Name()) - assert.Equal(t, expected.kind, span.SpanKind()) - for _, k := range expected.attributeList { - assert.Contains(t, span.Attributes(), k) - } - - // Check tracing propagation - remoteSpanFromMessage := oteltrace.SpanContextFromContext(propagators.Extract(context.Background(), otelsarama.NewProducerMessageCarrier(msg))) - assert.True(t, remoteSpanFromMessage.IsValid()) - } - }) - - t.Run("with successes config", func(t *testing.T) { - // Mock provider - sr := tracetest.NewSpanRecorder() - provider := trace.NewTracerProvider(trace.WithSpanProcessor(sr)) - - // Set producer with successes config - cfg := newSaramaConfig() - cfg.Producer.Return.Successes = true - - mockAsyncProducer := mocks.NewAsyncProducer(t, cfg) - ap := otelsarama.WrapAsyncProducer(cfg, mockAsyncProducer, otelsarama.WithTracerProvider(provider), otelsarama.WithPropagators(propagators)) - - msgList := createMessages(provider.Tracer("test")) - // Send message - for i, msg := range msgList { - mockAsyncProducer.ExpectInputAndSucceed() - // Add metadata to msg - msg.Metadata = i - ap.Input() <- msg - newMsg := <-ap.Successes() - assert.Equal(t, newMsg, msg) - } - - err := ap.Close() - require.NoError(t, err) - - spanList := sr.Ended() - - // Expected - expectedList := []struct { - attributeList []attribute.KeyValue - kind oteltrace.SpanKind - }{ - { - attributeList: []attribute.KeyValue{ - semconv.MessagingSystem("kafka"), - semconv.MessagingDestinationKindTopic, - semconv.MessagingDestinationName(topic), - semconv.MessagingMessageID("1"), - semconv.MessagingKafkaDestinationPartition(9), - }, - kind: oteltrace.SpanKindProducer, - }, - { - attributeList: []attribute.KeyValue{ - semconv.MessagingSystem("kafka"), - semconv.MessagingDestinationKindTopic, - semconv.MessagingDestinationName(topic), - semconv.MessagingMessageID("2"), - semconv.MessagingKafkaDestinationPartition(31), - }, - kind: oteltrace.SpanKindProducer, - }, - } - for i, expected := range expectedList { - span := spanList[i] - msg := msgList[i] - - // Check span - assert.True(t, span.SpanContext().IsValid()) - assert.Equal(t, fmt.Sprintf("%s publish", topic), span.Name()) - assert.Equal(t, expected.kind, span.SpanKind()) - for _, k := range expected.attributeList { - assert.Contains(t, span.Attributes(), k) - } - - // Check metadata - assert.Equal(t, i, msg.Metadata) - - // Check tracing propagation - remoteSpanFromMessage := oteltrace.SpanContextFromContext(propagators.Extract(context.Background(), otelsarama.NewProducerMessageCarrier(msg))) - assert.True(t, remoteSpanFromMessage.IsValid()) - } - }) -} - -func TestWrapAsyncProducerError(t *testing.T) { - propagators := propagation.TraceContext{} - // Mock provider - sr := tracetest.NewSpanRecorder() - provider := trace.NewTracerProvider(trace.WithSpanProcessor(sr)) - - // Set producer with successes config - cfg := newSaramaConfig() - cfg.Producer.Return.Successes = true - - mockAsyncProducer := mocks.NewAsyncProducer(t, cfg) - ap := otelsarama.WrapAsyncProducer(cfg, mockAsyncProducer, otelsarama.WithTracerProvider(provider), otelsarama.WithPropagators(propagators)) - - mockAsyncProducer.ExpectInputAndFail(errors.New("test")) - metadata := "test metadata" - ap.Input() <- &sarama.ProducerMessage{Topic: topic, Key: sarama.StringEncoder("foo2"), Metadata: metadata} - - err := <-ap.Errors() - require.Error(t, err) - assert.Equal(t, metadata, err.Msg.Metadata, "should preseve metadata") - - ap.AsyncClose() - - spanList := sr.Ended() - assert.Len(t, spanList, 1) - - span := spanList[0] - - assert.Equal(t, codes.Error, span.Status().Code) - assert.Equal(t, "test", span.Status().Description) -} - -func TestWrapAsyncProducer_DrainsSuccessesAndErrorsChannels(t *testing.T) { - // Mock provider - sr := tracetest.NewSpanRecorder() - provider := trace.NewTracerProvider(trace.WithSpanProcessor(sr)) - - // Set producer with successes config and fill it with successes and errors - cfg := newSaramaConfig() - cfg.Producer.Return.Successes = true - - mockAsyncProducer := mocks.NewAsyncProducer(t, cfg) - ap := otelsarama.WrapAsyncProducer(cfg, mockAsyncProducer, otelsarama.WithTracerProvider(provider)) - - wantSuccesses := 5 - for i := 0; i < wantSuccesses; i++ { - mockAsyncProducer.ExpectInputAndSucceed() - ap.Input() <- &sarama.ProducerMessage{Topic: topic, Key: sarama.StringEncoder("foo2")} - } - - wantErrros := 3 - for i := 0; i < wantErrros; i++ { - mockAsyncProducer.ExpectInputAndFail(errors.New("test")) - ap.Input() <- &sarama.ProducerMessage{Topic: topic, Key: sarama.StringEncoder("foo2")} - } - - ap.AsyncClose() - - // Ensure it is possible to read Successes and Errors after AsyncClose - var wg sync.WaitGroup - - gotSuccesses := 0 - wg.Add(1) - go func() { - defer wg.Done() - for range ap.Successes() { - gotSuccesses++ - } - }() - - gotErrors := 0 - wg.Add(1) - go func() { - defer wg.Done() - for range ap.Errors() { - gotErrors++ - } - }() - - wg.Wait() - spanList := sr.Ended() - assert.Equal(t, wantSuccesses, gotSuccesses, "should read all successes") - assert.Equal(t, wantErrros, gotErrors, "should read all errors") - assert.Len(t, spanList, wantSuccesses+wantErrros, "should record all spans") -} - -func newSaramaConfig() *sarama.Config { - cfg := sarama.NewConfig() - cfg.Version = sarama.V0_11_0_0 - return cfg -} diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/test/version.go b/instrumentation/github.com/Shopify/sarama/otelsarama/test/version.go deleted file mode 100644 index 352dd48cb90..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/test/version.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright The OpenTelemetry 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 test // import "go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama/test" - -// Version is the current release version of the sarama instrumentation test module. -func Version() string { - return "0.43.0" - // This string is updated by the pre_release.sh script during release -} - -// SemVersion is the semantic version to be supplied to tracer/meter creation. -// -// Deprecated: Use [Version] instead. -func SemVersion() string { - return Version() -} diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/version.go b/instrumentation/github.com/Shopify/sarama/otelsarama/version.go deleted file mode 100644 index d2a7ef4b31a..00000000000 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/version.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright The OpenTelemetry 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 otelsarama // import "go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama" - -// Version is the current release version of the sarama instrumentation. -func Version() string { - return "0.43.0" - // This string is updated by the pre_release.sh script during release -} - -// SemVersion is the semantic version to be supplied to tracer/meter creation. -// -// Deprecated: Use [Version] instead. -func SemVersion() string { - return Version() -} diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/beego.go b/instrumentation/github.com/astaxie/beego/otelbeego/beego.go deleted file mode 100644 index 8a25d6c1e03..00000000000 --- a/instrumentation/github.com/astaxie/beego/otelbeego/beego.go +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright The OpenTelemetry 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 otelbeego // import "go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego" - -import ( - "context" - "net/http" - - "go.opentelemetry.io/otel/codes" - - "go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego/internal" - "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" - "go.opentelemetry.io/otel/trace" - - "github.com/astaxie/beego" -) - -// Handler implements the http.Handler interface and provides -// trace and metrics to beego web apps. -type Handler struct { - http.Handler -} - -// ServerHTTP calls the configured handler to serve HTTP for req to rr. -func (o *Handler) ServeHTTP(rr http.ResponseWriter, req *http.Request) { - ctx := beego.BeeApp.Handlers.GetContext() - defer beego.BeeApp.Handlers.GiveBackContext(ctx) - ctx.Reset(rr, req) - // use the beego context to try to find a route template - if router, found := beego.BeeApp.Handlers.FindRouter(ctx); found { - // if found, save it to the context - reqCtx := context.WithValue(req.Context(), internal.CtxRouteTemplateKey, router.GetPattern()) - req = req.WithContext(reqCtx) - } - o.Handler.ServeHTTP(rr, req) -} - -// defaultSpanNameFormatter is the default formatter for spans created with the beego -// integration. Returns the route path template, or the URL path if the current path -// is not associated with a router. -func defaultSpanNameFormatter(_ string, req *http.Request) string { - if val := req.Context().Value(internal.CtxRouteTemplateKey); val != nil { - str, ok := val.(string) - if ok { - return str - } - } - return req.Method -} - -// NewOTelBeegoMiddleWare creates a MiddleWare that provides OpenTelemetry -// tracing and metrics to a Beego web app. -// Parameter service should describe the name of the (virtual) server handling the request. -// The OTelBeegoMiddleWare can be configured using the provided Options. -func NewOTelBeegoMiddleWare(service string, options ...Option) beego.MiddleWare { - cfg := newConfig(options...) - - httpOptions := []otelhttp.Option{ - otelhttp.WithTracerProvider(cfg.tracerProvider), - otelhttp.WithMeterProvider(cfg.meterProvider), - otelhttp.WithPropagators(cfg.propagators), - otelhttp.WithServerName(service), - } - - for _, f := range cfg.filters { - httpOptions = append( - httpOptions, - otelhttp.WithFilter(otelhttp.Filter(f)), - ) - } - - if cfg.formatter != nil { - httpOptions = append(httpOptions, otelhttp.WithSpanNameFormatter(cfg.formatter)) - } - - return func(handler http.Handler) http.Handler { - return &Handler{ - otelhttp.NewHandler( - handler, - "", - httpOptions..., - ), - } - } -} - -// Render traces beego.Controller.Render. Use this function -// if you want to add a child span for the rendering of a template file. -// Disable autorender before use, and call this function explicitly. -func Render(c *beego.Controller) error { - _, span := span(c, internal.RenderTemplateSpanName) - defer span.End() - err := c.Render() - if err != nil { - span.RecordError(err) - span.SetStatus(codes.Error, "template failure") - } - return err -} - -// RenderString traces beego.Controller.RenderString. Use this function -// if you want to add a child span for the rendering of a template file to -// its string representation. -// Disable autorender before use, and call this function explicitly. -func RenderString(c *beego.Controller) (string, error) { - _, span := span(c, internal.RenderStringSpanName) - defer span.End() - str, err := c.RenderString() - if err != nil { - span.RecordError(err) - span.SetStatus(codes.Error, "render string failure") - } - return str, err -} - -// RenderBytes traces beego.Controller.RenderBytes. Use this function if -// you want to add a child span for the rendering of a template file to its -// byte representation. -// Disable autorender before use, and call this function explicitly. -func RenderBytes(c *beego.Controller) ([]byte, error) { - _, span := span(c, internal.RenderBytesSpanName) - defer span.End() - bytes, err := c.RenderBytes() - if err != nil { - span.RecordError(err) - span.SetStatus(codes.Error, "render bytes failure") - } - return bytes, err -} - -func span(c *beego.Controller, spanName string) (context.Context, trace.Span) { - ctx := c.Ctx.Request.Context() - span := trace.SpanFromContext(ctx) - tracer := span.TracerProvider().Tracer("go.opentelemetry.io/contrib/instrumentation/github/astaxie/beego/otelbeego") - return tracer.Start( - ctx, - spanName, - trace.WithAttributes( - Template(c.TplName), - ), - ) -} diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/beego_test.go b/instrumentation/github.com/astaxie/beego/otelbeego/beego_test.go deleted file mode 100644 index 2fc4cf2bb75..00000000000 --- a/instrumentation/github.com/astaxie/beego/otelbeego/beego_test.go +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright The OpenTelemetry 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 otelbeego - -import ( - "context" - "net/http" - "net/http/httptest" - "testing" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/metric/noop" - "go.opentelemetry.io/otel/trace" - - "github.com/astaxie/beego" - beegoCtx "github.com/astaxie/beego/context" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -const middleWareName = "test-router" - -func replaceBeego() { - beego.BeeApp = beego.NewApp() -} - -func ctxTest() (context.Context, func(*testing.T, context.Context)) { - ctx := context.Background() - sc := trace.NewSpanContext(trace.SpanContextConfig{ - TraceID: trace.TraceID{0x01}, - SpanID: trace.SpanID{0x01}, - Remote: true, - }) - ctx = trace.ContextWithSpanContext(ctx, sc) - - return ctx, func(t *testing.T, ctx context.Context) { - got := trace.SpanContextFromContext(ctx) - assert.Equal(t, sc.TraceID(), got.TraceID()) - assert.Equal(t, sc.SpanID(), got.SpanID()) - assert.Equal(t, sc.TraceFlags(), got.TraceFlags()) - assert.Equal(t, sc.TraceState(), got.TraceState()) - assert.Equal(t, sc.IsRemote(), got.IsRemote()) - } -} - -func TestSpanFromContextDefaultProvider(t *testing.T) { - defer replaceBeego() - provider := noop.NewMeterProvider() - otel.SetMeterProvider(provider) - otel.SetTracerProvider(trace.NewNoopTracerProvider()) - - ctx, eval := ctxTest() - router := beego.NewControllerRegister() - router.Get("/hello-with-span", func(ctx *beegoCtx.Context) { - eval(t, ctx.Request.Context()) - ctx.ResponseWriter.WriteHeader(http.StatusAccepted) - }) - - rr := httptest.NewRecorder() - req, err := http.NewRequestWithContext(ctx, http.MethodGet, "http://localhost/hello-with-span", nil) - require.NoError(t, err) - - mw := NewOTelBeegoMiddleWare(middleWareName) - - mw(router).ServeHTTP(rr, req) - - require.Equal(t, http.StatusAccepted, rr.Result().StatusCode) -} - -func TestSpanFromContextCustomProvider(t *testing.T) { - defer replaceBeego() - provider := noop.NewMeterProvider() - ctx, eval := ctxTest() - router := beego.NewControllerRegister() - router.Get("/hello-with-span", func(ctx *beegoCtx.Context) { - eval(t, ctx.Request.Context()) - ctx.ResponseWriter.WriteHeader(http.StatusAccepted) - }) - - rr := httptest.NewRecorder() - req, err := http.NewRequestWithContext(ctx, http.MethodGet, "http://localhost/hello-with-span", nil) - require.NoError(t, err) - - mw := NewOTelBeegoMiddleWare( - middleWareName, - WithTracerProvider(trace.NewNoopTracerProvider()), - WithMeterProvider(provider), - ) - - mw(router).ServeHTTP(rr, req) - - require.Equal(t, http.StatusAccepted, rr.Result().StatusCode) -} diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/common.go b/instrumentation/github.com/astaxie/beego/otelbeego/common.go deleted file mode 100644 index 7bf0ba736e5..00000000000 --- a/instrumentation/github.com/astaxie/beego/otelbeego/common.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright The OpenTelemetry 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 otelbeego // import "go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego" - -import ( - "net/http" - - "go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego/internal" - "go.opentelemetry.io/otel/attribute" -) - -// ------------------------------------------ Attribute Functions - -// Template returns the template name as a KeyValue pair. -func Template(name string) attribute.KeyValue { - return internal.TemplateKey.String(name) -} - -// ------------------------------------------ OTel HTTP Types - -// Filter returns true if the request should be traced. -type Filter func(*http.Request) bool - -// SpanNameFormatter creates a custom span name from the operation and request object. -type SpanNameFormatter func(operation string, req *http.Request) string diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/config.go b/instrumentation/github.com/astaxie/beego/otelbeego/config.go deleted file mode 100644 index 6e6b0fd87f7..00000000000 --- a/instrumentation/github.com/astaxie/beego/otelbeego/config.go +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright The OpenTelemetry 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 otelbeego // import "go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego" - -import ( - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/propagation" - "go.opentelemetry.io/otel/trace" -) - -// config provides configuration for the beego OpenTelemetry -// middleware. Configuration is modified using the provided Options. -type config struct { - tracerProvider trace.TracerProvider - meterProvider metric.MeterProvider - propagators propagation.TextMapPropagator - filters []Filter - formatter SpanNameFormatter -} - -// Option applies a configuration to the given config. -type Option interface { - apply(*config) -} - -// optionFunc is a function type that applies a particular -// configuration to the beego middleware in question. -type optionFunc func(c *config) - -// Apply will apply the option to the config, c. -func (o optionFunc) apply(c *config) { - o(c) -} - -// ------------------------------------------ Options - -// WithTracerProvider specifies a tracer provider to use for creating a tracer. -// If none is specified, the global provider is used. -func WithTracerProvider(provider trace.TracerProvider) Option { - return optionFunc(func(cfg *config) { - if provider != nil { - cfg.tracerProvider = provider - } - }) -} - -// WithMeterProvider specifies a meter provider to use for creating a meter. -// If none is specified, the global provider is used. -func WithMeterProvider(provider metric.MeterProvider) Option { - return optionFunc(func(cfg *config) { - if provider != nil { - cfg.meterProvider = provider - } - }) -} - -// WithPropagators sets the propagators used in the middleware. -// Defaults to global.Propagators(). -func WithPropagators(propagators propagation.TextMapPropagator) Option { - return optionFunc(func(c *config) { - if propagators != nil { - c.propagators = propagators - } - }) -} - -// WithFilter adds the given filter for use in the middleware. -// Defaults to no filters. -func WithFilter(f Filter) Option { - return optionFunc(func(c *config) { - c.filters = append(c.filters, f) - }) -} - -// WithSpanNameFormatter sets the formatter to be used to format -// span names. Defaults to the path template. -func WithSpanNameFormatter(f SpanNameFormatter) Option { - return optionFunc(func(c *config) { - c.formatter = f - }) -} - -// ------------------------------------------ Private Functions - -func newConfig(options ...Option) *config { - config := &config{ - tracerProvider: otel.GetTracerProvider(), - meterProvider: otel.GetMeterProvider(), - propagators: otel.GetTextMapPropagator(), - filters: []Filter{}, - formatter: defaultSpanNameFormatter, - } - for _, option := range options { - option.apply(config) - } - return config -} diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/doc.go b/instrumentation/github.com/astaxie/beego/otelbeego/doc.go deleted file mode 100644 index e180bf002bb..00000000000 --- a/instrumentation/github.com/astaxie/beego/otelbeego/doc.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright The OpenTelemetry 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 otelbeego instruments the github.com/astaxie/beego package. -// -// Deprecated: This module is no longer supported. -// github.com/astaxie/beego is no longer maintained. -// Use github.com/beego/beego/v2 together with its instrumentation -// packages instead. -package otelbeego // import "go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego" diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/example/Dockerfile b/instrumentation/github.com/astaxie/beego/otelbeego/example/Dockerfile deleted file mode 100644 index b9a18bcd5db..00000000000 --- a/instrumentation/github.com/astaxie/beego/otelbeego/example/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright The OpenTelemetry 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. - -FROM golang:1.21-alpine AS base -COPY . /src/ -WORKDIR /src/instrumentation/github.com/astaxie/beego/otelbeego/example - -FROM base AS example-beego-server -RUN go install ./server/server.go -CMD ["/go/bin/server"] - -FROM base AS example-http-client -RUN go install ./client/client.go -CMD ["/go/bin/client"] diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/example/README.md b/instrumentation/github.com/astaxie/beego/otelbeego/example/README.md deleted file mode 100644 index 2c484f163cf..00000000000 --- a/instrumentation/github.com/astaxie/beego/otelbeego/example/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# Beego Server Instrumentation Example - -An HTTP client connects to a Beego server. They both generate span information to `stdout`. -These instructions expect you have [docker-compose](https://docs.docker.com/compose/) installed. - -Bring up the `beego-server` and `http-client` services to run the example: -```sh -docker-compose up -d -``` - -The `http-client` service sends just one HTTP request to `beego-server` and then exits. View the span generated by `beego-server` in the logs: -```sh -docker-compose logs beego-server -``` - -You can also visit a webpage hosted by the Beego app by navigating to `http://localhost:7777` in your browser. -Two spans are created this time, one for the HTTP request, and another for rendering the template HTML. You can view the spans the same way as above. - -Shut down the services when you are finished with the example: -```sh -docker-compose down -``` diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/example/client/client.go b/instrumentation/github.com/astaxie/beego/otelbeego/example/client/client.go deleted file mode 100644 index 13f2e7f582a..00000000000 --- a/instrumentation/github.com/astaxie/beego/otelbeego/example/client/client.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright The OpenTelemetry 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 main - -import ( - "flag" - "fmt" - "io" - "log" - "net/http" -) - -func main() { - url := flag.String("server", "http://localhost:7777/hello", "server url") - flag.Parse() - - client := http.Client{} - - req, err := http.NewRequest("GET", *url, nil) - if err != nil { - log.Fatal(err) - } - - fmt.Printf("sending request...\n") - res, err := client.Do(req) - if err != nil { - log.Fatal(err) - } - - body, err := io.ReadAll(res.Body) - if err != nil { - log.Fatal(err) - } - _ = res.Body.Close() - - fmt.Printf("Response Received: %s\n\n\n", body) -} diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/example/docker-compose.yml b/instrumentation/github.com/astaxie/beego/otelbeego/example/docker-compose.yml deleted file mode 100644 index 017d49d6caa..00000000000 --- a/instrumentation/github.com/astaxie/beego/otelbeego/example/docker-compose.yml +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright The OpenTelemetry 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. - -version: "3.7" -services: - beego-server: - build: - dockerfile: $PWD/Dockerfile - context: ../../../../../.. - target: example-beego-server - command: ["/go/bin/server", "-zipkin", "zipkin:9411"] - ports: - - 7777:7777 - - http-client: - build: - dockerfile: $PWD/Dockerfile - context: ../../../../../.. - target: example-http-client - command: ["/go/bin/client", "-server", "http://beego-server:7777/hello"] - depends_on: - - beego-server - diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/example/go.mod b/instrumentation/github.com/astaxie/beego/otelbeego/example/go.mod deleted file mode 100644 index 3ef6290ae5e..00000000000 --- a/instrumentation/github.com/astaxie/beego/otelbeego/example/go.mod +++ /dev/null @@ -1,43 +0,0 @@ -// Deprecated: This module is no longer supported. -module go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego/example - -go 1.18 - -replace ( - go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego => ../ - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp => ../../../../../net/http/otelhttp - -) - -require ( - github.com/astaxie/beego v1.12.3 - go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego v0.43.0 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 -) - -require ( - github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/felixge/httpsnoop v1.0.3 // indirect - github.com/go-logr/logr v1.2.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect - github.com/hashicorp/golang-lru v0.5.4 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/prometheus/client_golang v1.16.0 // indirect - github.com/prometheus/client_model v0.3.0 // indirect - github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.10.1 // indirect - github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.43.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect - golang.org/x/crypto v0.13.0 // indirect - golang.org/x/net v0.15.0 // indirect - golang.org/x/sys v0.12.0 // indirect - golang.org/x/text v0.13.0 // indirect - google.golang.org/protobuf v1.31.0 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect -) diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/example/go.sum b/instrumentation/github.com/astaxie/beego/otelbeego/example/go.sum deleted file mode 100644 index ab23ecd1e14..00000000000 --- a/instrumentation/github.com/astaxie/beego/otelbeego/example/go.sum +++ /dev/null @@ -1,214 +0,0 @@ -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= -github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk= -github.com/astaxie/beego v1.12.3 h1:SAQkdD2ePye+v8Gn1r4X6IKZM1wd28EyUOVQ3PDSOOQ= -github.com/astaxie/beego v1.12.3/go.mod h1:p3qIm0Ryx7zeBHLljmd7omloyca1s4yu1a8kM1FkpIA= -github.com/beego/goyaml2 v0.0.0-20130207012346-5545475820dd/go.mod h1:1b+Y/CofkYwXMUU0OhQqGvsY2Bvgr4j6jfT699wyZKQ= -github.com/beego/x2j v0.0.0-20131220205130-a0352aadc542/go.mod h1:kSeGC/p1AbBiEp5kat81+DSQrZenVBZXklMLaELspWU= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60= -github.com/casbin/casbin v1.7.0/go.mod h1:c67qKN6Oum3UF5Q1+BByfFxkwKvhwW57ITjqwtzR1KE= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80= -github.com/couchbase/go-couchbase v0.0.0-20200519150804-63f3cdb75e0d/go.mod h1:TWI8EKQMs5u5jLKW/tsb9VwauIrMIxQG1r5fMsswK5U= -github.com/couchbase/gomemcached v0.0.0-20200526233749-ec430f949808/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c= -github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs= -github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/elastic/go-elasticsearch/v6 v6.8.5/go.mod h1:UwaDJsD3rWLM5rKNFzv9hgox93HoX8utj1kxD9aFUcI= -github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk= -github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= -github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= -github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/glendc/gopher-json v0.0.0-20170414221815-dc4743023d0c/go.mod h1:Gja1A+xZ9BoviGJNA2E9vFkPjjsl+CoJxSXiQM1UXtw= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= -github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= -github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/ledisdb/ledisdb v0.0.0-20200510135210-d35789ec47e6/go.mod h1:n931TsDuKuq+uX4v1fulaMbA/7ZLLhjc85h7chZGBCQ= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/pelletier/go-toml v1.0.1/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/peterh/liner v1.0.1-0.20171122030339-3681c2a91233/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.7.0/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= -github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= -github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= -github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= -github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo= -github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg= -github.com/siddontang/go v0.0.0-20170517070808-cb568a3e5cc0/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw= -github.com/siddontang/goredis v0.0.0-20150324035039-760763f78400/go.mod h1:DDcKzU3qCuvj/tPnimWSsZZzvk9qvkvrIL5naVBPh5s= -github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/ssdb/gossdb v0.0.0-20180723034631-88f6b59b84ec/go.mod h1:QBvMkMya+gXctz3kmljlUCu/yB3GZ6oee+dUozsezQE= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= -github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= -github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= -github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc= -github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU= -go.opentelemetry.io/otel v1.17.0 h1:MW+phZ6WZ5/uk2nd93ANk/6yJ+dVrvNWUjGhnnFU5jM= -go.opentelemetry.io/otel v1.17.0/go.mod h1:I2vmBGtFaODIVMBSTPVDlJSzBDNf93k60E6Ft0nyjo0= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.17.0 h1:Ut6hgtYcASHwCzRHkXEtSsM251cXJPW+Z9DyLwEn6iI= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.17.0/go.mod h1:TYeE+8d5CjrgBa0ZuRaDeMpIC1xZ7atg4g+nInjuSjc= -go.opentelemetry.io/otel/metric v1.17.0 h1:iG6LGVz5Gh+IuO0jmgvpTB6YVrCGngi8QGm+pMd8Pdc= -go.opentelemetry.io/otel/metric v1.17.0/go.mod h1:h4skoxdZI17AxwITdmdZjjYJQH5nzijUUjm+wtPph5o= -go.opentelemetry.io/otel/sdk v1.17.0 h1:FLN2X66Ke/k5Sg3V623Q7h7nt3cHXaW1FOvKKrW0IpE= -go.opentelemetry.io/otel/sdk v1.17.0/go.mod h1:U87sE0f5vQB7hwUoW98pW5Rz4ZDuCFBZFNUBlSgmDFQ= -go.opentelemetry.io/otel/trace v1.17.0 h1:/SWhSRHmDPOImIAetP1QAeMnZYiQXrTy4fMMYOdSKWQ= -go.opentelemetry.io/otel/trace v1.17.0/go.mod h1:I/4vKTgFclIsXRVucpH25X0mpFSczM7aHeaz0ZBLWjY= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/example/server/server.go b/instrumentation/github.com/astaxie/beego/otelbeego/example/server/server.go deleted file mode 100644 index 4b92a93fba0..00000000000 --- a/instrumentation/github.com/astaxie/beego/otelbeego/example/server/server.go +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright The OpenTelemetry 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 main - -import ( - "context" - "log" - - "github.com/astaxie/beego" - - "go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego" //nolint:staticcheck // This is deprecated and will be removed in the next release. - - "go.opentelemetry.io/otel" - stdout "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" - "go.opentelemetry.io/otel/propagation" - "go.opentelemetry.io/otel/sdk/resource" - sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" - "go.opentelemetry.io/otel/trace" -) - -type exampleController struct { - beego.Controller -} - -func (c *exampleController) Get() { - ctx := c.Ctx.Request.Context() - span := trace.SpanFromContext(ctx) - span.AddEvent("handling this...") - c.Ctx.WriteString("Hello, world!") -} - -func (c *exampleController) Template() { - c.TplName = "hello.tpl" - // Render the template file with tracing enabled - if err := otelbeego.Render(&c.Controller); err != nil { - c.Abort("500") - } -} - -func initTracer() (*sdktrace.TracerProvider, error) { - // Create stdout exporter to be able to retrieve - // the collected spans. - exporter, err := stdout.New(stdout.WithPrettyPrint()) - if err != nil { - return nil, err - } - - // For the demonstration, use sdktrace.AlwaysSample sampler to sample all traces. - // In a production application, use sdktrace.ProbabilitySampler with a desired probability. - tp := sdktrace.NewTracerProvider( - sdktrace.WithSampler(sdktrace.AlwaysSample()), - sdktrace.WithBatcher(exporter), - sdktrace.WithResource(resource.NewWithAttributes(semconv.SchemaURL, semconv.ServiceName("ExampleService")))) - otel.SetTracerProvider(tp) - otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{})) - return tp, nil -} - -func main() { - tp, err := initTracer() - if err != nil { - log.Fatal(err) - } - defer func() { - if err := tp.Shutdown(context.Background()); err != nil { - log.Printf("Error shutting down tracer provider: %v", err) - } - }() - - // To enable tracing on template rendering, disable autorender - beego.BConfig.WebConfig.AutoRender = false - - beego.Router("/hello", &exampleController{}) - beego.Router("/", &exampleController{}, "get:Template") - - mware := otelbeego.NewOTelBeegoMiddleWare("beego-example") - - beego.RunWithMiddleWares(":7777", mware) -} diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/example/views/hello.tpl b/instrumentation/github.com/astaxie/beego/otelbeego/example/views/hello.tpl deleted file mode 100644 index 023a5fa1b56..00000000000 --- a/instrumentation/github.com/astaxie/beego/otelbeego/example/views/hello.tpl +++ /dev/null @@ -1,9 +0,0 @@ - - - - - Hello World - - Welcome to the beego instrumentation example! - - diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/example_middleware_test.go b/instrumentation/github.com/astaxie/beego/otelbeego/example_middleware_test.go deleted file mode 100644 index 9501bd0f535..00000000000 --- a/instrumentation/github.com/astaxie/beego/otelbeego/example_middleware_test.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright The OpenTelemetry 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 otelbeego - -import ( - "github.com/astaxie/beego" -) - -type ExampleController struct { - beego.Controller -} - -func (c *ExampleController) Get() { - // name of the template in the views directory - c.TplName = "index.tpl" - - // explicit call to Render - if err := Render(&c.Controller); err != nil { - c.Abort("500") - } -} - -func ExampleRender() { - // Init the trace and meter provider - - // Disable autorender - beego.BConfig.WebConfig.AutoRender = false - - // Create routes - beego.Router("/", &ExampleController{}) - - // Create the middleware - mware := NewOTelBeegoMiddleWare("exampe-server") - - // Start the server using the OTel middleware - beego.RunWithMiddleWares(":7777", mware) -} diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/go.mod b/instrumentation/github.com/astaxie/beego/otelbeego/go.mod deleted file mode 100644 index a783168a0e4..00000000000 --- a/instrumentation/github.com/astaxie/beego/otelbeego/go.mod +++ /dev/null @@ -1,44 +0,0 @@ -// Deprecated: This module is no longer supported. -// github.com/astaxie/beego is no longer maintained. -// Use github.com/beego/beego/v2 together with its instrumentation -// packages instead. -module go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego - -go 1.19 - -replace go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp => ../../../../net/http/otelhttp - -require ( - github.com/astaxie/beego v1.12.3 - github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.43.0 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/metric v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 -) - -require ( - github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/felixge/httpsnoop v1.0.3 // indirect - github.com/go-logr/logr v1.2.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect - github.com/hashicorp/golang-lru v0.5.4 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_golang v1.16.0 // indirect - github.com/prometheus/client_model v0.3.0 // indirect - github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.10.1 // indirect - github.com/rogpeppe/go-internal v1.10.0 // indirect - github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect - golang.org/x/crypto v0.13.0 // indirect - golang.org/x/net v0.15.0 // indirect - golang.org/x/sys v0.12.0 // indirect - golang.org/x/text v0.13.0 // indirect - google.golang.org/protobuf v1.31.0 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/go.sum b/instrumentation/github.com/astaxie/beego/otelbeego/go.sum deleted file mode 100644 index a7e40581002..00000000000 --- a/instrumentation/github.com/astaxie/beego/otelbeego/go.sum +++ /dev/null @@ -1,213 +0,0 @@ -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= -github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk= -github.com/astaxie/beego v1.12.3 h1:SAQkdD2ePye+v8Gn1r4X6IKZM1wd28EyUOVQ3PDSOOQ= -github.com/astaxie/beego v1.12.3/go.mod h1:p3qIm0Ryx7zeBHLljmd7omloyca1s4yu1a8kM1FkpIA= -github.com/beego/goyaml2 v0.0.0-20130207012346-5545475820dd/go.mod h1:1b+Y/CofkYwXMUU0OhQqGvsY2Bvgr4j6jfT699wyZKQ= -github.com/beego/x2j v0.0.0-20131220205130-a0352aadc542/go.mod h1:kSeGC/p1AbBiEp5kat81+DSQrZenVBZXklMLaELspWU= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60= -github.com/casbin/casbin v1.7.0/go.mod h1:c67qKN6Oum3UF5Q1+BByfFxkwKvhwW57ITjqwtzR1KE= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80= -github.com/couchbase/go-couchbase v0.0.0-20200519150804-63f3cdb75e0d/go.mod h1:TWI8EKQMs5u5jLKW/tsb9VwauIrMIxQG1r5fMsswK5U= -github.com/couchbase/gomemcached v0.0.0-20200526233749-ec430f949808/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c= -github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs= -github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/elastic/go-elasticsearch/v6 v6.8.5/go.mod h1:UwaDJsD3rWLM5rKNFzv9hgox93HoX8utj1kxD9aFUcI= -github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk= -github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= -github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= -github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/glendc/gopher-json v0.0.0-20170414221815-dc4743023d0c/go.mod h1:Gja1A+xZ9BoviGJNA2E9vFkPjjsl+CoJxSXiQM1UXtw= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= -github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= -github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/ledisdb/ledisdb v0.0.0-20200510135210-d35789ec47e6/go.mod h1:n931TsDuKuq+uX4v1fulaMbA/7ZLLhjc85h7chZGBCQ= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/pelletier/go-toml v1.0.1/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/peterh/liner v1.0.1-0.20171122030339-3681c2a91233/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.7.0/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= -github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= -github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= -github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= -github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= -github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo= -github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg= -github.com/siddontang/go v0.0.0-20170517070808-cb568a3e5cc0/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw= -github.com/siddontang/goredis v0.0.0-20150324035039-760763f78400/go.mod h1:DDcKzU3qCuvj/tPnimWSsZZzvk9qvkvrIL5naVBPh5s= -github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/ssdb/gossdb v0.0.0-20180723034631-88f6b59b84ec/go.mod h1:QBvMkMya+gXctz3kmljlUCu/yB3GZ6oee+dUozsezQE= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= -github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= -github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= -github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc= -github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU= -go.opentelemetry.io/otel v1.17.0 h1:MW+phZ6WZ5/uk2nd93ANk/6yJ+dVrvNWUjGhnnFU5jM= -go.opentelemetry.io/otel v1.17.0/go.mod h1:I2vmBGtFaODIVMBSTPVDlJSzBDNf93k60E6Ft0nyjo0= -go.opentelemetry.io/otel/metric v1.17.0 h1:iG6LGVz5Gh+IuO0jmgvpTB6YVrCGngi8QGm+pMd8Pdc= -go.opentelemetry.io/otel/metric v1.17.0/go.mod h1:h4skoxdZI17AxwITdmdZjjYJQH5nzijUUjm+wtPph5o= -go.opentelemetry.io/otel/trace v1.17.0 h1:/SWhSRHmDPOImIAetP1QAeMnZYiQXrTy4fMMYOdSKWQ= -go.opentelemetry.io/otel/trace v1.17.0/go.mod h1:I/4vKTgFclIsXRVucpH25X0mpFSczM7aHeaz0ZBLWjY= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/internal/common.go b/instrumentation/github.com/astaxie/beego/otelbeego/internal/common.go deleted file mode 100644 index 53c10cc9b89..00000000000 --- a/instrumentation/github.com/astaxie/beego/otelbeego/internal/common.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright The OpenTelemetry 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.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego/internal" - -import ( - "go.opentelemetry.io/otel/attribute" -) - -// ContextKey is a key for a value in a context.Context, -// used as it is not recommended to use basic types as keys. -type ContextKey string - -const ( - // CtxRouteTemplateKey is the context key used for a route template. - CtxRouteTemplateKey = ContextKey("x-opentelemetry-route-template") - - // RenderTemplateSpanName is the span name for the beego.Controller.Render - // operation. - RenderTemplateSpanName = "beego.render.template" - // RenderStringSpanName is the span name for the - // beego.Controller.RenderString operation. - RenderStringSpanName = "beego.render.string" - // RenderStringSpanName is the span name for the - // beego.Controller.RenderBytes operation. - RenderBytesSpanName = "beego.render.bytes" - - // TemplateKey is used to describe the beego template used. - TemplateKey = attribute.Key("go.template") -) diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/test/beego_test.go b/instrumentation/github.com/astaxie/beego/otelbeego/test/beego_test.go deleted file mode 100644 index fbf74b6ce9c..00000000000 --- a/instrumentation/github.com/astaxie/beego/otelbeego/test/beego_test.go +++ /dev/null @@ -1,537 +0,0 @@ -// Copyright The OpenTelemetry 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 test - -import ( - "encoding/json" - "fmt" - "io" - "net/http" - "net/http/httptest" - "os" - "path/filepath" - "strings" - "testing" - "time" - - "go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego" //nolint:staticcheck // This is deprecated and will be removed in the next release. - "go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego/internal" - "go.opentelemetry.io/contrib/propagators/b3" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/propagation" - "go.opentelemetry.io/otel/sdk/trace" - "go.opentelemetry.io/otel/sdk/trace/tracetest" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" - - "github.com/astaxie/beego" - beegoCtx "github.com/astaxie/beego/context" - assetfs "github.com/elazarl/go-bindata-assetfs" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -// TODO(#2762): Add metric integration tests for the instrumentation. These -// tests depend on -// https://github.com/open-telemetry/opentelemetry-go/issues/3031 being -// resolved. - -// ------------------------------------------ Test Controller - -const defaultReply = "hello world" - -var tplName = "" - -type testReply struct { - Message string `json:"message"` - Err string `json:"error"` -} - -type testController struct { - beego.Controller - T *testing.T -} - -func (c *testController) Get() { - reply := &testReply{ - Message: defaultReply, - } - c.Data["json"] = reply - c.ServeJSON() -} - -func (c *testController) Post() { - name := c.GetString("name") - var reply *testReply - if name == "" { - c.Ctx.ResponseWriter.WriteHeader(http.StatusBadRequest) - reply = &testReply{ - Err: "missing query param \"name\"", - } - } else { - reply = &testReply{ - Message: fmt.Sprintf("%s said hello.", name), - } - } - c.Data["json"] = reply - c.ServeJSON() -} - -func (c *testController) Delete() { - reply := &testReply{ - Message: "success", - } - c.Ctx.ResponseWriter.WriteHeader(http.StatusAccepted) - c.Data["json"] = reply - c.ServeJSON() -} - -func (c *testController) Put() { - reply := &testReply{ - Message: "successfully put", - } - c.Ctx.ResponseWriter.WriteHeader(http.StatusAccepted) - c.Data["json"] = reply - c.ServeJSON() -} - -func (c *testController) TemplateRender() { - c.TplName = tplName - c.Data["name"] = "test" - require.NoError(c.T, otelbeego.Render(&c.Controller)) -} - -func (c *testController) TemplateRenderString() { - c.TplName = tplName - c.Data["name"] = "test" - str, err := otelbeego.RenderString(&c.Controller) - require.NoError(c.T, err) - c.Ctx.WriteString(str) -} - -func (c *testController) TemplateRenderBytes() { - c.TplName = tplName - c.Data["name"] = "test" - bytes, err := otelbeego.RenderBytes(&c.Controller) - require.NoError(c.T, err) - _, err = c.Ctx.ResponseWriter.Write(bytes) - require.NoError(c.T, err) -} - -func addTestRoutes(t *testing.T) { - controller := &testController{ - T: t, - } - beego.Router("/", controller) - beego.Router("/:id", controller) - beego.Router("/greet", controller) - beego.Router("/template/render", controller, "get:TemplateRender") - beego.Router("/template/renderstring", controller, "get:TemplateRenderString") - beego.Router("/template/renderbytes", controller, "get:TemplateRenderBytes") - router := beego.NewNamespace("/api", - beego.NSNamespace("/v1", - beego.NSRouter("/", controller), - beego.NSRouter("/:id", controller), - beego.NSRouter("/greet", controller), - ), - ) - beego.AddNamespace(router) -} - -func replaceBeego() { - beego.BeeApp = beego.NewApp() -} - -// ------------------------------------------ Unit Tests - -func TestHandler(t *testing.T) { - for _, tcase := range testCases { - tc := *tcase - t.Run(tc.name, func(t *testing.T) { - runTest(t, &tc, "http://localhost") - }) - } -} - -func TestHandlerWithNamespace(t *testing.T) { - for _, tcase := range testCases { - tc := *tcase - t.Run(tc.name, func(t *testing.T) { - // if using default span name, change name to NS path - if tc.expectedSpanName != customSpanName { - tc.expectedSpanName = fmt.Sprintf("/api/v1%s", tc.expectedSpanName) - } - runTest(t, &tc, "http://localhost/api/v1") - }) - } -} - -func TestWithFilters(t *testing.T) { - for _, tcase := range testCases { - tc := *tcase - t.Run(tc.name, func(t *testing.T) { - wasCalled := false - beego.InsertFilter("/*", beego.BeforeRouter, func(ctx *beegoCtx.Context) { - wasCalled = true - }) - runTest(t, &tc, "http://localhost") - require.True(t, wasCalled) - }) - } -} - -func TestStatic(t *testing.T) { - defer replaceBeego() - sr := tracetest.NewSpanRecorder() - tracerProvider := trace.NewTracerProvider(trace.WithSpanProcessor(sr)) - file, err := os.CreateTemp("", "static-*.html") - require.NoError(t, err) - defer file.Close() - defer os.Remove(file.Name()) - _, err = file.WriteString(beego.Htmlunquote("

Hello, world!

")) - require.NoError(t, err) - - beego.SetStaticPath("/", file.Name()) - defer beego.SetStaticPath("/", "") - - mw := otelbeego.NewOTelBeegoMiddleWare(middleWareName, - otelbeego.WithTracerProvider(tracerProvider), - ) - - rr := httptest.NewRecorder() - req, err := http.NewRequest(http.MethodGet, "http://localhost/", nil) - require.NoError(t, err) - mw(beego.BeeApp.Handlers).ServeHTTP(rr, req) - tc := &testCase{ - expectedSpanName: "GET", - expectedAttributes: defaultAttributes(), - } - - require.Equal(t, http.StatusOK, rr.Result().StatusCode) - body, err := io.ReadAll(rr.Result().Body) - require.NoError(t, err) - require.Equal(t, "

Hello, world!

", string(body)) - spans := sr.Ended() - require.Len(t, spans, 1) - assertSpan(t, spans[0], tc) -} - -var htmlStr = ` - - - - Hello World - - This is a template test. Hello {{.name}} - -` - -func TestRender(t *testing.T) { - tplName = "index.tpl" - beego.SetTemplateFSFunc(func() http.FileSystem { - return &assetfs.AssetFS{ - Asset: func(path string) ([]byte, error) { - if _, f := filepath.Split(path); f == tplName { - return []byte(htmlStr), nil - } - return nil, os.ErrNotExist - }, - AssetDir: func(path string) ([]string, error) { - switch path { - case "", `\`: - return []string{tplName}, nil - } - return nil, os.ErrNotExist - }, - AssetInfo: func(path string) (os.FileInfo, error) { - if _, f := filepath.Split(path); f == tplName { - return &assetfs.FakeFile{ - Path: path, - Len: int64(len(htmlStr)), - Timestamp: time.Now(), - }, nil - } - return nil, os.ErrNotExist - }, - } - }) - viewPath := "/" - require.NoError(t, beego.AddViewPath(viewPath)) - - ctrl := &testController{ - Controller: beego.Controller{ - ViewPath: viewPath, - EnableRender: true, - }, - T: t, - } - app := beego.NewApp() - app.Handlers.Add("/template/render", ctrl, "get:TemplateRender") - app.Handlers.Add("/template/renderstring", ctrl, "get:TemplateRenderString") - app.Handlers.Add("/template/renderbytes", ctrl, "get:TemplateRenderBytes") - - sr := tracetest.NewSpanRecorder() - tracerProvider := trace.NewTracerProvider(trace.WithSpanProcessor(sr)) - - mw := otelbeego.NewOTelBeegoMiddleWare( - middleWareName, - otelbeego.WithTracerProvider(tracerProvider), - ) - for _, str := range []string{"/render", "/renderstring", "/renderbytes"} { - rr := httptest.NewRecorder() - req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("http://localhost/template%s", str), nil) - require.NoError(t, err) - mw(app.Handlers).ServeHTTP(rr, req) - body, err := io.ReadAll(rr.Result().Body) - require.Equal(t, strings.Replace(htmlStr, "{{.name}}", "test", 1), string(body)) - require.NoError(t, err) - } - - spans := sr.Ended() - require.Len(t, spans, 6) // 3 HTTP requests, each creating 2 spans - for _, span := range spans { - switch span.Name() { - case "GET": - continue - case internal.RenderTemplateSpanName, - internal.RenderStringSpanName, - internal.RenderBytesSpanName: - assert.Contains(t, span.Attributes(), internal.TemplateKey.String(tplName)) - default: - t.Fatal("unexpected span name", span.Name()) - } - } -} - -// ------------------------------------------ Utilities - -func runTest(t *testing.T, tc *testCase, url string) { - sr := tracetest.NewSpanRecorder() - tracerProvider := trace.NewTracerProvider(trace.WithSpanProcessor(sr)) - addTestRoutes(t) - defer replaceBeego() - - rr := httptest.NewRecorder() - req, err := http.NewRequest( - tc.method, - fmt.Sprintf("%s%s", url, tc.path), - nil, - ) - require.NoError(t, err) - - tc.expectedAttributes = append(tc.expectedAttributes, defaultAttributes()...) - - mw := otelbeego.NewOTelBeegoMiddleWare( - middleWareName, - append( - tc.options, - otelbeego.WithTracerProvider(tracerProvider), - )..., - ) - - mw(beego.BeeApp.Handlers).ServeHTTP(rr, req) - - require.Equal(t, tc.expectedHTTPStatus, rr.Result().StatusCode) - body, err := io.ReadAll(rr.Result().Body) - require.NoError(t, err) - message := testReply{} - require.NoError(t, json.Unmarshal(body, &message)) - require.Equal(t, tc.expectedResponse, message) - - spans := sr.Ended() - if tc.hasSpan { - require.Len(t, spans, 1) - assertSpan(t, spans[0], tc) - } else { - require.Len(t, spans, 0) - } -} - -func defaultAttributes() []attribute.KeyValue { - return []attribute.KeyValue{ - semconv.NetHostName(middleWareName), - semconv.HTTPSchemeHTTP, - } -} - -func assertSpan(t *testing.T, span trace.ReadOnlySpan, tc *testCase) { - require.Equal(t, tc.expectedSpanName, span.Name()) - attr := span.Attributes() - for _, att := range tc.expectedAttributes { - assert.Contains(t, attr, att) - } -} - -// ------------------------------------------ Test Cases - -const middleWareName = "test-router" - -const customSpanName = "Test span name" - -type testCase struct { - name string - method string - path string - options []otelbeego.Option - hasSpan bool - expectedSpanName string - expectedHTTPStatus int - expectedResponse testReply - expectedAttributes []attribute.KeyValue -} - -var testCases = []*testCase{ - { - name: "GET/__All default options", - method: http.MethodGet, - path: "/", - options: []otelbeego.Option{}, - hasSpan: true, - expectedSpanName: "/", - expectedHTTPStatus: http.StatusOK, - expectedResponse: testReply{Message: defaultReply}, - expectedAttributes: []attribute.KeyValue{}, - }, - { - name: "GET/1__All default options", - method: http.MethodGet, - path: "/1", - options: []otelbeego.Option{}, - hasSpan: true, - expectedSpanName: "/:id", - expectedHTTPStatus: http.StatusOK, - expectedResponse: testReply{Message: defaultReply}, - expectedAttributes: []attribute.KeyValue{}, - }, - { - name: "POST/greet?name=test__All default options", - method: http.MethodPost, - path: "/greet?name=test", - options: []otelbeego.Option{}, - hasSpan: true, - expectedSpanName: "/greet", - expectedHTTPStatus: http.StatusOK, - expectedResponse: testReply{Message: "test said hello."}, - expectedAttributes: []attribute.KeyValue{}, - }, - { - name: "DELETE/__All default options", - method: http.MethodDelete, - path: "/", - options: []otelbeego.Option{}, - hasSpan: true, - expectedSpanName: "/", - expectedHTTPStatus: http.StatusAccepted, - expectedResponse: testReply{Message: "success"}, - expectedAttributes: []attribute.KeyValue{}, - }, - { - name: "PUT/__All default options", - method: http.MethodPut, - path: "/", - options: []otelbeego.Option{}, - hasSpan: true, - expectedSpanName: "/", - expectedHTTPStatus: http.StatusAccepted, - expectedResponse: testReply{Message: "successfully put"}, - expectedAttributes: []attribute.KeyValue{}, - }, - { - name: "GET/__Custom propagators", - method: http.MethodGet, - path: "/", - options: []otelbeego.Option{ - otelbeego.WithPropagators(propagation.NewCompositeTextMapPropagator(b3.New())), - }, - hasSpan: true, - expectedSpanName: "/", - expectedHTTPStatus: http.StatusOK, - expectedResponse: testReply{Message: defaultReply}, - expectedAttributes: []attribute.KeyValue{}, - }, - { - name: "GET/__Custom filter filtering route", - method: http.MethodGet, - path: "/", - options: []otelbeego.Option{ - otelbeego.WithFilter(otelbeego.Filter(func(req *http.Request) bool { - return req.URL.Path != "/" - })), - otelbeego.WithFilter(otelbeego.Filter(func(req *http.Request) bool { - return req.URL.Path != "/api/v1/" - })), - }, - hasSpan: false, - expectedHTTPStatus: http.StatusOK, - expectedResponse: testReply{Message: defaultReply}, - }, - { - name: "GET/__Custom filter not filtering route", - method: http.MethodGet, - path: "/", - options: []otelbeego.Option{ - otelbeego.WithFilter(otelbeego.Filter(func(req *http.Request) bool { - return req.URL.Path != "/greet" - })), - }, - hasSpan: true, - expectedSpanName: "/", - expectedHTTPStatus: http.StatusOK, - expectedResponse: testReply{Message: defaultReply}, - expectedAttributes: []attribute.KeyValue{}, - }, - { - name: "POST/greet__Default options, bad request", - method: http.MethodPost, - path: "/greet", - options: []otelbeego.Option{}, - hasSpan: true, - expectedSpanName: "/greet", - expectedHTTPStatus: http.StatusBadRequest, - expectedResponse: testReply{Err: "missing query param \"name\""}, - expectedAttributes: []attribute.KeyValue{}, - }, - { - name: "POST/greet?name=test__Custom span name formatter", - method: http.MethodPost, - path: "/greet?name=test", - options: []otelbeego.Option{ - otelbeego.WithSpanNameFormatter(otelbeego.SpanNameFormatter(func(opp string, req *http.Request) string { - return customSpanName - })), - }, - hasSpan: true, - expectedSpanName: customSpanName, - expectedHTTPStatus: http.StatusOK, - expectedResponse: testReply{Message: "test said hello."}, - expectedAttributes: []attribute.KeyValue{}, - }, - { - name: "POST/greet?name=test__Custom span name formatter and custom filter", - method: http.MethodPost, - path: "/greet?name=test", - options: []otelbeego.Option{ - otelbeego.WithFilter(otelbeego.Filter(func(req *http.Request) bool { - return !strings.Contains(req.URL.Path, "greet") - })), - otelbeego.WithSpanNameFormatter(otelbeego.SpanNameFormatter(func(opp string, req *http.Request) string { - return customSpanName - })), - }, - hasSpan: false, - expectedHTTPStatus: http.StatusOK, - expectedResponse: testReply{Message: "test said hello."}, - expectedAttributes: []attribute.KeyValue{}, - }, -} diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/test/doc.go b/instrumentation/github.com/astaxie/beego/otelbeego/test/doc.go deleted file mode 100644 index c28f452bb6c..00000000000 --- a/instrumentation/github.com/astaxie/beego/otelbeego/test/doc.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright The OpenTelemetry 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 test validates the otelbeego instrumentation with the default SDK. - -This package is in a separate module from the instrumentation it tests to -isolate the dependency of the default SDK and not impose this as a transitive -dependency for users. -*/ -package test // import "go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego/test" diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/test/go.mod b/instrumentation/github.com/astaxie/beego/otelbeego/test/go.mod deleted file mode 100644 index 5d08dcfb30a..00000000000 --- a/instrumentation/github.com/astaxie/beego/otelbeego/test/go.mod +++ /dev/null @@ -1,47 +0,0 @@ -module go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego/test - -go 1.19 - -require ( - github.com/astaxie/beego v1.12.3 - github.com/elazarl/go-bindata-assetfs v1.0.1 - github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego v0.43.0 - go.opentelemetry.io/contrib/propagators/b3 v1.18.0 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 -) - -require ( - github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/felixge/httpsnoop v1.0.3 // indirect - github.com/go-logr/logr v1.2.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect - github.com/hashicorp/golang-lru v0.5.4 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_golang v1.16.0 // indirect - github.com/prometheus/client_model v0.3.0 // indirect - github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.10.1 // indirect - github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.43.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect - go.opentelemetry.io/otel/trace v1.17.0 // indirect - golang.org/x/crypto v0.13.0 // indirect - golang.org/x/net v0.15.0 // indirect - golang.org/x/sys v0.12.0 // indirect - golang.org/x/text v0.13.0 // indirect - google.golang.org/protobuf v1.31.0 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) - -replace ( - go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego => ../ - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp => ../../../../../net/http/otelhttp - go.opentelemetry.io/contrib/propagators/b3 => ../../../../../../propagators/b3 -) diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/test/go.sum b/instrumentation/github.com/astaxie/beego/otelbeego/test/go.sum deleted file mode 100644 index 36f0184e6ad..00000000000 --- a/instrumentation/github.com/astaxie/beego/otelbeego/test/go.sum +++ /dev/null @@ -1,215 +0,0 @@ -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= -github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk= -github.com/astaxie/beego v1.12.3 h1:SAQkdD2ePye+v8Gn1r4X6IKZM1wd28EyUOVQ3PDSOOQ= -github.com/astaxie/beego v1.12.3/go.mod h1:p3qIm0Ryx7zeBHLljmd7omloyca1s4yu1a8kM1FkpIA= -github.com/beego/goyaml2 v0.0.0-20130207012346-5545475820dd/go.mod h1:1b+Y/CofkYwXMUU0OhQqGvsY2Bvgr4j6jfT699wyZKQ= -github.com/beego/x2j v0.0.0-20131220205130-a0352aadc542/go.mod h1:kSeGC/p1AbBiEp5kat81+DSQrZenVBZXklMLaELspWU= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60= -github.com/casbin/casbin v1.7.0/go.mod h1:c67qKN6Oum3UF5Q1+BByfFxkwKvhwW57ITjqwtzR1KE= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80= -github.com/couchbase/go-couchbase v0.0.0-20200519150804-63f3cdb75e0d/go.mod h1:TWI8EKQMs5u5jLKW/tsb9VwauIrMIxQG1r5fMsswK5U= -github.com/couchbase/gomemcached v0.0.0-20200526233749-ec430f949808/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c= -github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs= -github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/elastic/go-elasticsearch/v6 v6.8.5/go.mod h1:UwaDJsD3rWLM5rKNFzv9hgox93HoX8utj1kxD9aFUcI= -github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= -github.com/elazarl/go-bindata-assetfs v1.0.1 h1:m0kkaHRKEu7tUIUFVwhGGGYClXvyl4RE03qmvRTNfbw= -github.com/elazarl/go-bindata-assetfs v1.0.1/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= -github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= -github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/glendc/gopher-json v0.0.0-20170414221815-dc4743023d0c/go.mod h1:Gja1A+xZ9BoviGJNA2E9vFkPjjsl+CoJxSXiQM1UXtw= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= -github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= -github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/ledisdb/ledisdb v0.0.0-20200510135210-d35789ec47e6/go.mod h1:n931TsDuKuq+uX4v1fulaMbA/7ZLLhjc85h7chZGBCQ= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/pelletier/go-toml v1.0.1/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/peterh/liner v1.0.1-0.20171122030339-3681c2a91233/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.7.0/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= -github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= -github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= -github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= -github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo= -github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg= -github.com/siddontang/go v0.0.0-20170517070808-cb568a3e5cc0/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw= -github.com/siddontang/goredis v0.0.0-20150324035039-760763f78400/go.mod h1:DDcKzU3qCuvj/tPnimWSsZZzvk9qvkvrIL5naVBPh5s= -github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/ssdb/gossdb v0.0.0-20180723034631-88f6b59b84ec/go.mod h1:QBvMkMya+gXctz3kmljlUCu/yB3GZ6oee+dUozsezQE= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= -github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= -github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= -github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc= -github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU= -go.opentelemetry.io/otel v1.17.0 h1:MW+phZ6WZ5/uk2nd93ANk/6yJ+dVrvNWUjGhnnFU5jM= -go.opentelemetry.io/otel v1.17.0/go.mod h1:I2vmBGtFaODIVMBSTPVDlJSzBDNf93k60E6Ft0nyjo0= -go.opentelemetry.io/otel/metric v1.17.0 h1:iG6LGVz5Gh+IuO0jmgvpTB6YVrCGngi8QGm+pMd8Pdc= -go.opentelemetry.io/otel/metric v1.17.0/go.mod h1:h4skoxdZI17AxwITdmdZjjYJQH5nzijUUjm+wtPph5o= -go.opentelemetry.io/otel/sdk v1.17.0 h1:FLN2X66Ke/k5Sg3V623Q7h7nt3cHXaW1FOvKKrW0IpE= -go.opentelemetry.io/otel/sdk v1.17.0/go.mod h1:U87sE0f5vQB7hwUoW98pW5Rz4ZDuCFBZFNUBlSgmDFQ= -go.opentelemetry.io/otel/trace v1.17.0 h1:/SWhSRHmDPOImIAetP1QAeMnZYiQXrTy4fMMYOdSKWQ= -go.opentelemetry.io/otel/trace v1.17.0/go.mod h1:I/4vKTgFclIsXRVucpH25X0mpFSczM7aHeaz0ZBLWjY= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/test/version.go b/instrumentation/github.com/astaxie/beego/otelbeego/test/version.go deleted file mode 100644 index d9b6e179b77..00000000000 --- a/instrumentation/github.com/astaxie/beego/otelbeego/test/version.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright The OpenTelemetry 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 test // import "go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego/test" - -// Version is the current release version of the Beego instrumentation test module. -func Version() string { - return "0.43.0" - // This string is updated by the pre_release.sh script during release -} - -// SemVersion is the semantic version to be supplied to tracer/meter creation. -// -// Deprecated: Use [Version] instead. -func SemVersion() string { - return Version() -} diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/version.go b/instrumentation/github.com/astaxie/beego/otelbeego/version.go deleted file mode 100644 index bda4fba9b12..00000000000 --- a/instrumentation/github.com/astaxie/beego/otelbeego/version.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright The OpenTelemetry 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 otelbeego // import "go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego" - -// Version is the current release version of the Beego instrumentation. -func Version() string { - return "0.43.0" - // This string is updated by the pre_release.sh script during release -} - -// SemVersion is the semantic version to be supplied to tracer/meter creation. -// -// Deprecated: Use [Version] instead. -func SemVersion() string { - return Version() -} diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/config.go b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/config.go deleted file mode 100644 index d47697491c3..00000000000 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/config.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright The OpenTelemetry 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 otelmemcache // import "go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache" - -import ( - oteltrace "go.opentelemetry.io/otel/trace" -) - -type config struct { - tracerProvider oteltrace.TracerProvider -} - -// Option is used to configure the client. -type Option interface { - apply(*config) -} - -type optionFunc func(*config) - -func (o optionFunc) apply(c *config) { - o(c) -} - -// WithTracerProvider specifies a tracer provider to use for creating a tracer. -// If none is specified, the global provider is used. -func WithTracerProvider(provider oteltrace.TracerProvider) Option { - return optionFunc(func(cfg *config) { - if provider != nil { - cfg.tracerProvider = provider - } - }) -} diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/doc.go b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/doc.go deleted file mode 100644 index 9f906812057..00000000000 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/doc.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright The OpenTelemetry 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 otelmemcache instruments github.com/bradfitz/gomemcache/memcache. -// -// This instrumentation provided is tracing instrumentation for the memcached -// client. -// -// The instrumentation works by wrapping the memcached client by calling -// `NewClientWithTracing` and tracing it's every operation. -// -// Deprecated: This module is no longer supported. -package otelmemcache // import "go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache" diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/Dockerfile b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/Dockerfile deleted file mode 100644 index b8456c62bc0..00000000000 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright The OpenTelemetry 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. -FROM golang:1.21-alpine AS base -COPY . /src/ -WORKDIR /src/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example - -FROM base AS memcache-client -RUN go install ./client.go -CMD ["/go/bin/client"] diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/README.md b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/README.md deleted file mode 100644 index e810d6e1aec..00000000000 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# gomemcache instrumentation example - -A simple example to demonstrate gomemcache client tracing instrumentation. It consists of two containers - `memcached-server`, which initializes and runs the Memcached server for this example, and `gomemcache-client`, which is the instrumented client. - -In the example, the client invokes function `doMemcacheOperations()`, which is wrapped in a span. From within the function, the client will do a few example operations (add, get, delete with an intentional error) and cleans up the entries by calling `DeleteAll`. - -These instructions expect you to have -[docker-compose](https://docs.docker.com/compose/) installed. - -# Running the example - -1. From within the `example` directory, bring up the project by running: - - ```sh - docker-compose up --detach - ``` - -2. The instrumentation works with a `stdout` exporter, meaning the spans should be visible in the output of the `gomemcache-container`. To inspect the output, you can run: - - ```sh - docker-compose logs gomemcache-client - ``` - - In the log, total of 5 spans should appear - the parent span `test-operations` and 4 child spans, each corresponding to one client operation. Additionally, the `Delete` operation span should also include `StatusCode` and `StatusMessage`, as this operation intentionally leads to an error. - -3. After inspecting the client logs, the example can be cleaned up by running: - - ```sh - docker-compose down - ``` \ No newline at end of file diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/client.go b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/client.go deleted file mode 100644 index d7fe9ce50cb..00000000000 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/client.go +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright The OpenTelemetry 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 main - -import ( - "context" - "log" - "os" - - "github.com/bradfitz/gomemcache/memcache" - - "go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache" //nolint:staticcheck // This is deprecated and will be removed in the next release. - - oteltracestdout "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" - sdktrace "go.opentelemetry.io/otel/sdk/trace" -) - -func main() { - var host, port = os.Getenv("HOST"), "11211" - - tp, err := initTracer() - if err != nil { - log.Fatal(err) - } - defer func() { - if err := tp.Shutdown(context.Background()); err != nil { - log.Printf("Error shutting down tracer provider: %v", err) - } - }() - ctx := context.Background() - - c := otelmemcache.NewClientWithTracing( - memcache.New( - host+":"+port, - ), - otelmemcache.WithTracerProvider(tp), - ) - - ctx, s := tp.Tracer("example-tracer").Start(ctx, "test-operations") - doMemcacheOperations(ctx, c) - s.End() -} - -func doMemcacheOperations(ctx context.Context, c *otelmemcache.Client) { - cc := c.WithContext(ctx) - - err := cc.Add(&memcache.Item{ - Key: "foo", - Value: []byte("bar"), - }) - if err != nil { - log.Printf("Add failed: %s", err) - } - - _, err = cc.Get("foo") - if err != nil { - log.Printf("Get failed: %s", err) - } - - err = cc.Delete("baz") - if err != nil { - log.Printf("Delete failed: %s", err) - } - - err = cc.DeleteAll() - if err != nil { - log.Printf("DeleteAll failed: %s", err) - } -} - -func initTracer() (*sdktrace.TracerProvider, error) { - exporter, err := oteltracestdout.New(oteltracestdout.WithPrettyPrint()) - if err != nil { - return nil, err - } - tp := sdktrace.NewTracerProvider( - sdktrace.WithSampler(sdktrace.AlwaysSample()), - sdktrace.WithBatcher(exporter), - ) - - return tp, nil -} diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/docker-compose.yml b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/docker-compose.yml deleted file mode 100644 index f004f9694c1..00000000000 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/docker-compose.yml +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright The OpenTelemetry 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. -version: "3.7" -services: - gomemcache-client: - build: - dockerfile: $PWD/Dockerfile - context: ../../../../../../.. - command: - - "/bin/sh" - - "-c" - - "/go/bin/client" - environment: - - HOST=memcached-server - networks: - - example - depends_on: - - memcached-server - memcached-server: - image: memcached:1.6.6-alpine - networks: - - example -networks: - example: diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/go.mod b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/go.mod deleted file mode 100644 index 1d1f700709a..00000000000 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/go.mod +++ /dev/null @@ -1,21 +0,0 @@ -module go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example - -go 1.18 - -replace go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache => ../ - -require ( - github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b - go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache v0.43.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 -) - -require ( - github.com/go-logr/logr v1.2.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel v1.17.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect - go.opentelemetry.io/otel/trace v1.17.0 // indirect - golang.org/x/sys v0.11.0 // indirect -) diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/go.sum b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/go.sum deleted file mode 100644 index b758a18c698..00000000000 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/go.sum +++ /dev/null @@ -1,24 +0,0 @@ -github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b h1:L/QXpzIa3pOvUGt1D1lA5KjYhPBAN/3iWdP7xeFS9F0= -github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -go.opentelemetry.io/otel v1.17.0 h1:MW+phZ6WZ5/uk2nd93ANk/6yJ+dVrvNWUjGhnnFU5jM= -go.opentelemetry.io/otel v1.17.0/go.mod h1:I2vmBGtFaODIVMBSTPVDlJSzBDNf93k60E6Ft0nyjo0= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.17.0 h1:Ut6hgtYcASHwCzRHkXEtSsM251cXJPW+Z9DyLwEn6iI= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.17.0/go.mod h1:TYeE+8d5CjrgBa0ZuRaDeMpIC1xZ7atg4g+nInjuSjc= -go.opentelemetry.io/otel/metric v1.17.0 h1:iG6LGVz5Gh+IuO0jmgvpTB6YVrCGngi8QGm+pMd8Pdc= -go.opentelemetry.io/otel/metric v1.17.0/go.mod h1:h4skoxdZI17AxwITdmdZjjYJQH5nzijUUjm+wtPph5o= -go.opentelemetry.io/otel/sdk v1.17.0 h1:FLN2X66Ke/k5Sg3V623Q7h7nt3cHXaW1FOvKKrW0IpE= -go.opentelemetry.io/otel/sdk v1.17.0/go.mod h1:U87sE0f5vQB7hwUoW98pW5Rz4ZDuCFBZFNUBlSgmDFQ= -go.opentelemetry.io/otel/trace v1.17.0 h1:/SWhSRHmDPOImIAetP1QAeMnZYiQXrTy4fMMYOdSKWQ= -go.opentelemetry.io/otel/trace v1.17.0/go.mod h1:I/4vKTgFclIsXRVucpH25X0mpFSczM7aHeaz0ZBLWjY= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/go.mod b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/go.mod deleted file mode 100644 index 412e99a035c..00000000000 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/go.mod +++ /dev/null @@ -1,20 +0,0 @@ -// Deprecated: This module is no longer supported. -module go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache - -go 1.19 - -require ( - github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b - github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 -) - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/go.sum b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/go.sum deleted file mode 100644 index 61fb63aeb2a..00000000000 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/go.sum +++ /dev/null @@ -1,24 +0,0 @@ -github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b h1:L/QXpzIa3pOvUGt1D1lA5KjYhPBAN/3iWdP7xeFS9F0= -github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -go.opentelemetry.io/otel v1.17.0 h1:MW+phZ6WZ5/uk2nd93ANk/6yJ+dVrvNWUjGhnnFU5jM= -go.opentelemetry.io/otel v1.17.0/go.mod h1:I2vmBGtFaODIVMBSTPVDlJSzBDNf93k60E6Ft0nyjo0= -go.opentelemetry.io/otel/metric v1.17.0 h1:iG6LGVz5Gh+IuO0jmgvpTB6YVrCGngi8QGm+pMd8Pdc= -go.opentelemetry.io/otel/metric v1.17.0/go.mod h1:h4skoxdZI17AxwITdmdZjjYJQH5nzijUUjm+wtPph5o= -go.opentelemetry.io/otel/trace v1.17.0 h1:/SWhSRHmDPOImIAetP1QAeMnZYiQXrTy4fMMYOdSKWQ= -go.opentelemetry.io/otel/trace v1.17.0/go.mod h1:I/4vKTgFclIsXRVucpH25X0mpFSczM7aHeaz0ZBLWjY= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/gomemcache.go b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/gomemcache.go deleted file mode 100644 index c67ead6153c..00000000000 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/gomemcache.go +++ /dev/null @@ -1,223 +0,0 @@ -// Copyright The OpenTelemetry 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 otelmemcache // import "go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache" - -import ( - "context" - - "github.com/bradfitz/gomemcache/memcache" - - "go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/internal" - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - oteltrace "go.opentelemetry.io/otel/trace" -) - -const ( - tracerName = "go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache" -) - -// Client is a wrapper around *memcache.Client. -type Client struct { - *memcache.Client - tracer oteltrace.Tracer - ctx context.Context -} - -// NewClientWithTracing wraps the provided memcache client to allow -// tracing of all client operations. Accepts options to set trace provider -// and service name, otherwise uses registered global trace provider and -// default value for service name. -// -// Every client operation starts a span with appropriate attributes, -// executes the operation and ends the span (additionally also sets a status -// error code and message, if an error occurs). Optionally, client context can -// be set before an operation with the WithContext method. -func NewClientWithTracing(client *memcache.Client, opts ...Option) *Client { - cfg := &config{} - for _, o := range opts { - o.apply(cfg) - } - - if cfg.tracerProvider == nil { - cfg.tracerProvider = otel.GetTracerProvider() - } - - return &Client{ - client, - cfg.tracerProvider.Tracer( - tracerName, - oteltrace.WithInstrumentationVersion(Version()), - ), - context.Background(), - } -} - -// attrsByOperationAndItemKey returns appropriate span attributes on the basis -// of the operation name and item key(s) (if available). -func (c *Client) attrsByOperationAndItemKey(operation internal.Operation, key ...string) []attribute.KeyValue { - attributes := []attribute.KeyValue{ - internal.MemcacheDBSystem(), - internal.MemcacheDBOperation(operation), - } - - if len(key) > 0 { - attributes = append(attributes, internal.MemcacheDBItemKeys(key...)) - } - - return attributes -} - -// Starts span with appropriate span kind and attributes. -func (c *Client) startSpan(operationName internal.Operation, itemKey ...string) oteltrace.Span { - opts := []oteltrace.SpanStartOption{ - // for database client calls, always use CLIENT span kind - oteltrace.WithSpanKind(oteltrace.SpanKindClient), - oteltrace.WithAttributes( - c.attrsByOperationAndItemKey(operationName, itemKey...)..., - ), - } - - _, span := c.tracer.Start( - c.ctx, - string(operationName), - opts..., - ) - - return span -} - -// Ends span and, if applicable, sets error status. -func endSpan(s oteltrace.Span, err error) { - if err != nil { - s.SetStatus(codes.Error, err.Error()) - } - s.End() -} - -// WithContext retruns a copy of the client with provided context. -func (c *Client) WithContext(ctx context.Context) *Client { - cc := c.Client - return &Client{ - Client: cc, - tracer: c.tracer, - ctx: ctx, - } -} - -// Add invokes the add operation and traces it. -func (c *Client) Add(item *memcache.Item) error { - s := c.startSpan(internal.OperationAdd, item.Key) - err := c.Client.Add(item) - endSpan(s, err) - return err -} - -// CompareAndSwap invokes the compare-and-swap operation and traces it. -func (c *Client) CompareAndSwap(item *memcache.Item) error { - s := c.startSpan(internal.OperationCompareAndSwap, item.Key) - err := c.Client.CompareAndSwap(item) - endSpan(s, err) - return err -} - -// Decrement invokes the decrement operation and traces it. -func (c *Client) Decrement(key string, delta uint64) (uint64, error) { - s := c.startSpan(internal.OperationDecrement, key) - newValue, err := c.Client.Decrement(key, delta) - endSpan(s, err) - return newValue, err -} - -// Delete invokes the delete operation and traces it. -func (c *Client) Delete(key string) error { - s := c.startSpan(internal.OperationDelete, key) - err := c.Client.Delete(key) - endSpan(s, err) - return err -} - -// DeleteAll invokes the delete all operation and traces it. -func (c *Client) DeleteAll() error { - s := c.startSpan(internal.OperationDeleteAll) - err := c.Client.DeleteAll() - endSpan(s, err) - return err -} - -// FlushAll invokes the flush all operation and traces it. -func (c *Client) FlushAll() error { - s := c.startSpan(internal.OperationFlushAll) - err := c.Client.FlushAll() - endSpan(s, err) - return err -} - -// Get invokes the get operation and traces it. -func (c *Client) Get(key string) (*memcache.Item, error) { - s := c.startSpan(internal.OperationGet, key) - item, err := c.Client.Get(key) - endSpan(s, err) - return item, err -} - -// GetMulti invokes the get operation for multiple keys and traces it. -func (c *Client) GetMulti(keys []string) (map[string]*memcache.Item, error) { - s := c.startSpan(internal.OperationGet, keys...) - items, err := c.Client.GetMulti(keys) - endSpan(s, err) - return items, err -} - -// Increment invokes the increment operation and traces it. -func (c *Client) Increment(key string, delta uint64) (uint64, error) { - s := c.startSpan(internal.OperationIncrement, key) - newValue, err := c.Client.Increment(key, delta) - endSpan(s, err) - return newValue, err -} - -// Ping invokes the ping operation and traces it. -func (c *Client) Ping() error { - s := c.startSpan(internal.OperationPing) - err := c.Client.Ping() - endSpan(s, err) - return err -} - -// Replace invokes the replace operation and traces it. -func (c *Client) Replace(item *memcache.Item) error { - s := c.startSpan(internal.OperationReplace, item.Key) - err := c.Client.Replace(item) - endSpan(s, err) - return err -} - -// Set invokes the set operation and traces it. -func (c *Client) Set(item *memcache.Item) error { - s := c.startSpan(internal.OperationSet, item.Key) - err := c.Client.Set(item) - endSpan(s, err) - return err -} - -// Touch invokes the touch operation and traces it. -func (c *Client) Touch(key string, seconds int32) error { - s := c.startSpan(internal.OperationTouch, key) - err := c.Client.Touch(key, seconds) - endSpan(s, err) - return err -} diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/gomemcache_test.go b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/gomemcache_test.go deleted file mode 100644 index 3006b2681ae..00000000000 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/gomemcache_test.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright The OpenTelemetry 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 otelmemcache - -import ( - "testing" - - "github.com/bradfitz/gomemcache/memcache" - "github.com/stretchr/testify/assert" -) - -func TestNewClientWithTracing(t *testing.T) { - c := NewClientWithTracing( - memcache.New(), - ) - - assert.NotNil(t, c.Client) - assert.NotNil(t, c.tracer) -} diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/internal/attributes.go b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/internal/attributes.go deleted file mode 100644 index 0b0550079fc..00000000000 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/internal/attributes.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright The OpenTelemetry 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.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/internal" - -import ( - "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" -) - -type Operation string - -// Instrumentation specific tracing information. -const ( - OperationAdd Operation = "add" - OperationCompareAndSwap Operation = "cas" - OperationDecrement Operation = "decr" - OperationDelete Operation = "delete" - OperationDeleteAll Operation = "delete_all" - OperationFlushAll Operation = "flush_all" - OperationGet Operation = "get" - OperationIncrement Operation = "incr" - OperationPing Operation = "ping" - OperationReplace Operation = "replace" - OperationSet Operation = "set" - OperationTouch Operation = "touch" - - MemcacheDBItemKeyName attribute.Key = "db.memcached.item" -) - -func MemcacheDBSystem() attribute.KeyValue { - return semconv.DBSystemMemcached -} - -func MemcacheDBOperation(opName Operation) attribute.KeyValue { - return semconv.DBOperation(string(opName)) -} - -func MemcacheDBItemKeys(itemKeys ...string) attribute.KeyValue { - if len(itemKeys) > 1 { - return MemcacheDBItemKeyName.StringSlice(itemKeys) - } - - return MemcacheDBItemKeyName.String(itemKeys[0]) -} diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/test/doc.go b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/test/doc.go deleted file mode 100644 index 8e8dac0b74b..00000000000 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/test/doc.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright The OpenTelemetry 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 test validates the otelmemcache instrumentation with the default SDK. - -This package is in a separate module from the instrumentation it tests to -isolate the dependency of the default SDK and not impose this as a transitive -dependency for users. -*/ -package test // import "go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/test" diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/test/go.mod b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/test/go.mod deleted file mode 100644 index 81cd5356433..00000000000 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/test/go.mod +++ /dev/null @@ -1,27 +0,0 @@ -module go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/test - -go 1.19 - -require ( - github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b - github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/contrib v1.18.0 - go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache v0.43.0 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 -) - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect - golang.org/x/sys v0.11.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) - -replace go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache => ../ - -replace go.opentelemetry.io/contrib => ../../../../../../../ diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/test/go.sum b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/test/go.sum deleted file mode 100644 index 4757383a9d2..00000000000 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/test/go.sum +++ /dev/null @@ -1,28 +0,0 @@ -github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b h1:L/QXpzIa3pOvUGt1D1lA5KjYhPBAN/3iWdP7xeFS9F0= -github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -go.opentelemetry.io/otel v1.17.0 h1:MW+phZ6WZ5/uk2nd93ANk/6yJ+dVrvNWUjGhnnFU5jM= -go.opentelemetry.io/otel v1.17.0/go.mod h1:I2vmBGtFaODIVMBSTPVDlJSzBDNf93k60E6Ft0nyjo0= -go.opentelemetry.io/otel/metric v1.17.0 h1:iG6LGVz5Gh+IuO0jmgvpTB6YVrCGngi8QGm+pMd8Pdc= -go.opentelemetry.io/otel/metric v1.17.0/go.mod h1:h4skoxdZI17AxwITdmdZjjYJQH5nzijUUjm+wtPph5o= -go.opentelemetry.io/otel/sdk v1.17.0 h1:FLN2X66Ke/k5Sg3V623Q7h7nt3cHXaW1FOvKKrW0IpE= -go.opentelemetry.io/otel/sdk v1.17.0/go.mod h1:U87sE0f5vQB7hwUoW98pW5Rz4ZDuCFBZFNUBlSgmDFQ= -go.opentelemetry.io/otel/trace v1.17.0 h1:/SWhSRHmDPOImIAetP1QAeMnZYiQXrTy4fMMYOdSKWQ= -go.opentelemetry.io/otel/trace v1.17.0/go.mod h1:I/4vKTgFclIsXRVucpH25X0mpFSczM7aHeaz0ZBLWjY= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/test/gomemcache_test.go b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/test/gomemcache_test.go deleted file mode 100644 index c229de0064b..00000000000 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/test/gomemcache_test.go +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright The OpenTelemetry 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 test - -import ( - "os" - "testing" - - "github.com/bradfitz/gomemcache/memcache" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache" //nolint:staticcheck // This is deprecated and will be removed in the next release. - "go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/internal" - "go.opentelemetry.io/contrib/internal/util" - "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/sdk/trace" - "go.opentelemetry.io/otel/sdk/trace/tracetest" - oteltrace "go.opentelemetry.io/otel/trace" -) - -func TestMain(m *testing.M) { - util.IntegrationShouldRun("test-gomemcache") - os.Exit(m.Run()) -} - -func TestOperation(t *testing.T) { - c, sr := initClientWithSpanRecorder(t) - - mi := &memcache.Item{ - Key: "foo", - Value: []byte("bar"), - } - err := c.Add(mi) - require.NoError(t, err) - - spans := sr.Ended() - assert.Len(t, spans, 1) - assert.Equal(t, oteltrace.SpanKindClient, spans[0].SpanKind()) - assert.Equal(t, string(internal.OperationAdd), spans[0].Name()) - assert.Len(t, spans[0].Attributes(), 3) - - attrs := spans[0].Attributes() - assert.Contains(t, attrs, internal.MemcacheDBSystem()) - assert.Contains(t, attrs, internal.MemcacheDBOperation(internal.OperationAdd)) - assert.Contains(t, attrs, internal.MemcacheDBItemKeyName.String(mi.Key)) -} - -func TestOperationWithCacheMissError(t *testing.T) { - key := "foo" - c, sr := initClientWithSpanRecorder(t) - - _, err := c.Get(key) - assert.Error(t, err) - - spans := sr.Ended() - assert.Len(t, spans, 1) - assert.Equal(t, oteltrace.SpanKindClient, spans[0].SpanKind()) - assert.Equal(t, string(internal.OperationGet), spans[0].Name()) - assert.Len(t, spans[0].Attributes(), 3) - - attrs := spans[0].Attributes() - assert.Contains(t, attrs, internal.MemcacheDBSystem()) - assert.Contains(t, attrs, internal.MemcacheDBOperation(internal.OperationGet)) - assert.Contains(t, attrs, internal.MemcacheDBItemKeyName.String(key)) - - assert.Equal(t, codes.Error, spans[0].Status().Code) - assert.Equal(t, err.Error(), spans[0].Status().Description) -} - -// tests require running memcached instance. -func initClientWithSpanRecorder(t *testing.T) (*otelmemcache.Client, *tracetest.SpanRecorder) { - host, port := "localhost", "11211" - - mc := memcache.New(host + ":" + port) - require.NoError(t, clearDB(mc)) - - sr := tracetest.NewSpanRecorder() - c := otelmemcache.NewClientWithTracing( - mc, - otelmemcache.WithTracerProvider( - trace.NewTracerProvider(trace.WithSpanProcessor(sr)), - ), - ) - - return c, sr -} - -func clearDB(c *memcache.Client) error { - return c.DeleteAll() -} diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/test/version.go b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/test/version.go deleted file mode 100644 index ee911652d73..00000000000 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/test/version.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright The OpenTelemetry 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 test // import "go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/test" - -// Version is the current release version of the memcached instrumentation test module. -func Version() string { - return "0.43.0" - // This string is updated by the pre_release.sh script during release -} - -// SemVersion is the semantic version to be supplied to tracer/meter creation. -// -// Deprecated: Use [Version] instead. -func SemVersion() string { - return Version() -} diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/version.go b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/version.go deleted file mode 100644 index 131ac32347f..00000000000 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/version.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright The OpenTelemetry 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 otelmemcache // import "go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache" - -// Version is the current release version of the memcached instrumentation. -func Version() string { - return "0.43.0" - // This string is updated by the pre_release.sh script during release -} - -// SemVersion is the semantic version to be supplied to tracer/meter creation. -// -// Deprecated: Use [Version] instead. -func SemVersion() string { - return Version() -} diff --git a/instrumentation/github.com/go-kit/kit/otelkit/config.go b/instrumentation/github.com/go-kit/kit/otelkit/config.go deleted file mode 100644 index 369735ee6e1..00000000000 --- a/instrumentation/github.com/go-kit/kit/otelkit/config.go +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright The OpenTelemetry 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. - -// Based on https://github.com/go-kit/kit/blob/3796a6b25f5c6c545454d3ed7187c4ced258083d/tracing/opencensus/endpoint_options.go - -package otelkit // import "go.opentelemetry.io/contrib/instrumentation/github.com/go-kit/kit/otelkit" - -import ( - "context" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/trace" -) - -// config holds the options for tracing an endpoint. -type config struct { - // TracerProvider provides access to instrumentation Tracers. - TracerProvider trace.TracerProvider - - // IgnoreBusinessError if set to true will not treat a business error - // identified through the endpoint.Failer interface as a span error. - IgnoreBusinessError bool - - // Operation identifies the current operation and serves as a span name. - Operation string - - // GetOperation is an optional function that can set the span name based on the existing operation - // for the endpoint and information in the context. - // - // If the function is nil, or the returned operation is empty, the existing operation for the endpoint is used. - GetOperation func(ctx context.Context, operation string) string - - // Attributes holds the default attributes for each span created by this middleware. - Attributes []attribute.KeyValue - - // GetAttributes is an optional function that can extract trace attributes - // from the context and add them to the span. - GetAttributes func(ctx context.Context) []attribute.KeyValue -} - -// Option configures an EndpointMiddleware. -type Option interface { - apply(*config) -} - -type optionFunc func(*config) - -func (o optionFunc) apply(c *config) { - o(c) -} - -// WithTracerProvider specifies a tracer provider to use for creating a tracer. -// If none is specified, the global provider is used. -func WithTracerProvider(provider trace.TracerProvider) Option { - return optionFunc(func(o *config) { - if provider != nil { - o.TracerProvider = provider - } - }) -} - -// WithIgnoreBusinessError if set to true will not treat a business error -// identified through the endpoint.Failer interface as a span error. -func WithIgnoreBusinessError(val bool) Option { - return optionFunc(func(o *config) { - o.IgnoreBusinessError = val - }) -} - -// WithOperation sets an operation name for an endpoint. -// Use this when you register a middleware for each endpoint. -func WithOperation(operation string) Option { - return optionFunc(func(o *config) { - o.Operation = operation - }) -} - -// WithOperationGetter sets an operation name getter function in config. -func WithOperationGetter(fn func(ctx context.Context, name string) string) Option { - return optionFunc(func(o *config) { - o.GetOperation = fn - }) -} - -// WithAttributes sets the default attributes for the spans created by the Endpoint tracer. -func WithAttributes(attrs ...attribute.KeyValue) Option { - return optionFunc(func(o *config) { - o.Attributes = attrs - }) -} - -// WithAttributeGetter extracts additional attributes from the context. -func WithAttributeGetter(fn func(ctx context.Context) []attribute.KeyValue) Option { - return optionFunc(func(o *config) { - o.GetAttributes = fn - }) -} diff --git a/instrumentation/github.com/go-kit/kit/otelkit/doc.go b/instrumentation/github.com/go-kit/kit/otelkit/doc.go deleted file mode 100644 index 717edf663fb..00000000000 --- a/instrumentation/github.com/go-kit/kit/otelkit/doc.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright The OpenTelemetry 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 otelkit instruments the github.com/go-kit/kit package. -// -// Compared to other instrumentation libraries provided by go-kit itself, -// this package only provides instrumentation for the endpoint layer. -// For instrumenting the transport layer, -// look at the instrumentation libraries provided by go.opentelemetry.io/contrib. -// Learn more about go-kit's layers at https://gokit.io/faq/#architecture-and-design. -// -// Deprecated: This module is no longer supported. -package otelkit // import "go.opentelemetry.io/contrib/instrumentation/github.com/go-kit/kit/otelkit" diff --git a/instrumentation/github.com/go-kit/kit/otelkit/endpoint.go b/instrumentation/github.com/go-kit/kit/otelkit/endpoint.go deleted file mode 100644 index c5beec6b32b..00000000000 --- a/instrumentation/github.com/go-kit/kit/otelkit/endpoint.go +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright The OpenTelemetry 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. - -// Based on https://github.com/go-kit/kit/blob/3796a6b25f5c6c545454d3ed7187c4ced258083d/tracing/opencensus/endpoint.go - -package otelkit // import "go.opentelemetry.io/contrib/instrumentation/github.com/go-kit/kit/otelkit" - -import ( - "context" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/trace" - - "github.com/go-kit/kit/endpoint" - "github.com/go-kit/kit/sd/lb" -) - -const ( - tracerName = "go.opentelemetry.io/contrib/instrumentation/github.com/go-kit/kit/otelkit" - - // defaultSpanName is the default endpoint span name to use. - defaultSpanName = "gokit/endpoint" -) - -// EndpointMiddleware returns an Endpoint middleware, tracing a Go kit endpoint. -// This endpoint middleware should be used in combination with a Go kit Transport -// tracing middleware, generic OpenTelemetry transport middleware or custom before -// and after transport functions. -func EndpointMiddleware(options ...Option) endpoint.Middleware { - cfg := &config{} - - for _, o := range options { - o.apply(cfg) - } - - if cfg.TracerProvider == nil { - cfg.TracerProvider = otel.GetTracerProvider() - } - - tracer := cfg.TracerProvider.Tracer( - tracerName, - trace.WithInstrumentationVersion(Version()), - ) - - return func(next endpoint.Endpoint) endpoint.Endpoint { - return func(ctx context.Context, request interface{}) (response interface{}, err error) { - operation := cfg.Operation - if cfg.GetOperation != nil { - if newOperation := cfg.GetOperation(ctx, operation); newOperation != "" { - operation = newOperation - } - } - - spanName := operation - if spanName == "" { - spanName = defaultSpanName - } - - opts := []trace.SpanStartOption{ - trace.WithAttributes(cfg.Attributes...), - trace.WithSpanKind(trace.SpanKindServer), - } - - if cfg.GetAttributes != nil { - opts = append(opts, trace.WithAttributes(cfg.GetAttributes(ctx)...)) - } - - ctx, span := tracer.Start(ctx, spanName, opts...) - defer span.End() - - defer func() { - if err != nil { - if lberr, ok := err.(lb.RetryError); ok { - // Handle errors originating from lb.Retry. - for idx, rawErr := range lberr.RawErrors { - span.RecordError(rawErr, trace.WithAttributes( - attribute.Int("gokit.lb.retry.count", idx+1), - )) - } - - span.RecordError(lberr.Final) - span.SetStatus(codes.Error, lberr.Error()) - - return - } - - // generic error - span.RecordError(err) - span.SetStatus(codes.Error, err.Error()) - - return - } - - // Test for business error. Business errors are often - // successful requests carrying a business failure that - // the client can act upon and therefore do not count - // as failed requests. - if res, ok := response.(endpoint.Failer); ok && res.Failed() != nil { - span.RecordError(res.Failed()) - - if !cfg.IgnoreBusinessError { - span.SetStatus(codes.Error, res.Failed().Error()) - } - - return - } - // no errors identified - }() - - response, err = next(ctx, request) - - return - } - } -} diff --git a/instrumentation/github.com/go-kit/kit/otelkit/example/Dockerfile b/instrumentation/github.com/go-kit/kit/otelkit/example/Dockerfile deleted file mode 100644 index e6384a1e367..00000000000 --- a/instrumentation/github.com/go-kit/kit/otelkit/example/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright The OpenTelemetry 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. -FROM golang:alpine AS base -COPY . /src/ -WORKDIR /src/instrumentation/github.com/go-kit/kit/otelkit/example - -FROM base AS kit-server -RUN go install ./server.go -CMD ["/go/bin/server"] diff --git a/instrumentation/github.com/go-kit/kit/otelkit/example/README.md b/instrumentation/github.com/go-kit/kit/otelkit/example/README.md deleted file mode 100644 index b4b173eccb5..00000000000 --- a/instrumentation/github.com/go-kit/kit/otelkit/example/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# go-kit instrumentation example - -An HTTP server using go-kit and instrumentation. The server has a -`/users/{id:[0-9]+}` endpoint. The server generates span information to -`stdout`. - -These instructions expect you have -[docker-compose](https://docs.docker.com/compose/) installed. - -Bring up the `kit-server` and `kit-client` services to run the -example: - -```sh -docker-compose up --detach kit-server kit-client -``` - -The `kit-client` service sends just one HTTP request to `kit-server` -and then exits. View the span generated by `kit-server` in the logs: - -```sh -docker-compose logs kit-server -``` - -Shut down the services when you are finished with the example: - -```sh -docker-compose down -``` diff --git a/instrumentation/github.com/go-kit/kit/otelkit/example/docker-compose.yml b/instrumentation/github.com/go-kit/kit/otelkit/example/docker-compose.yml deleted file mode 100644 index 358caf5f27f..00000000000 --- a/instrumentation/github.com/go-kit/kit/otelkit/example/docker-compose.yml +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright The OpenTelemetry 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. -version: "3.7" -services: - kit-client: - image: golang:alpine - networks: - - example - command: - - "/bin/sh" - - "-c" - - "wget http://kit-server:8080/users/123 && cat 123" - depends_on: - - kit-server - kit-server: - build: - dockerfile: $PWD/Dockerfile - context: ../../../../../.. - ports: - - "8080:80" - command: - - "/bin/sh" - - "-c" - - "/go/bin/server" - networks: - - example -networks: - example: diff --git a/instrumentation/github.com/go-kit/kit/otelkit/example/go.mod b/instrumentation/github.com/go-kit/kit/otelkit/example/go.mod deleted file mode 100644 index b6f7bf56475..00000000000 --- a/instrumentation/github.com/go-kit/kit/otelkit/example/go.mod +++ /dev/null @@ -1,25 +0,0 @@ -// Deprecated: This module is no longer supported. -module go.opentelemetry.io/contrib/instrumentation/github.com/go-kit/kit/otelkit/example - -go 1.18 - -require ( - github.com/gorilla/mux v1.8.0 - go.opentelemetry.io/contrib/instrumentation/github.com/go-kit/kit/otelkit v0.43.0 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 -) - -require ( - github.com/go-kit/kit v0.13.0 // indirect - github.com/go-kit/log v0.2.0 // indirect - github.com/go-logfmt/logfmt v0.5.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect - golang.org/x/sys v0.11.0 // indirect -) - -replace go.opentelemetry.io/contrib/instrumentation/github.com/go-kit/kit/otelkit => ../ diff --git a/instrumentation/github.com/go-kit/kit/otelkit/example/go.sum b/instrumentation/github.com/go-kit/kit/otelkit/example/go.sum deleted file mode 100644 index efe071f22fb..00000000000 --- a/instrumentation/github.com/go-kit/kit/otelkit/example/go.sum +++ /dev/null @@ -1,30 +0,0 @@ -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/go-kit/kit v0.13.0 h1:OoneCcHKHQ03LfBpoQCUfCluwd2Vt3ohz+kvbJneZAU= -github.com/go-kit/kit v0.13.0/go.mod h1:phqEHMMUbyrCFCTgH48JueqrM3md2HcAZ8N3XE4FKDg= -github.com/go-kit/log v0.2.0 h1:7i2K3eKTos3Vc0enKCfnVcgHh2olr/MyfboYq7cAcFw= -github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= -github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -go.opentelemetry.io/otel v1.17.0 h1:MW+phZ6WZ5/uk2nd93ANk/6yJ+dVrvNWUjGhnnFU5jM= -go.opentelemetry.io/otel v1.17.0/go.mod h1:I2vmBGtFaODIVMBSTPVDlJSzBDNf93k60E6Ft0nyjo0= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.17.0 h1:Ut6hgtYcASHwCzRHkXEtSsM251cXJPW+Z9DyLwEn6iI= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.17.0/go.mod h1:TYeE+8d5CjrgBa0ZuRaDeMpIC1xZ7atg4g+nInjuSjc= -go.opentelemetry.io/otel/metric v1.17.0 h1:iG6LGVz5Gh+IuO0jmgvpTB6YVrCGngi8QGm+pMd8Pdc= -go.opentelemetry.io/otel/metric v1.17.0/go.mod h1:h4skoxdZI17AxwITdmdZjjYJQH5nzijUUjm+wtPph5o= -go.opentelemetry.io/otel/sdk v1.17.0 h1:FLN2X66Ke/k5Sg3V623Q7h7nt3cHXaW1FOvKKrW0IpE= -go.opentelemetry.io/otel/sdk v1.17.0/go.mod h1:U87sE0f5vQB7hwUoW98pW5Rz4ZDuCFBZFNUBlSgmDFQ= -go.opentelemetry.io/otel/trace v1.17.0 h1:/SWhSRHmDPOImIAetP1QAeMnZYiQXrTy4fMMYOdSKWQ= -go.opentelemetry.io/otel/trace v1.17.0/go.mod h1:I/4vKTgFclIsXRVucpH25X0mpFSczM7aHeaz0ZBLWjY= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/instrumentation/github.com/go-kit/kit/otelkit/example/server.go b/instrumentation/github.com/go-kit/kit/otelkit/example/server.go deleted file mode 100644 index cad14754631..00000000000 --- a/instrumentation/github.com/go-kit/kit/otelkit/example/server.go +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright The OpenTelemetry 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 main - -import ( - "context" - "fmt" - "log" - "net/http" - - "github.com/gorilla/mux" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - stdout "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" - "go.opentelemetry.io/otel/propagation" - sdktrace "go.opentelemetry.io/otel/sdk/trace" - oteltrace "go.opentelemetry.io/otel/trace" - - "go.opentelemetry.io/contrib/instrumentation/github.com/go-kit/kit/otelkit" //nolint:staticcheck // This is deprecated and will be removed in the next release. -) - -var tracer = otel.Tracer("kit-server") - -func main() { - tp, err := initTracer() - if err != nil { - log.Fatal(err) - } - defer func() { - if err := tp.Shutdown(context.Background()); err != nil { - log.Printf("Error shutting down tracer provider: %v", err) - } - }() - ep := otelkit.EndpointMiddleware( - otelkit.WithOperation("getUser"), - )(func(ctx context.Context, request interface{}) (response interface{}, err error) { - id := request.(string) - name := getUser(ctx, id) - reply := fmt.Sprintf("user %s (id %s)\n", name, id) - - return reply, nil - }) - r := mux.NewRouter() - r.HandleFunc("/users/{id:[0-9]+}", func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) - id := vars["id"] - reply, _ := ep(r.Context(), id) - _, _ = w.Write(([]byte)(reply.(string))) - }) - http.Handle("/", r) - _ = http.ListenAndServe(":8080", nil) -} - -func initTracer() (*sdktrace.TracerProvider, error) { - exporter, err := stdout.New(stdout.WithPrettyPrint()) - if err != nil { - return nil, err - } - tp := sdktrace.NewTracerProvider( - sdktrace.WithSampler(sdktrace.AlwaysSample()), - sdktrace.WithBatcher(exporter), - ) - otel.SetTracerProvider(tp) - otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{})) - return tp, err -} - -func getUser(ctx context.Context, id string) string { - _, span := tracer.Start(ctx, "getUser", oteltrace.WithAttributes(attribute.String("id", id))) - defer span.End() - if id == "123" { - return "otelmux tester" - } - return "unknown" -} diff --git a/instrumentation/github.com/go-kit/kit/otelkit/go.mod b/instrumentation/github.com/go-kit/kit/otelkit/go.mod deleted file mode 100644 index a8be07332ab..00000000000 --- a/instrumentation/github.com/go-kit/kit/otelkit/go.mod +++ /dev/null @@ -1,18 +0,0 @@ -// Deprecated: This module is no longer supported. -module go.opentelemetry.io/contrib/instrumentation/github.com/go-kit/kit/otelkit - -go 1.19 - -require ( - github.com/go-kit/kit v0.13.0 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 -) - -require ( - github.com/go-kit/log v0.2.0 // indirect - github.com/go-logfmt/logfmt v0.5.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect -) diff --git a/instrumentation/github.com/go-kit/kit/otelkit/go.sum b/instrumentation/github.com/go-kit/kit/otelkit/go.sum deleted file mode 100644 index dd9d2089f8e..00000000000 --- a/instrumentation/github.com/go-kit/kit/otelkit/go.sum +++ /dev/null @@ -1,22 +0,0 @@ -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/go-kit/kit v0.13.0 h1:OoneCcHKHQ03LfBpoQCUfCluwd2Vt3ohz+kvbJneZAU= -github.com/go-kit/kit v0.13.0/go.mod h1:phqEHMMUbyrCFCTgH48JueqrM3md2HcAZ8N3XE4FKDg= -github.com/go-kit/log v0.2.0 h1:7i2K3eKTos3Vc0enKCfnVcgHh2olr/MyfboYq7cAcFw= -github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -go.opentelemetry.io/otel v1.17.0 h1:MW+phZ6WZ5/uk2nd93ANk/6yJ+dVrvNWUjGhnnFU5jM= -go.opentelemetry.io/otel v1.17.0/go.mod h1:I2vmBGtFaODIVMBSTPVDlJSzBDNf93k60E6Ft0nyjo0= -go.opentelemetry.io/otel/metric v1.17.0 h1:iG6LGVz5Gh+IuO0jmgvpTB6YVrCGngi8QGm+pMd8Pdc= -go.opentelemetry.io/otel/metric v1.17.0/go.mod h1:h4skoxdZI17AxwITdmdZjjYJQH5nzijUUjm+wtPph5o= -go.opentelemetry.io/otel/trace v1.17.0 h1:/SWhSRHmDPOImIAetP1QAeMnZYiQXrTy4fMMYOdSKWQ= -go.opentelemetry.io/otel/trace v1.17.0/go.mod h1:I/4vKTgFclIsXRVucpH25X0mpFSczM7aHeaz0ZBLWjY= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/instrumentation/github.com/go-kit/kit/otelkit/test/doc.go b/instrumentation/github.com/go-kit/kit/otelkit/test/doc.go deleted file mode 100644 index 986a4bcc73f..00000000000 --- a/instrumentation/github.com/go-kit/kit/otelkit/test/doc.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright The OpenTelemetry 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 test validates the otelkit instrumentation with the default SDK. - -This package is in a separate module from the instrumentation it tests to -isolate the dependency of the default SDK and not impose this as a transitive -dependency for users. -*/ -package test // import "go.opentelemetry.io/contrib/instrumentation/github.com/go-kit/kit/otelkit/test" diff --git a/instrumentation/github.com/go-kit/kit/otelkit/test/endpoint_test.go b/instrumentation/github.com/go-kit/kit/otelkit/test/endpoint_test.go deleted file mode 100644 index 5bf7bc098da..00000000000 --- a/instrumentation/github.com/go-kit/kit/otelkit/test/endpoint_test.go +++ /dev/null @@ -1,264 +0,0 @@ -// Copyright The OpenTelemetry 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 test - -import ( - "context" - "testing" - - "github.com/go-kit/kit/endpoint" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/contrib/instrumentation/github.com/go-kit/kit/otelkit" //nolint:staticcheck // This is deprecated and will be removed in the next release. - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - sdktrace "go.opentelemetry.io/otel/sdk/trace" - "go.opentelemetry.io/otel/sdk/trace/tracetest" - "go.opentelemetry.io/otel/trace" -) - -type contextKey string - -const ( - operationKey = contextKey("operation") -) - -// compile time assertion. -var _ endpoint.Failer = failedResponse{} - -type customError struct { - message string -} - -func (e customError) Error() string { - return e.message -} - -type failedResponse struct { - err error -} - -func (r failedResponse) Failed() error { return r.err } - -func passEndpoint(_ context.Context, req interface{}) (interface{}, error) { - if err, _ := req.(error); err != nil { - return nil, err - } - return req, nil -} - -func TestEndpointMiddleware(t *testing.T) { - t.Run("GlobalTracer", func(t *testing.T) { - sr := tracetest.NewSpanRecorder() - otel.SetTracerProvider(sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sr))) - - mw := otelkit.EndpointMiddleware() - - e := func(ctx context.Context, _ interface{}) (interface{}, error) { - return nil, nil - } - - _, _ = mw(e)(context.Background(), nil) - assert.Len(t, sr.Ended(), 1) - }) - - t.Run("DefaultOperationAndAttributes", func(t *testing.T) { - sr := tracetest.NewSpanRecorder() - provider := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sr)) - - mw := otelkit.EndpointMiddleware( - otelkit.WithTracerProvider(provider), - otelkit.WithOperation("operation"), - otelkit.WithAttributes(attribute.String("key", "value")), - ) - - _, _ = mw(passEndpoint)(context.Background(), nil) - - spans := sr.Ended() - require.Len(t, spans, 1) - - span := spans[0] - - assert.Equal(t, "operation", span.Name()) - assert.Equal(t, trace.SpanKindServer, span.SpanKind()) - assert.Equal(t, codes.Unset, span.Status().Code) - assert.Contains(t, span.Attributes(), attribute.String("key", "value")) - }) - - t.Run("OperationAndAttributesFromContext", func(t *testing.T) { - sr := tracetest.NewSpanRecorder() - provider := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sr)) - - mw := otelkit.EndpointMiddleware( - otelkit.WithTracerProvider(provider), - otelkit.WithOperationGetter(func(ctx context.Context, name string) string { - operation, _ := ctx.Value(operationKey).(string) - - return operation - }), - otelkit.WithAttributeGetter(func(ctx context.Context) []attribute.KeyValue { - return []attribute.KeyValue{ - attribute.String("key", "value"), - } - }), - ) - - ctx := context.WithValue(context.Background(), operationKey, "operation") - - _, _ = mw(passEndpoint)(ctx, nil) - - spans := sr.Ended() - require.Len(t, spans, 1) - - span := spans[0] - - assert.Equal(t, "operation", span.Name()) - assert.Equal(t, trace.SpanKindServer, span.SpanKind()) - assert.Equal(t, codes.Unset, span.Status().Code) - assert.Contains(t, span.Attributes(), attribute.String("key", "value")) - }) - - t.Run("Overrides", func(t *testing.T) { - sr := tracetest.NewSpanRecorder() - provider := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sr)) - - mw := otelkit.EndpointMiddleware( - otelkit.WithTracerProvider(provider), - otelkit.WithOperation("operations"), - otelkit.WithOperationGetter(func(ctx context.Context, name string) string { - operation, _ := ctx.Value(operationKey).(string) - - return operation - }), - otelkit.WithAttributes(attribute.String("key", "value")), - otelkit.WithAttributeGetter(func(ctx context.Context) []attribute.KeyValue { - return []attribute.KeyValue{ - attribute.String("key2", "value2"), - } - }), - ) - - ctx := context.WithValue(context.Background(), operationKey, "other_operation") - - _, _ = mw(passEndpoint)(ctx, nil) - - spans := sr.Ended() - require.Len(t, spans, 1) - - span := spans[0] - - assert.Equal(t, "other_operation", span.Name()) - assert.Equal(t, trace.SpanKindServer, span.SpanKind()) - assert.Equal(t, codes.Unset, span.Status().Code) - assert.Contains(t, span.Attributes(), attribute.String("key", "value")) - assert.Contains(t, span.Attributes(), attribute.String("key2", "value2")) - }) - - t.Run("Error", func(t *testing.T) { - sr := tracetest.NewSpanRecorder() - provider := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sr)) - - mw := otelkit.EndpointMiddleware( - otelkit.WithTracerProvider(provider), - ) - - ctx := context.Background() - - _, _ = mw(func(_ context.Context, req interface{}) (interface{}, error) { - return nil, customError{"something went wrong"} - })(ctx, nil) - - spans := sr.Ended() - require.Len(t, spans, 1) - - span := spans[0] - - assert.Equal(t, "gokit/endpoint", span.Name()) - assert.Equal(t, trace.SpanKindServer, span.SpanKind()) - assert.Equal(t, codes.Error, span.Status().Code) - - events := span.Events() - require.Len(t, events, 1) - - assert.Equal(t, "exception", events[0].Name) - assert.Contains(t, events[0].Attributes, attribute.String("exception.type", "go.opentelemetry.io/contrib/instrumentation/github.com/go-kit/kit/otelkit/test.customError")) - assert.Contains(t, events[0].Attributes, attribute.String("exception.message", "something went wrong")) - }) - - t.Run("BusinessError", func(t *testing.T) { - sr := tracetest.NewSpanRecorder() - provider := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sr)) - - mw := otelkit.EndpointMiddleware( - otelkit.WithTracerProvider(provider), - ) - - ctx := context.Background() - - _, _ = mw(func(_ context.Context, req interface{}) (interface{}, error) { - return failedResponse{err: customError{"some business error"}}, nil - })(ctx, nil) - - spans := sr.Ended() - require.Len(t, spans, 1) - - span := spans[0] - - assert.Equal(t, "gokit/endpoint", span.Name()) - assert.Equal(t, trace.SpanKindServer, span.SpanKind()) - assert.Equal(t, codes.Error, span.Status().Code) - - events := span.Events() - require.Len(t, events, 1) - - assert.Equal(t, "exception", events[0].Name) - assert.Contains(t, events[0].Attributes, attribute.String("exception.type", "go.opentelemetry.io/contrib/instrumentation/github.com/go-kit/kit/otelkit/test.customError")) - assert.Contains(t, events[0].Attributes, attribute.String("exception.message", "some business error")) - }) - - t.Run("IgnoredBusinessError", func(t *testing.T) { - sr := tracetest.NewSpanRecorder() - provider := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sr)) - - mw := otelkit.EndpointMiddleware( - otelkit.WithTracerProvider(provider), - otelkit.WithIgnoreBusinessError(true), - ) - - ctx := context.Background() - - _, _ = mw(func(_ context.Context, req interface{}) (interface{}, error) { - return failedResponse{err: customError{"some business error"}}, nil - })(ctx, nil) - - spans := sr.Ended() - require.Len(t, spans, 1) - - span := spans[0] - - assert.Equal(t, "gokit/endpoint", span.Name()) - assert.Equal(t, trace.SpanKindServer, span.SpanKind()) - assert.Equal(t, codes.Unset, span.Status().Code) - - events := span.Events() - require.Len(t, events, 1) - - assert.Equal(t, "exception", events[0].Name) - assert.Contains(t, events[0].Attributes, attribute.String("exception.type", "go.opentelemetry.io/contrib/instrumentation/github.com/go-kit/kit/otelkit/test.customError")) - assert.Contains(t, events[0].Attributes, attribute.String("exception.message", "some business error")) - }) -} diff --git a/instrumentation/github.com/go-kit/kit/otelkit/test/go.mod b/instrumentation/github.com/go-kit/kit/otelkit/test/go.mod deleted file mode 100644 index 520d4f209bf..00000000000 --- a/instrumentation/github.com/go-kit/kit/otelkit/test/go.mod +++ /dev/null @@ -1,29 +0,0 @@ -module go.opentelemetry.io/contrib/instrumentation/github.com/go-kit/kit/otelkit/test - -go 1.19 - -require ( - github.com/go-kit/kit v0.13.0 - github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/contrib/instrumentation/github.com/go-kit/kit/otelkit v0.43.0 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 -) - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-kit/log v0.2.0 // indirect - github.com/go-logfmt/logfmt v0.5.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/kr/text v0.2.0 // indirect - github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect - golang.org/x/sys v0.11.0 // indirect - gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) - -replace go.opentelemetry.io/contrib/instrumentation/github.com/go-kit/kit/otelkit => ../ diff --git a/instrumentation/github.com/go-kit/kit/otelkit/test/go.sum b/instrumentation/github.com/go-kit/kit/otelkit/test/go.sum deleted file mode 100644 index b2263989331..00000000000 --- a/instrumentation/github.com/go-kit/kit/otelkit/test/go.sum +++ /dev/null @@ -1,40 +0,0 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-kit/kit v0.13.0 h1:OoneCcHKHQ03LfBpoQCUfCluwd2Vt3ohz+kvbJneZAU= -github.com/go-kit/kit v0.13.0/go.mod h1:phqEHMMUbyrCFCTgH48JueqrM3md2HcAZ8N3XE4FKDg= -github.com/go-kit/log v0.2.0 h1:7i2K3eKTos3Vc0enKCfnVcgHh2olr/MyfboYq7cAcFw= -github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -go.opentelemetry.io/otel v1.17.0 h1:MW+phZ6WZ5/uk2nd93ANk/6yJ+dVrvNWUjGhnnFU5jM= -go.opentelemetry.io/otel v1.17.0/go.mod h1:I2vmBGtFaODIVMBSTPVDlJSzBDNf93k60E6Ft0nyjo0= -go.opentelemetry.io/otel/metric v1.17.0 h1:iG6LGVz5Gh+IuO0jmgvpTB6YVrCGngi8QGm+pMd8Pdc= -go.opentelemetry.io/otel/metric v1.17.0/go.mod h1:h4skoxdZI17AxwITdmdZjjYJQH5nzijUUjm+wtPph5o= -go.opentelemetry.io/otel/sdk v1.17.0 h1:FLN2X66Ke/k5Sg3V623Q7h7nt3cHXaW1FOvKKrW0IpE= -go.opentelemetry.io/otel/sdk v1.17.0/go.mod h1:U87sE0f5vQB7hwUoW98pW5Rz4ZDuCFBZFNUBlSgmDFQ= -go.opentelemetry.io/otel/trace v1.17.0 h1:/SWhSRHmDPOImIAetP1QAeMnZYiQXrTy4fMMYOdSKWQ= -go.opentelemetry.io/otel/trace v1.17.0/go.mod h1:I/4vKTgFclIsXRVucpH25X0mpFSczM7aHeaz0ZBLWjY= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/instrumentation/github.com/go-kit/kit/otelkit/test/version.go b/instrumentation/github.com/go-kit/kit/otelkit/test/version.go deleted file mode 100644 index 7d3ce3b8d3a..00000000000 --- a/instrumentation/github.com/go-kit/kit/otelkit/test/version.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright The OpenTelemetry 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 test // import "go.opentelemetry.io/contrib/instrumentation/github.com/go-kit/kit/otelkit/test" - -// Version is the current release version of the go-kit instrumentation test module. -func Version() string { - return "0.43.0" - // This string is updated by the pre_release.sh script during release -} - -// SemVersion is the semantic version to be supplied to tracer/meter creation. -// -// Deprecated: Use [Version] instead. -func SemVersion() string { - return Version() -} diff --git a/instrumentation/github.com/go-kit/kit/otelkit/version.go b/instrumentation/github.com/go-kit/kit/otelkit/version.go deleted file mode 100644 index d97ff3f5c84..00000000000 --- a/instrumentation/github.com/go-kit/kit/otelkit/version.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright The OpenTelemetry 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 otelkit // import "go.opentelemetry.io/contrib/instrumentation/github.com/go-kit/kit/otelkit" - -// Version is the current release version of the go-kit instrumentation. -func Version() string { - return "0.43.0" - // This string is updated by the pre_release.sh script during release -} - -// SemVersion is the semantic version to be supplied to tracer/meter creation. -// -// Deprecated: Use [Version] instead. -func SemVersion() string { - return Version() -} diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/config.go b/instrumentation/github.com/gocql/gocql/otelgocql/config.go deleted file mode 100644 index 5374f3b03cb..00000000000 --- a/instrumentation/github.com/gocql/gocql/otelgocql/config.go +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright The OpenTelemetry 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 otelgocql // import "go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql" - -import ( - "github.com/gocql/gocql" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/trace" -) - -type config struct { - tracerProvider trace.TracerProvider - meterProvider metric.MeterProvider - instrumentQuery bool - instrumentBatch bool - instrumentConnect bool - queryObserver gocql.QueryObserver - batchObserver gocql.BatchObserver - connectObserver gocql.ConnectObserver -} - -// Option applies a configuration option. -type Option interface { - apply(*config) -} - -type optionFunc func(*config) - -func (o optionFunc) apply(c *config) { - o(c) -} - -// WithQueryObserver sets an additional QueryObserver to the session configuration. Use this if -// there is an existing QueryObserver that you would like called. It will be called after the -// OpenTelemetry implementation, if it is not nil. Defaults to nil. -func WithQueryObserver(observer gocql.QueryObserver) Option { - return optionFunc(func(cfg *config) { - cfg.queryObserver = observer - }) -} - -// WithBatchObserver sets an additional BatchObserver to the session configuration. Use this if -// there is an existing BatchObserver that you would like called. It will be called after the -// OpenTelemetry implementation, if it is not nil. Defaults to nil. -func WithBatchObserver(observer gocql.BatchObserver) Option { - return optionFunc(func(cfg *config) { - cfg.batchObserver = observer - }) -} - -// WithConnectObserver sets an additional ConnectObserver to the session configuration. Use this if -// there is an existing ConnectObserver that you would like called. It will be called after the -// OpenTelemetry implementation, if it is not nil. Defaults to nil. -func WithConnectObserver(observer gocql.ConnectObserver) Option { - return optionFunc(func(cfg *config) { - cfg.connectObserver = observer - }) -} - -// WithTracerProvider will set the trace provider used to get a tracer -// for creating spans. Defaults to TracerProvider(). -func WithTracerProvider(provider trace.TracerProvider) Option { - return optionFunc(func(c *config) { - if provider != nil { - c.tracerProvider = provider - } - }) -} - -// WithMeterProvider will set the meter provider used to get a meter -// for creating instruments. -// Defaults to global.GetMeterProvider(). -func WithMeterProvider(provider metric.MeterProvider) Option { - return optionFunc(func(c *config) { - if provider != nil { - c.meterProvider = provider - } - }) -} - -// WithQueryInstrumentation will enable and disable instrumentation of -// queries. Defaults to enabled. -func WithQueryInstrumentation(enabled bool) Option { - return optionFunc(func(cfg *config) { - cfg.instrumentQuery = enabled - }) -} - -// WithBatchInstrumentation will enable and disable insturmentation of -// batch queries. Defaults to enabled. -func WithBatchInstrumentation(enabled bool) Option { - return optionFunc(func(cfg *config) { - cfg.instrumentBatch = enabled - }) -} - -// WithConnectInstrumentation will enable and disable instrumentation of -// connection attempts. Defaults to enabled. -func WithConnectInstrumentation(enabled bool) Option { - return optionFunc(func(cfg *config) { - cfg.instrumentConnect = enabled - }) -} - -func newConfig(options ...Option) *config { - cfg := &config{ - tracerProvider: otel.GetTracerProvider(), - meterProvider: otel.GetMeterProvider(), - instrumentQuery: true, - instrumentBatch: true, - instrumentConnect: true, - } - - for _, apply := range options { - apply.apply(cfg) - } - - return cfg -} diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/doc.go b/instrumentation/github.com/gocql/gocql/otelgocql/doc.go deleted file mode 100644 index b15c5354603..00000000000 --- a/instrumentation/github.com/gocql/gocql/otelgocql/doc.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright The OpenTelemetry 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 otelgocql instruments the github.com/gocql/gocql package. -// -// Deprecated: This module is no longer supported. -package otelgocql // import "go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql" diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/example/README.md b/instrumentation/github.com/gocql/gocql/otelgocql/example/README.md deleted file mode 100644 index a2c7683f15f..00000000000 --- a/instrumentation/github.com/gocql/gocql/otelgocql/example/README.md +++ /dev/null @@ -1,18 +0,0 @@ -## Integration Example - -### To run the example: -1. `cd` into the example directory. -2. Run `docker-compose up`. -3. Wait for cassandra to listen for cql clients with the following message in the logs: - -``` -Server.java:159 - Starting listening for CQL clients on /0.0.0.0:9042 (unencrypted)... -``` - -4. Run the example using `go run .`. - -5. You can view the spans in the browser at `localhost:9411` and the metrics at `localhost:2222`. - -### When you're done: -1. `ctrl+c` to stop the example program. -2. `docker-compose down` to stop cassandra and zipkin. diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/example/client.go b/instrumentation/github.com/gocql/gocql/otelgocql/example/client.go deleted file mode 100644 index 9349e7be0da..00000000000 --- a/instrumentation/github.com/gocql/gocql/otelgocql/example/client.go +++ /dev/null @@ -1,234 +0,0 @@ -// Copyright The OpenTelemetry 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. - -//go:build go1.18 -// +build go1.18 - -package main - -// This example will create the keyspace -// "gocql_integration_example" and a single table -// with the following schema: -// gocql_integration_example.book -// id UUID -// title text -// author_first_name text -// author_last_name text -// PRIMARY KEY(id) -// The example will insert fictional books into the database and -// then truncate the table. - -import ( - "context" - "fmt" - "log" - "net/http" - "os" - "os/signal" - "sync" - "time" - - "github.com/gocql/gocql" - "github.com/prometheus/client_golang/prometheus/promhttp" - - "go.opentelemetry.io/otel" - otelprom "go.opentelemetry.io/otel/exporters/prometheus" - "go.opentelemetry.io/otel/exporters/zipkin" - "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/trace" - - "go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql" //nolint:staticcheck // This is deprecated and will be removed in the next release. -) - -const keyspace = "gocql_integration_example" - -var wg sync.WaitGroup - -func main() { - if err := initMetrics(); err != nil { - log.Fatalf("failed to install metric exporter, %v", err) - } - tp, err := initTracer() - if err != nil { - log.Fatalf("failed to create zipkin exporter: %s", err) - } - defer func() { tp.Shutdown(context.Background()) }() //nolint:revive,errcheck - if err := initDb(); err != nil { - log.Fatal(err) - } - - ctx, span := otel.Tracer( - "go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql/example", - ).Start(context.Background(), "begin example") - - cluster := getCluster() - // Create a session to begin making queries - session, err := otelgocql.NewSessionWithTracing( - ctx, - cluster, - ) - if err != nil { - log.Fatalf("failed to create a session, %v", err) - } - defer session.Close() - - batch := session.NewBatch(gocql.LoggedBatch) - for i := 0; i < 500; i++ { - batch.Query( - "INSERT INTO book (id, title, author_first_name, author_last_name) VALUES (?, ?, ?, ?)", - gocql.TimeUUID(), - fmt.Sprintf("Example Book %d", i), - "firstName", - "lastName", - ) - } - if err := session.ExecuteBatch(batch.WithContext(ctx)); err != nil { - log.Printf("failed to batch insert, %v", err) - } - - res := session.Query( - "SELECT title, author_first_name, author_last_name from book WHERE author_last_name = ?", - "lastName", - ).WithContext(ctx).PageSize(100).Iter() - - var ( - title string - firstName string - lastName string - ) - - for res.Scan(&title, &firstName, &lastName) { - res.Scan(&title, &firstName, &lastName) - } - - res.Close() - - if err = session.Query("truncate table book").WithContext(ctx).Exec(); err != nil { - log.Printf("failed to delete data, %v", err) - } - - span.End() - - wg.Wait() -} - -func views() []metric.View { - return []metric.View{ - metric.NewView( - metric.Instrument{ - Name: "db.cassandra.rows", - }, - metric.Stream{ - Aggregation: metric.AggregationExplicitBucketHistogram{ - Boundaries: []float64{0.001, 0.01, 0.1, 0.5, 1, 2, 5, 10}, - }, - }, - ), - metric.NewView( - metric.Instrument{Name: "db.cassandra.latency"}, - metric.Stream{ - Aggregation: metric.AggregationExplicitBucketHistogram{ - Boundaries: []float64{0.001, 0.01, 0.1, 0.5, 1, 2, 5, 10}, - }, - }, - ), - } -} - -func initMetrics() error { - vs := views() - - exporter, err := otelprom.New() - if err != nil { - return err - } - provider := metric.NewMeterProvider( - metric.WithReader(exporter), - metric.WithView(vs...), - ) - otel.SetMeterProvider(provider) - - http.Handle("/", promhttp.Handler()) - log.Print("Serving metrics at :2222/") - go func() { - err := http.ListenAndServe(":2222", nil) - if err != nil { - log.Print(err) - } - }() - - ctx, _ := signal.NotifyContext(context.Background(), os.Interrupt) - wg.Add(1) - go func() { - defer wg.Done() - <-ctx.Done() - err := provider.Shutdown(context.Background()) - if err != nil { - log.Printf("error stopping MeterProvider: %s", err) - } - }() - return nil -} - -func initTracer() (*trace.TracerProvider, error) { - exporter, err := zipkin.New("http://localhost:9411/api/v2/spans") - if err != nil { - return nil, err - } - - tp := trace.NewTracerProvider(trace.WithBatcher(exporter)) - otel.SetTracerProvider(tp) - - return tp, nil -} - -func initDb() error { - cluster := gocql.NewCluster("127.0.0.1") - cluster.Keyspace = "system" - cluster.Consistency = gocql.LocalQuorum - cluster.Timeout = time.Second * 2 - session, err := cluster.CreateSession() - if err != nil { - return err - } - stmt := fmt.Sprintf( - "create keyspace if not exists %s with replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }", - keyspace, - ) - if err := session.Query(stmt).Exec(); err != nil { - return err - } - - cluster.Keyspace = keyspace - session, err = cluster.CreateSession() - if err != nil { - return err - } - - stmt = "create table if not exists book(id UUID, title text, author_first_name text, author_last_name text, PRIMARY KEY(id))" - if err = session.Query(stmt).Exec(); err != nil { - return err - } - - return session.Query("create index if not exists on book(author_last_name)").Exec() -} - -func getCluster() *gocql.ClusterConfig { - cluster := gocql.NewCluster("127.0.0.1") - cluster.Keyspace = keyspace - cluster.Consistency = gocql.LocalQuorum - cluster.ProtoVersion = 3 - cluster.Timeout = 2 * time.Second - return cluster -} diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/example/doc.go b/instrumentation/github.com/gocql/gocql/otelgocql/example/doc.go deleted file mode 100644 index a57be4f3412..00000000000 --- a/instrumentation/github.com/gocql/gocql/otelgocql/example/doc.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright The OpenTelemetry 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 main provides an example use of the otelgocql instrumentation. -// -// Deprecated: This module is no longer supported. -package main diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/example/docker-compose.yml b/instrumentation/github.com/gocql/gocql/otelgocql/example/docker-compose.yml deleted file mode 100644 index e9eaeb86b91..00000000000 --- a/instrumentation/github.com/gocql/gocql/otelgocql/example/docker-compose.yml +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright The OpenTelemetry 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. - -version: '3' -services: - cassandra: - image: cassandra:3 - ports: - - 9042:9042 - zipkin: - image: openzipkin/zipkin:2 - ports: - - 9411:9411 diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/example/go.mod b/instrumentation/github.com/gocql/gocql/otelgocql/example/go.mod deleted file mode 100644 index 2ecc4c394dc..00000000000 --- a/instrumentation/github.com/gocql/gocql/otelgocql/example/go.mod +++ /dev/null @@ -1,37 +0,0 @@ -// Deprecated: This module is no longer supported. -module go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql/example - -go 1.18 - -replace go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql => ../ - -require ( - github.com/gocql/gocql v1.6.0 - github.com/prometheus/client_golang v1.16.0 - go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql v0.43.0 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/exporters/prometheus v0.40.0 - go.opentelemetry.io/otel/exporters/zipkin v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/sdk/metric v0.40.0 -) - -require ( - github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/go-logr/logr v1.2.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect - github.com/golang/snappy v0.0.4 // indirect - github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/openzipkin/zipkin-go v0.4.2 // indirect - github.com/prometheus/client_model v0.4.0 // indirect - github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.10.1 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect - go.opentelemetry.io/otel/trace v1.17.0 // indirect - golang.org/x/sys v0.11.0 // indirect - google.golang.org/protobuf v1.31.0 // indirect - gopkg.in/inf.v0 v0.9.1 // indirect -) diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/example/go.sum b/instrumentation/github.com/gocql/gocql/otelgocql/example/go.sum deleted file mode 100644 index 2863c4f92d3..00000000000 --- a/instrumentation/github.com/gocql/gocql/otelgocql/example/go.sum +++ /dev/null @@ -1,76 +0,0 @@ -github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 h1:mXoPYz/Ul5HYEDvkta6I8/rnYM5gSdSV2tJ6XbZuEtY= -github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k= -github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= -github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/gocql/gocql v1.6.0 h1:IdFdOTbnpbd0pDhl4REKQDM+Q0SzKXQ1Yh+YZZ8T/qU= -github.com/gocql/gocql v1.6.0/go.mod h1:3gM2c4D3AnkISwBxGnMMsS8Oy4y2lhbPRsH4xnJrHG8= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8= -github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= -github.com/openzipkin/zipkin-go v0.4.2 h1:zjqfqHjUpPmB3c1GlCvvgsM1G4LkvqQbBDueDOCg/jA= -github.com/openzipkin/zipkin-go v0.4.2/go.mod h1:ZeVkFjuuBiSy13y8vpSDCjMi9GoI3hPpCJSBx/EYFhY= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= -github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= -github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= -github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= -github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= -github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= -github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= -github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -go.opentelemetry.io/otel v1.17.0 h1:MW+phZ6WZ5/uk2nd93ANk/6yJ+dVrvNWUjGhnnFU5jM= -go.opentelemetry.io/otel v1.17.0/go.mod h1:I2vmBGtFaODIVMBSTPVDlJSzBDNf93k60E6Ft0nyjo0= -go.opentelemetry.io/otel/exporters/prometheus v0.40.0 h1:9h6lCssr1j5aYVvWT6oc+ERB6R034zmsHjBRLyxrAR8= -go.opentelemetry.io/otel/exporters/prometheus v0.40.0/go.mod h1:5USWZ0ovyQB5CIM3IO3bGRSoDPMXiT3t+15gu8Zo9HQ= -go.opentelemetry.io/otel/exporters/zipkin v1.17.0 h1:oi5+xMN3pflqWSd4EX6FiO+Cn3KbFBBzeQmD5LMIf0c= -go.opentelemetry.io/otel/exporters/zipkin v1.17.0/go.mod h1:pNir+S6/f0HFGfbXhobXLTFu60KtAzw8aGSUpt9A6VU= -go.opentelemetry.io/otel/metric v1.17.0 h1:iG6LGVz5Gh+IuO0jmgvpTB6YVrCGngi8QGm+pMd8Pdc= -go.opentelemetry.io/otel/metric v1.17.0/go.mod h1:h4skoxdZI17AxwITdmdZjjYJQH5nzijUUjm+wtPph5o= -go.opentelemetry.io/otel/sdk v1.17.0 h1:FLN2X66Ke/k5Sg3V623Q7h7nt3cHXaW1FOvKKrW0IpE= -go.opentelemetry.io/otel/sdk v1.17.0/go.mod h1:U87sE0f5vQB7hwUoW98pW5Rz4ZDuCFBZFNUBlSgmDFQ= -go.opentelemetry.io/otel/sdk/metric v0.40.0 h1:qOM29YaGcxipWjL5FzpyZDpCYrDREvX0mVlmXdOjCHU= -go.opentelemetry.io/otel/sdk/metric v0.40.0/go.mod h1:dWxHtdzdJvg+ciJUKLTKwrMe5P6Dv3FyDbh8UkfgkVs= -go.opentelemetry.io/otel/trace v1.17.0 h1:/SWhSRHmDPOImIAetP1QAeMnZYiQXrTy4fMMYOdSKWQ= -go.opentelemetry.io/otel/trace v1.17.0/go.mod h1:I/4vKTgFclIsXRVucpH25X0mpFSczM7aHeaz0ZBLWjY= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= -gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/example_session_test.go b/instrumentation/github.com/gocql/gocql/otelgocql/example_session_test.go deleted file mode 100644 index ca2ea61bb42..00000000000 --- a/instrumentation/github.com/gocql/gocql/otelgocql/example_session_test.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright The OpenTelemetry 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 otelgocql - -import ( - "context" - "log" - - "github.com/gocql/gocql" -) - -func ExampleNewSessionWithTracing() { - // Create a cluster - host := "localhost" - cluster := gocql.NewCluster(host) - - // Create a session with tracing - _, err := NewSessionWithTracing( - context.Background(), - cluster, - // Include any options here - ) - - if err != nil { - log.Fatalf("failed to create session, %v", err) - } - - // Begin using the session -} diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/go.mod b/instrumentation/github.com/gocql/gocql/otelgocql/go.mod deleted file mode 100644 index fad543eb542..00000000000 --- a/instrumentation/github.com/gocql/gocql/otelgocql/go.mod +++ /dev/null @@ -1,23 +0,0 @@ -// Deprecated: This module is no longer supported. -module go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql - -go 1.19 - -require ( - github.com/gocql/gocql v1.6.0 - github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/metric v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 -) - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/snappy v0.0.3 // indirect - github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - gopkg.in/inf.v0 v0.9.1 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/go.sum b/instrumentation/github.com/gocql/gocql/otelgocql/go.sum deleted file mode 100644 index 9b174db8bc2..00000000000 --- a/instrumentation/github.com/gocql/gocql/otelgocql/go.sum +++ /dev/null @@ -1,42 +0,0 @@ -github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 h1:mXoPYz/Ul5HYEDvkta6I8/rnYM5gSdSV2tJ6XbZuEtY= -github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k= -github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= -github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/gocql/gocql v1.6.0 h1:IdFdOTbnpbd0pDhl4REKQDM+Q0SzKXQ1Yh+YZZ8T/qU= -github.com/gocql/gocql v1.6.0/go.mod h1:3gM2c4D3AnkISwBxGnMMsS8Oy4y2lhbPRsH4xnJrHG8= -github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= -github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8= -github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -go.opentelemetry.io/otel v1.17.0 h1:MW+phZ6WZ5/uk2nd93ANk/6yJ+dVrvNWUjGhnnFU5jM= -go.opentelemetry.io/otel v1.17.0/go.mod h1:I2vmBGtFaODIVMBSTPVDlJSzBDNf93k60E6Ft0nyjo0= -go.opentelemetry.io/otel/metric v1.17.0 h1:iG6LGVz5Gh+IuO0jmgvpTB6YVrCGngi8QGm+pMd8Pdc= -go.opentelemetry.io/otel/metric v1.17.0/go.mod h1:h4skoxdZI17AxwITdmdZjjYJQH5nzijUUjm+wtPph5o= -go.opentelemetry.io/otel/trace v1.17.0 h1:/SWhSRHmDPOImIAetP1QAeMnZYiQXrTy4fMMYOdSKWQ= -go.opentelemetry.io/otel/trace v1.17.0/go.mod h1:I/4vKTgFclIsXRVucpH25X0mpFSczM7aHeaz0ZBLWjY= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= -gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/gocql.go b/instrumentation/github.com/gocql/gocql/otelgocql/gocql.go deleted file mode 100644 index f3ce5acd595..00000000000 --- a/instrumentation/github.com/gocql/gocql/otelgocql/gocql.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright The OpenTelemetry 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 otelgocql // import "go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql" - -import ( - "context" - - "github.com/gocql/gocql" - - "go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql/internal" - "go.opentelemetry.io/otel/trace" -) - -// NewSessionWithTracing creates a new session using the given cluster -// configuration enabling tracing for queries, batch queries, and connection attempts. -// You may use additional observers and disable specific tracing using the provided `TracedSessionOption`s. -func NewSessionWithTracing(ctx context.Context, cluster *gocql.ClusterConfig, options ...Option) (*gocql.Session, error) { - cfg := newConfig(options...) - instruments := newInstruments(cfg.meterProvider) - tracer := cfg.tracerProvider.Tracer( - internal.InstrumentationName, - trace.WithInstrumentationVersion(Version()), - ) - cluster.QueryObserver = &OTelQueryObserver{ - enabled: cfg.instrumentQuery, - observer: cfg.queryObserver, - tracer: tracer, - inst: instruments, - } - cluster.BatchObserver = &OTelBatchObserver{ - enabled: cfg.instrumentBatch, - observer: cfg.batchObserver, - tracer: tracer, - inst: instruments, - } - cluster.ConnectObserver = &OTelConnectObserver{ - ctx: ctx, - enabled: cfg.instrumentConnect, - observer: cfg.connectObserver, - tracer: tracer, - inst: instruments, - } - return cluster.CreateSession() -} diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/gocql_test.go b/instrumentation/github.com/gocql/gocql/otelgocql/gocql_test.go deleted file mode 100644 index cb97331d49e..00000000000 --- a/instrumentation/github.com/gocql/gocql/otelgocql/gocql_test.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright The OpenTelemetry 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 otelgocql - -import ( - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql/internal" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" -) - -func TestHostOrIP(t *testing.T) { - hostAndPort := "127.0.0.1:9042" - attribute := internal.HostOrIP(hostAndPort) - assert.Equal(t, semconv.NetSockPeerAddrKey, attribute.Key) - assert.Equal(t, "127.0.0.1", attribute.Value.AsString()) - - hostAndPort = "exampleHost:9042" - attribute = internal.HostOrIP(hostAndPort) - assert.Equal(t, semconv.NetPeerNameKey, attribute.Key) - assert.Equal(t, "exampleHost", attribute.Value.AsString()) - - hostAndPort = "invalid-host-and-port-string" - attribute = internal.HostOrIP(hostAndPort) - require.Empty(t, attribute.Value.AsString()) -} diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/instrument.go b/instrumentation/github.com/gocql/gocql/otelgocql/instrument.go deleted file mode 100644 index 3808c424978..00000000000 --- a/instrumentation/github.com/gocql/gocql/otelgocql/instrument.go +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright The OpenTelemetry 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 otelgocql // import "go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql" - -import ( - "log" - - "go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql/internal" - "go.opentelemetry.io/otel/metric" -) - -type instruments struct { - // queryCount is the number of queries executed. - queryCount metric.Int64Counter - - // queryRows is the number of rows returned by a query. - queryRows metric.Int64Histogram - - // batchCount is the number of batch queries executed. - batchCount metric.Int64Counter - - // connectionCount is the number of connections made - // with the traced session. - connectionCount metric.Int64Counter - - // latency is the sum of attempt latencies. - latency metric.Int64Histogram -} - -// newInstruments will create instruments using a meter -// from the given provider p. -func newInstruments(p metric.MeterProvider) *instruments { - meter := p.Meter( - internal.InstrumentationName, - metric.WithInstrumentationVersion(Version()), - ) - instruments := &instruments{} - var err error - - if instruments.queryCount, err = meter.Int64Counter( - "db.cassandra.queries", - metric.WithDescription("Number queries executed"), - ); err != nil { - log.Printf("failed to create iQueryCount instrument, %v", err) - } - - if instruments.queryRows, err = meter.Int64Histogram( - "db.cassandra.rows", - metric.WithDescription("Number of rows returned from query"), - ); err != nil { - log.Printf("failed to create iQueryRows instrument, %v", err) - } - - if instruments.batchCount, err = meter.Int64Counter( - "db.cassandra.batch.queries", - metric.WithDescription("Number of batch queries executed"), - ); err != nil { - log.Printf("failed to create iBatchCount instrument, %v", err) - } - - if instruments.connectionCount, err = meter.Int64Counter( - "db.cassandra.connections", - metric.WithDescription("Number of connections created"), - ); err != nil { - log.Printf("failed to create iConnectionCount instrument, %v", err) - } - - if instruments.latency, err = meter.Int64Histogram( - "db.cassandra.latency", - metric.WithDescription("Sum of latency to host in milliseconds"), - metric.WithUnit("ms"), - ); err != nil { - log.Printf("failed to create iLatency instrument, %v", err) - } - - return instruments -} diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/internal/cass.go b/instrumentation/github.com/gocql/gocql/otelgocql/internal/cass.go deleted file mode 100644 index 8867e368f10..00000000000 --- a/instrumentation/github.com/gocql/gocql/otelgocql/internal/cass.go +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright The OpenTelemetry 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.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql/internal" - -import ( - "log" - "net" - - "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" -) - -const ( - // CassVersionKey is the key for the attribute/label describing - // the cql version. - CassVersionKey = attribute.Key("db.cassandra.version") - - // CassHostIDKey is the key for the attribute/label describing the id - // of the host being queried. - CassHostIDKey = attribute.Key("db.cassandra.host.id") - - // CassHostStateKey is the key for the attribute/label describing - // the state of the casssandra server hosting the node being queried. - CassHostStateKey = attribute.Key("db.cassandra.host.state") - - // CassBatchQueriesKey is the key for the attribute describing - // the number of queries contained within the batch statement. - CassBatchQueriesKey = attribute.Key("db.cassandra.batch.queries") - - // CassErrMsgKey is the key for the attribute/label describing - // the error message from an error encountered when executing a query, batch, - // or connection attempt to the cassandra server. - CassErrMsgKey = attribute.Key("db.cassandra.error.message") - - // CassRowsReturnedKey is the key for the span attribute describing the number of rows - // returned on a query to the database. - CassRowsReturnedKey = attribute.Key("db.cassandra.rows.returned") - - // CassQueryAttemptsKey is the key for the span attribute describing the number of attempts - // made for the query in question. - CassQueryAttemptsKey = attribute.Key("db.cassandra.attempts") - - // CassBatchQueryName is the batch operation span name. - CassBatchQueryName = "Batch Query" - // CassConnectName is the connect operation span name. - CassConnectName = "New Connection" - - // InstrumentationName is the name of the instrumentation package. - InstrumentationName = "go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql" -) - -// ------------------------------------------ Connection-level Attributes - -// CassDBSystem returns the name of the DB system, -// cassandra, as a KeyValue pair (db.system). -func CassDBSystem() attribute.KeyValue { - return semconv.DBSystemCassandra -} - -// CassPeerName returns the hostname of the cassandra -// server as a semconv KeyValue pair (net.peer.name). -func CassPeerName(name string) attribute.KeyValue { - return semconv.NetPeerName(name) -} - -// CassPeerPort returns the port number of the cassandra -// server as a semconv KeyValue pair (net.peer.port). -func CassPeerPort(port int) attribute.KeyValue { - return semconv.NetPeerPort(port) -} - -// CassPeerIP returns the IP address of the cassandra -// server as a semconv KeyValue pair (net.peer.ip). -func CassPeerIP(ip string) attribute.KeyValue { - return semconv.NetSockPeerAddr(ip) -} - -// CassVersion returns the cql version as a KeyValue pair. -func CassVersion(version string) attribute.KeyValue { - return CassVersionKey.String(version) -} - -// CassHostID returns the id of the cassandra host as a KeyValue pair. -func CassHostID(id string) attribute.KeyValue { - return CassHostIDKey.String(id) -} - -// CassHostState returns the state of the cassandra host as a KeyValue pair. -func CassHostState(state string) attribute.KeyValue { - return CassHostStateKey.String(state) -} - -// ------------------------------------------ Call-level attributes - -// CassStatement returns the statement made to the cassandra database as a -// semconv KeyValue pair (db.statement). -func CassStatement(stmt string) attribute.KeyValue { - return semconv.DBStatement(stmt) -} - -// CassBatchQueryOperation returns the batch query operation -// as a semconv KeyValue pair (db.operation). This is used in lieu of a -// db.statement, which is not feasible to include in a span for a batch query -// because there can be n different query statements in a batch query. -func CassBatchQueryOperation() attribute.KeyValue { - cassBatchQueryOperation := "db.cassandra.batch.query" - return semconv.DBOperation(cassBatchQueryOperation) -} - -// CassConnectOperation returns the connect operation -// as a semconv KeyValue pair (db.operation). This is used in lieu of a -// db.statement since connection creation does not have a CQL statement. -func CassConnectOperation() attribute.KeyValue { - cassConnectOperation := "db.cassandra.connect" - return semconv.DBOperation(cassConnectOperation) -} - -// CassKeyspace returns the keyspace of the session as -// a semconv KeyValue pair (db.name). -func CassKeyspace(keyspace string) attribute.KeyValue { - return semconv.DBName(keyspace) -} - -// CassBatchQueries returns the number of queries in a batch query -// as a KeyValue pair. -func CassBatchQueries(num int) attribute.KeyValue { - return CassBatchQueriesKey.Int(num) -} - -// CassErrMsg returns the KeyValue pair of an error message -// encountered when executing a query, batch query, or error. -func CassErrMsg(msg string) attribute.KeyValue { - return CassErrMsgKey.String(msg) -} - -// CassRowsReturned returns the KeyValue pair of the number of rows -// returned from a query. -func CassRowsReturned(rows int) attribute.KeyValue { - return CassRowsReturnedKey.Int(rows) -} - -// CassQueryAttempts returns the KeyValue pair of the number of attempts -// made for a query. -func CassQueryAttempts(num int) attribute.KeyValue { - return CassQueryAttemptsKey.Int(num) -} - -// HostOrIP returns a KeyValue pair for the hostname -// retrieved from gocql.HostInfo.HostnameAndPort(). If the hostname -// is returned as a resolved IP address (as is the case for localhost), -// then the KeyValue will have the key net.peer.ip. -// If the hostname is the proper DNS name, then the key will be net.peer.name. -func HostOrIP(hostnameAndPort string) attribute.KeyValue { - hostname, _, err := net.SplitHostPort(hostnameAndPort) - if err != nil { - log.Printf("failed to parse hostname from port, %v", err) - } - if parse := net.ParseIP(hostname); parse != nil { - return CassPeerIP(parse.String()) - } - return CassPeerName(hostname) -} diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/observer.go b/instrumentation/github.com/gocql/gocql/otelgocql/observer.go deleted file mode 100644 index 710159122b8..00000000000 --- a/instrumentation/github.com/gocql/gocql/otelgocql/observer.go +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright The OpenTelemetry 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 otelgocql // import "go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql" - -import ( - "context" - "time" - - "github.com/gocql/gocql" - - "go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql/internal" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/trace" -) - -// OTelQueryObserver implements the gocql.QueryObserver interface -// to provide instrumentation to gocql queries. -type OTelQueryObserver struct { - enabled bool - observer gocql.QueryObserver - tracer trace.Tracer - inst *instruments -} - -// OTelBatchObserver implements the gocql.BatchObserver interface -// to provide instrumentation to gocql batch queries. -type OTelBatchObserver struct { - enabled bool - observer gocql.BatchObserver - tracer trace.Tracer - inst *instruments -} - -// OTelConnectObserver implements the gocql.ConnectObserver interface -// to provide instrumentation to connection attempts made by the session. -type OTelConnectObserver struct { - ctx context.Context - enabled bool - observer gocql.ConnectObserver - tracer trace.Tracer - inst *instruments -} - -// ------------------------------------------ Observer Functions - -// ObserveQuery is called once per query, and provides instrumentation for it. -func (o *OTelQueryObserver) ObserveQuery(ctx context.Context, observedQuery gocql.ObservedQuery) { - if o.enabled { - host := observedQuery.Host - keyspace := observedQuery.Keyspace - inst := o.inst - - attributes := includeKeyValues(host, - internal.CassKeyspace(keyspace), - internal.CassStatement(observedQuery.Statement), - internal.CassRowsReturned(observedQuery.Rows), - internal.CassQueryAttempts(observedQuery.Metrics.Attempts), - ) - - ctx, span := o.tracer.Start( - ctx, - observedQuery.Statement, - trace.WithTimestamp(observedQuery.Start), - trace.WithAttributes(attributes...), - trace.WithSpanKind(trace.SpanKindClient), - ) - - if observedQuery.Err != nil { - attributes = includeKeyValues( - host, - internal.CassKeyspace(keyspace), - internal.CassStatement(observedQuery.Statement), - internal.CassErrMsg(observedQuery.Err.Error()), - ) - span.SetAttributes(internal.CassErrMsg(observedQuery.Err.Error())) - inst.queryCount.Add(ctx, 1, metric.WithAttributes(attributes...)) - } else { - attributes = includeKeyValues( - host, - internal.CassKeyspace(keyspace), - internal.CassStatement(observedQuery.Statement), - ) - inst.queryCount.Add(ctx, 1, metric.WithAttributes(attributes...)) - } - - span.End(trace.WithTimestamp(observedQuery.End)) - - o := metric.WithAttributes(includeKeyValues(host, internal.CassKeyspace(keyspace))...) - inst.queryRows.Record(ctx, int64(observedQuery.Rows), o) - inst.latency.Record(ctx, nanoToMilliseconds(observedQuery.Metrics.TotalLatency), o) - } - - if o.observer != nil { - o.observer.ObserveQuery(ctx, observedQuery) - } -} - -// ObserveBatch is called once per batch query, and provides instrumentation for it. -func (o *OTelBatchObserver) ObserveBatch(ctx context.Context, observedBatch gocql.ObservedBatch) { - if o.enabled { - host := observedBatch.Host - keyspace := observedBatch.Keyspace - inst := o.inst - - attributes := includeKeyValues(host, - internal.CassKeyspace(keyspace), - internal.CassBatchQueryOperation(), - internal.CassBatchQueries(len(observedBatch.Statements)), - ) - - ctx, span := o.tracer.Start( - ctx, - internal.CassBatchQueryName, - trace.WithTimestamp(observedBatch.Start), - trace.WithAttributes(attributes...), - trace.WithSpanKind(trace.SpanKindClient), - ) - - if observedBatch.Err != nil { - attributes = includeKeyValues( - host, - internal.CassKeyspace(keyspace), - internal.CassErrMsg(observedBatch.Err.Error()), - ) - span.SetAttributes(internal.CassErrMsg(observedBatch.Err.Error())) - inst.batchCount.Add(ctx, 1, metric.WithAttributes(attributes...)) - } else { - attributes = includeKeyValues(host, internal.CassKeyspace(keyspace)) - inst.batchCount.Add(ctx, 1, metric.WithAttributes(attributes...)) - } - - span.End(trace.WithTimestamp(observedBatch.End)) - - o := metric.WithAttributes(includeKeyValues(host, internal.CassKeyspace(keyspace))...) - inst.latency.Record(ctx, nanoToMilliseconds(observedBatch.Metrics.TotalLatency), o) - } - - if o.observer != nil { - o.observer.ObserveBatch(ctx, observedBatch) - } -} - -// ObserveConnect is called once per connection attempt, and provides instrumentation for it. -func (o *OTelConnectObserver) ObserveConnect(observedConnect gocql.ObservedConnect) { - if o.enabled { - host := observedConnect.Host - inst := o.inst - - attributes := includeKeyValues(host, internal.CassConnectOperation()) - - _, span := o.tracer.Start( - o.ctx, - internal.CassConnectName, - trace.WithTimestamp(observedConnect.Start), - trace.WithAttributes(attributes...), - trace.WithSpanKind(trace.SpanKindClient), - ) - - if observedConnect.Err != nil { - attributes = includeKeyValues(host, internal.CassErrMsg(observedConnect.Err.Error())) - span.SetAttributes(internal.CassErrMsg(observedConnect.Err.Error())) - inst.connectionCount.Add(o.ctx, 1, metric.WithAttributes(attributes...)) - } else { - attributes = includeKeyValues(host) - inst.connectionCount.Add(o.ctx, 1, metric.WithAttributes(attributes...)) - } - - span.End(trace.WithTimestamp(observedConnect.End)) - } - - if o.observer != nil { - o.observer.ObserveConnect(observedConnect) - } -} - -// ------------------------------------------ Private Functions - -// includeKeyValues is a convenience function for adding multiple attributes/labels to a -// span or instrument. By default, this function includes connection-level attributes, -// (as per the semantic conventions) which have been made standard for all spans and metrics -// generated by this instrumentation integration. -func includeKeyValues(host *gocql.HostInfo, values ...attribute.KeyValue) []attribute.KeyValue { - connectionLevelAttributes := []attribute.KeyValue{ - internal.CassDBSystem(), - internal.HostOrIP(host.HostnameAndPort()), - internal.CassPeerPort(host.Port()), - internal.CassVersion(host.Version().String()), - internal.CassHostID(host.HostID()), - internal.CassHostState(host.State().String()), - } - return append(connectionLevelAttributes, values...) -} - -// nanoToMilliseconds converts nanoseconds to milliseconds. -func nanoToMilliseconds(ns int64) int64 { - return ns / int64(time.Millisecond) -} diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/test/doc.go b/instrumentation/github.com/gocql/gocql/otelgocql/test/doc.go deleted file mode 100644 index c82616f1719..00000000000 --- a/instrumentation/github.com/gocql/gocql/otelgocql/test/doc.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright The OpenTelemetry 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 test validates the otelgocql instrumentation with the default SDK. - -This package is in a separate module from the instrumentation it tests to -isolate the dependency of the default SDK and not impose this as a transitive -dependency for users. -*/ -package test // import "go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql/test" diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/test/go.mod b/instrumentation/github.com/gocql/gocql/otelgocql/test/go.mod deleted file mode 100644 index d901e9b49e4..00000000000 --- a/instrumentation/github.com/gocql/gocql/otelgocql/test/go.mod +++ /dev/null @@ -1,31 +0,0 @@ -module go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql/test - -go 1.19 - -require ( - github.com/gocql/gocql v1.6.0 - github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/contrib v1.18.0 - go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql v0.43.0 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/sdk/metric v0.40.0 - go.opentelemetry.io/otel/trace v1.17.0 -) - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/snappy v0.0.3 // indirect - github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect - golang.org/x/sys v0.11.0 // indirect - gopkg.in/inf.v0 v0.9.1 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) - -replace go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql => ../ - -replace go.opentelemetry.io/contrib => ../../../../../../ diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/test/go.sum b/instrumentation/github.com/gocql/gocql/otelgocql/test/go.sum deleted file mode 100644 index ed834161a73..00000000000 --- a/instrumentation/github.com/gocql/gocql/otelgocql/test/go.sum +++ /dev/null @@ -1,48 +0,0 @@ -github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 h1:mXoPYz/Ul5HYEDvkta6I8/rnYM5gSdSV2tJ6XbZuEtY= -github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k= -github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= -github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/gocql/gocql v1.6.0 h1:IdFdOTbnpbd0pDhl4REKQDM+Q0SzKXQ1Yh+YZZ8T/qU= -github.com/gocql/gocql v1.6.0/go.mod h1:3gM2c4D3AnkISwBxGnMMsS8Oy4y2lhbPRsH4xnJrHG8= -github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= -github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8= -github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -go.opentelemetry.io/otel v1.17.0 h1:MW+phZ6WZ5/uk2nd93ANk/6yJ+dVrvNWUjGhnnFU5jM= -go.opentelemetry.io/otel v1.17.0/go.mod h1:I2vmBGtFaODIVMBSTPVDlJSzBDNf93k60E6Ft0nyjo0= -go.opentelemetry.io/otel/metric v1.17.0 h1:iG6LGVz5Gh+IuO0jmgvpTB6YVrCGngi8QGm+pMd8Pdc= -go.opentelemetry.io/otel/metric v1.17.0/go.mod h1:h4skoxdZI17AxwITdmdZjjYJQH5nzijUUjm+wtPph5o= -go.opentelemetry.io/otel/sdk v1.17.0 h1:FLN2X66Ke/k5Sg3V623Q7h7nt3cHXaW1FOvKKrW0IpE= -go.opentelemetry.io/otel/sdk v1.17.0/go.mod h1:U87sE0f5vQB7hwUoW98pW5Rz4ZDuCFBZFNUBlSgmDFQ= -go.opentelemetry.io/otel/sdk/metric v0.40.0 h1:qOM29YaGcxipWjL5FzpyZDpCYrDREvX0mVlmXdOjCHU= -go.opentelemetry.io/otel/sdk/metric v0.40.0/go.mod h1:dWxHtdzdJvg+ciJUKLTKwrMe5P6Dv3FyDbh8UkfgkVs= -go.opentelemetry.io/otel/trace v1.17.0 h1:/SWhSRHmDPOImIAetP1QAeMnZYiQXrTy4fMMYOdSKWQ= -go.opentelemetry.io/otel/trace v1.17.0/go.mod h1:I/4vKTgFclIsXRVucpH25X0mpFSczM7aHeaz0ZBLWjY= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= -gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/test/gocql_test.go b/instrumentation/github.com/gocql/gocql/otelgocql/test/gocql_test.go deleted file mode 100644 index 0479b98a8ef..00000000000 --- a/instrumentation/github.com/gocql/gocql/otelgocql/test/gocql_test.go +++ /dev/null @@ -1,454 +0,0 @@ -// Copyright The OpenTelemetry 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 test - -import ( - "context" - "fmt" - "log" - "os" - "testing" - "time" - - "github.com/gocql/gocql" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql" //nolint:staticcheck // This is deprecated and will be removed in the next release. - "go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql/internal" - "go.opentelemetry.io/contrib/internal/util" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/metricdata" - sdktrace "go.opentelemetry.io/otel/sdk/trace" - "go.opentelemetry.io/otel/sdk/trace/tracetest" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" - "go.opentelemetry.io/otel/trace" -) - -const ( - keyspace string = "gotest" - tableName string = "test_table" -) - -type mockConnectObserver struct { - callCount int -} - -func (m *mockConnectObserver) ObserveConnect(observedConnect gocql.ObservedConnect) { - m.callCount++ -} - -func TestQuery(t *testing.T) { - defer afterEach(t) - cluster := getCluster() - sr := tracetest.NewSpanRecorder() - tracerProvider := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sr)) - reader := metric.NewManualReader() - meterProvider := metric.NewMeterProvider(metric.WithReader(reader)) - - ctx, parentSpan := tracerProvider.Tracer(internal.InstrumentationName).Start(context.Background(), "gocql-test") - - session, err := otelgocql.NewSessionWithTracing( - ctx, - cluster, - otelgocql.WithTracerProvider(tracerProvider), - otelgocql.WithMeterProvider(meterProvider), - otelgocql.WithConnectInstrumentation(false), - ) - require.NoError(t, err) - defer session.Close() - require.NoError(t, session.AwaitSchemaAgreement(ctx)) - - id := gocql.TimeUUID() - title := "example-title" - insertStmt := fmt.Sprintf("insert into %s (id, title) values (?, ?)", tableName) - query := session.Query(insertStmt, id, title).WithContext(ctx) - assert.NotNil(t, query, "expected query to not be nil") - require.NoError(t, query.Exec()) - - parentSpan.End() - - // Get the spans and ensure that they are child spans to the local parent - spans := sr.Ended() - - // Collect all the connection spans - // total spans: - // 1 span for the Query - // 1 span created in test - require.Len(t, spans, 2) - - // Verify attributes are correctly added to the spans. Omit the one local span - for _, span := range spans[0 : len(spans)-1] { - switch span.Name() { - case insertStmt: - assert.Contains(t, span.Attributes(), semconv.DBStatement(insertStmt)) - assert.Equal(t, parentSpan.SpanContext().SpanID().String(), span.Parent().SpanID().String()) - default: - t.Fatalf("unexpected span name %s", span.Name()) - } - assertConnectionLevelAttributes(t, span) - } - - rm := metricdata.ResourceMetrics{} - err = reader.Collect(context.Background(), &rm) - require.NoError(t, err) - require.Len(t, rm.ScopeMetrics, 1) - sm := rm.ScopeMetrics[0] - assertScope(t, sm) - assertQueriesMetric(t, 1, insertStmt, requireMetric(t, "db.cassandra.queries", sm.Metrics)) - assertRowsMetric(t, 1, requireMetric(t, "db.cassandra.rows", sm.Metrics)) - assertLatencyMetric(t, 1, requireMetric(t, "db.cassandra.latency", sm.Metrics)) -} - -func TestBatch(t *testing.T) { - defer afterEach(t) - cluster := getCluster() - sr := tracetest.NewSpanRecorder() - tracerProvider := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sr)) - reader := metric.NewManualReader() - meterProvider := metric.NewMeterProvider(metric.WithReader(reader)) - - ctx, parentSpan := tracerProvider.Tracer(internal.InstrumentationName).Start(context.Background(), "gocql-test") - - session, err := otelgocql.NewSessionWithTracing( - ctx, - cluster, - otelgocql.WithTracerProvider(tracerProvider), - otelgocql.WithMeterProvider(meterProvider), - otelgocql.WithConnectInstrumentation(false), - ) - require.NoError(t, err) - defer session.Close() - require.NoError(t, session.AwaitSchemaAgreement(ctx)) - - batch := session.NewBatch(gocql.LoggedBatch).WithContext(ctx) - for i := 0; i < 10; i++ { - id := gocql.TimeUUID() - title := fmt.Sprintf("batch-title-%d", i) - stmt := fmt.Sprintf("insert into %s (id, title) values (?, ?)", tableName) - batch.Query(stmt, id, title) - } - - require.NoError(t, session.ExecuteBatch(batch)) - - parentSpan.End() - - spans := sr.Ended() - // total spans: - // 1 span for the query - // 1 span for the local span - if assert.Len(t, spans, 2) { - span := spans[0] - assert.Equal(t, internal.CassBatchQueryName, span.Name()) - assert.Equal(t, parentSpan.SpanContext().SpanID(), span.Parent().SpanID()) - assert.Contains(t, span.Attributes(), semconv.DBOperation("db.cassandra.batch.query")) - assertConnectionLevelAttributes(t, span) - } - - rm := metricdata.ResourceMetrics{} - err = reader.Collect(context.Background(), &rm) - require.NoError(t, err) - require.Len(t, rm.ScopeMetrics, 1) - sm := rm.ScopeMetrics[0] - assertScope(t, sm) - assertBatchQueriesMetric(t, 1, requireMetric(t, "db.cassandra.batch.queries", sm.Metrics)) - assertLatencyMetric(t, 1, requireMetric(t, "db.cassandra.latency", sm.Metrics)) -} - -func TestConnection(t *testing.T) { - defer afterEach(t) - cluster := getCluster() - sr := tracetest.NewSpanRecorder() - tracerProvider := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sr)) - reader := metric.NewManualReader() - meterProvider := metric.NewMeterProvider(metric.WithReader(reader)) - connectObserver := &mockConnectObserver{0} - ctx := context.Background() - - session, err := otelgocql.NewSessionWithTracing( - ctx, - cluster, - otelgocql.WithTracerProvider(tracerProvider), - otelgocql.WithMeterProvider(meterProvider), - otelgocql.WithConnectObserver(connectObserver), - ) - require.NoError(t, err) - defer session.Close() - require.NoError(t, session.AwaitSchemaAgreement(ctx)) - - spans := sr.Ended() - - assert.Less(t, 0, connectObserver.callCount) - - // Verify the span attributes - for _, span := range spans { - assert.Equal(t, internal.CassConnectName, span.Name()) - assert.Contains(t, span.Attributes(), semconv.DBOperation("db.cassandra.connect")) - assertConnectionLevelAttributes(t, span) - } - - rm := metricdata.ResourceMetrics{} - err = reader.Collect(context.Background(), &rm) - require.NoError(t, err) - require.Len(t, rm.ScopeMetrics, 1) - sm := rm.ScopeMetrics[0] - assertScope(t, sm) - assertConnectionsMetric(t, requireMetric(t, "db.cassandra.connections", sm.Metrics)) -} - -func TestHostOrIP(t *testing.T) { - hostAndPort := "127.0.0.1:9042" - attr := internal.HostOrIP(hostAndPort) - assert.Equal(t, semconv.NetSockPeerAddrKey, attr.Key) - assert.Equal(t, "127.0.0.1", attr.Value.AsString()) - - hostAndPort = "exampleHost:9042" - attr = internal.HostOrIP(hostAndPort) - assert.Equal(t, semconv.NetPeerNameKey, attr.Key) - assert.Equal(t, "exampleHost", attr.Value.AsString()) - - hostAndPort = "invalid-host-and-port-string" - attr = internal.HostOrIP(hostAndPort) - require.Empty(t, attr.Value.AsString()) -} - -func assertConnectionLevelAttributes(t *testing.T, span sdktrace.ReadOnlySpan) { - attrs := span.Attributes() - assert.Contains(t, attrs, semconv.DBSystemCassandra) - assert.Contains(t, attrs, semconv.NetSockPeerAddr("127.0.0.1")) - assert.Contains(t, attrs, semconv.NetPeerPort(9042)) - assert.Contains(t, attrs, internal.CassHostStateKey.String("UP")) - assert.Equal(t, trace.SpanKindClient, span.SpanKind()) - - keys := make(map[attribute.Key]struct{}, len(attrs)) - for _, a := range attrs { - keys[a.Key] = struct{}{} - } - assert.Contains(t, keys, internal.CassVersionKey) - assert.Contains(t, keys, internal.CassHostIDKey) -} - -// getCluster creates a gocql ClusterConfig with the appropriate -// settings for test cases. -func getCluster() *gocql.ClusterConfig { - cluster := gocql.NewCluster("127.0.0.1") - cluster.Keyspace = keyspace - cluster.Consistency = gocql.LocalQuorum - cluster.NumConns = 1 - return cluster -} - -func assertScope(t *testing.T, sm metricdata.ScopeMetrics) { - assert.Equal(t, instrumentation.Scope{ - Name: "go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql", - Version: otelgocql.Version(), - }, sm.Scope) -} - -func requireMetric(t *testing.T, name string, metrics []metricdata.Metrics) metricdata.Metrics { - m, ok := getMetric(name, metrics) - require.Truef(t, ok, "missing metric %q", name) - return m -} - -func getMetric(name string, metrics []metricdata.Metrics) (metricdata.Metrics, bool) { - for _, m := range metrics { - if m.Name == name { - return m, true - } - } - return metricdata.Metrics{}, false -} - -func assertQueriesMetric(t *testing.T, value int64, stmt string, m metricdata.Metrics) { - assert.Equal(t, "db.cassandra.queries", m.Name) - assert.Equal(t, "Number queries executed", m.Description) - require.IsType(t, m.Data, metricdata.Sum[int64]{}) - data := m.Data.(metricdata.Sum[int64]) - assert.Equal(t, metricdata.CumulativeTemporality, data.Temporality, "Temporality") - assert.True(t, data.IsMonotonic, "IsMonotonic") - require.Len(t, data.DataPoints, 1, "DataPoints") - dPt := data.DataPoints[0] - assert.Equal(t, value, dPt.Value, "Value") - assertAttrSet(t, []attribute.KeyValue{ - internal.CassDBSystem(), - internal.CassPeerIP("127.0.0.1"), - internal.CassPeerPort(9042), - internal.CassVersion("3"), - internal.CassHostID("test-id"), - internal.CassHostState("UP"), - internal.CassKeyspace(keyspace), - internal.CassStatement(stmt), - }, dPt.Attributes) -} - -func assertBatchQueriesMetric(t *testing.T, value int64, m metricdata.Metrics) { - assert.Equal(t, "db.cassandra.batch.queries", m.Name) - assert.Equal(t, "Number of batch queries executed", m.Description) - require.IsType(t, m.Data, metricdata.Sum[int64]{}) - data := m.Data.(metricdata.Sum[int64]) - assert.Equal(t, metricdata.CumulativeTemporality, data.Temporality, "Temporality") - assert.True(t, data.IsMonotonic, "IsMonotonic") - require.Len(t, data.DataPoints, 1, "DataPoints") - dPt := data.DataPoints[0] - assert.Equal(t, value, dPt.Value, "Value") - assertAttrSet(t, []attribute.KeyValue{ - internal.CassDBSystem(), - internal.CassPeerIP("127.0.0.1"), - internal.CassPeerPort(9042), - internal.CassVersion("3"), - internal.CassHostID("test-id"), - internal.CassHostState("UP"), - internal.CassKeyspace(keyspace), - }, dPt.Attributes) -} - -func assertConnectionsMetric(t *testing.T, m metricdata.Metrics) { - assert.Equal(t, "db.cassandra.connections", m.Name) - assert.Equal(t, "Number of connections created", m.Description) - require.IsType(t, m.Data, metricdata.Sum[int64]{}) - data := m.Data.(metricdata.Sum[int64]) - assert.Equal(t, metricdata.CumulativeTemporality, data.Temporality, "Temporality") - assert.True(t, data.IsMonotonic, "IsMonotonic") - for _, dPt := range data.DataPoints { - assertAttrSet(t, []attribute.KeyValue{ - internal.CassDBSystem(), - internal.CassPeerIP("127.0.0.1"), - internal.CassPeerPort(9042), - internal.CassVersion("3"), - internal.CassHostID("test-id"), - internal.CassHostState("UP"), - }, dPt.Attributes) - } -} - -func assertRowsMetric(t *testing.T, count uint64, m metricdata.Metrics) { - assert.Equal(t, "db.cassandra.rows", m.Name) - assert.Equal(t, "Number of rows returned from query", m.Description) - require.IsType(t, m.Data, metricdata.Histogram[int64]{}) - data := m.Data.(metricdata.Histogram[int64]) - assert.Equal(t, metricdata.CumulativeTemporality, data.Temporality, "Temporality") - require.Len(t, data.DataPoints, 1, "DataPoints") - dPt := data.DataPoints[0] - assert.Equal(t, count, dPt.Count, "Count") - assertAttrSet(t, []attribute.KeyValue{ - internal.CassDBSystem(), - internal.CassPeerIP("127.0.0.1"), - internal.CassPeerPort(9042), - internal.CassVersion("3"), - internal.CassHostID("test-id"), - internal.CassHostState("UP"), - internal.CassKeyspace(keyspace), - }, dPt.Attributes) -} - -func assertLatencyMetric(t *testing.T, count uint64, m metricdata.Metrics) { - assert.Equal(t, "db.cassandra.latency", m.Name) - assert.Equal(t, "Sum of latency to host in milliseconds", m.Description) - assert.Equal(t, "ms", m.Unit) - require.IsType(t, m.Data, metricdata.Histogram[int64]{}) - data := m.Data.(metricdata.Histogram[int64]) - assert.Equal(t, metricdata.CumulativeTemporality, data.Temporality, "Temporality") - require.Len(t, data.DataPoints, 1, "DataPoints") - dPt := data.DataPoints[0] - assert.Equal(t, count, dPt.Count, "Count") - assertAttrSet(t, []attribute.KeyValue{ - internal.CassDBSystem(), - internal.CassPeerIP("127.0.0.1"), - internal.CassPeerPort(9042), - internal.CassVersion("3"), - internal.CassHostID("test-id"), - internal.CassHostState("UP"), - internal.CassKeyspace(keyspace), - }, dPt.Attributes) -} - -func assertAttrSet(t *testing.T, want []attribute.KeyValue, got attribute.Set) { - for _, attr := range want { - actual, ok := got.Value(attr.Key) - if !assert.Truef(t, ok, "missing attribute %s", attr.Key) { - continue - } - switch attr.Key { - case internal.CassHostIDKey, internal.CassVersionKey: - // Host ID and Version will change between test runs. - assert.NotEmpty(t, actual) - default: - assert.Equal(t, attr.Value, actual) - } - } -} - -// beforeAll creates the testing keyspace and table if they do not already exist. -func beforeAll() error { - cluster := gocql.NewCluster("localhost") - cluster.Consistency = gocql.LocalQuorum - cluster.Keyspace = "system" - - session, err := cluster.CreateSession() - if err != nil { - return fmt.Errorf("failed to connect to database during beforeAll, %v", err) - } - - err = session.Query( - fmt.Sprintf( - "create keyspace if not exists %s with replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }", - keyspace, - ), - ).Exec() - if err != nil { - return err - } - - cluster.Keyspace = keyspace - cluster.Timeout = time.Second * 2 - session, err = cluster.CreateSession() - if err != nil { - return err - } - - err = session.Query( - fmt.Sprintf("create table if not exists %s(id UUID, title text, PRIMARY KEY(id))", tableName), - ).Exec() - if err != nil { - return err - } - return nil -} - -// afterEach truncates the table used for testing. -func afterEach(t *testing.T) { - cluster := gocql.NewCluster("localhost") - cluster.Consistency = gocql.LocalQuorum - cluster.Keyspace = keyspace - cluster.Timeout = time.Second * 2 - session, err := cluster.CreateSession() - if err != nil { - t.Fatalf("failed to connect to database during afterEach, %v", err) - } - if err = session.Query(fmt.Sprintf("truncate table %s", tableName)).Exec(); err != nil { - t.Fatalf("failed to truncate table, %v", err) - } -} - -func TestMain(m *testing.M) { - util.IntegrationShouldRun("test-gocql") - if err := beforeAll(); err != nil { - log.Fatal(err) - } - os.Exit(m.Run()) -} diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/test/version.go b/instrumentation/github.com/gocql/gocql/otelgocql/test/version.go deleted file mode 100644 index 907734b9eb0..00000000000 --- a/instrumentation/github.com/gocql/gocql/otelgocql/test/version.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright The OpenTelemetry 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 test // import "go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql/test" - -// Version is the current release version of the gocql instrumentation test module. -func Version() string { - return "0.43.0" - // This string is updated by the pre_release.sh script during release -} - -// SemVersion is the semantic version to be supplied to tracer/meter creation. -// -// Deprecated: Use [Version] instead. -func SemVersion() string { - return Version() -} diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/version.go b/instrumentation/github.com/gocql/gocql/otelgocql/version.go deleted file mode 100644 index 1a982377113..00000000000 --- a/instrumentation/github.com/gocql/gocql/otelgocql/version.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright The OpenTelemetry 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 otelgocql // import "go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql" - -// Version is the current release version of the gocql instrumentation. -func Version() string { - return "0.43.0" - // This string is updated by the pre_release.sh script during release -} - -// SemVersion is the semantic version to be supplied to tracer/meter creation. -// -// Deprecated: Use [Version] instead. -func SemVersion() string { - return Version() -} diff --git a/versions.yaml b/versions.yaml index 1a1d2a20b51..464d7397fde 100644 --- a/versions.yaml +++ b/versions.yaml @@ -57,18 +57,6 @@ module-sets: - go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho - go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho/example - go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho/test - - go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama - - go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama/example - - go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama/test - - go.opentelemetry.io/contrib/instrumentation/github.com/go-kit/kit/otelkit - - go.opentelemetry.io/contrib/instrumentation/github.com/go-kit/kit/otelkit/example - - go.opentelemetry.io/contrib/instrumentation/github.com/go-kit/kit/otelkit/test - - go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql - - go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql/example - - go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql/test - - go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego - - go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego/example - - go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego/test - go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-lambda-go/otellambda/xrayconfig - go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-lambda-go/otellambda - go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-lambda-go/otellambda/example @@ -76,9 +64,6 @@ module-sets: - go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws - go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/example - go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/test - - go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache - - go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example - - go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/test - go.opentelemetry.io/contrib/instrumentation/github.com/emicklei/go-restful/otelrestful - go.opentelemetry.io/contrib/instrumentation/github.com/emicklei/go-restful/otelrestful/example - go.opentelemetry.io/contrib/instrumentation/github.com/emicklei/go-restful/otelrestful/test