diff --git a/docs/execute/binaries.md b/docs/execute/binaries.md index 9816ae0fc3..37ccd92065 100644 --- a/docs/execute/binaries.md +++ b/docs/execute/binaries.md @@ -34,6 +34,12 @@ Create a file `golang-load-from-go-get` under the `binaries` directory that spec * `gopkg.in/DataDog/dd-trace-go.v1@v1.67.0` Test the 1.67.0 release * `gopkg.in/DataDog/dd-trace-go.v1@` Test un-merged changes +To change Orchestrion version, create a file `orchestrion-load-from-go-get` under the `binaries` directory that specifies the target build. The content of this file will be installed by the weblog or parametric app via `go get` when the test image is built. +* Content example: + * `github.com/DataDog/orchestrion@main` Test the main branch + * `github.com/DataDog/orchestrion@v1.1.0` Test the 1.1.0 release + * `github.com/DataDog/orchestrion@` Test un-merged changes + ## Java library Follow these steps to run Parametric tests with a custom Java Tracer version: diff --git a/manifests/golang.yml b/manifests/golang.yml index c6f5de78b6..2123fdca9d 100644 --- a/manifests/golang.yml +++ b/manifests/golang.yml @@ -212,6 +212,7 @@ tests/: '*': v1.36.0 gin: v1.37.0 net-http: irrelevant (net-http doesn't handle path params) + net-http-orchestrion: irrelevant (net-http doesn't handle path params) Test_ResponseStatus: '*': v1.36.0 gin: v1.37.0 diff --git a/tests/test_semantic_conventions.py b/tests/test_semantic_conventions.py index 30f62c666f..13dbb495ea 100644 --- a/tests/test_semantic_conventions.py +++ b/tests/test_semantic_conventions.py @@ -263,7 +263,7 @@ def test_meta_component_tag(self): """Assert that all spans generated from a weblog_variant have component metadata tag matching integration name.""" def validator(span): - if span.get("type") != "web": # do nothing if is not web related + if span.get("type") != "web" or "orchestrion" in context.weblog_variant: # do nothing if is not web related return expected_component = get_component_name(context.weblog_variant, context.library, span.get("name")) diff --git a/tests/test_standard_tags.py b/tests/test_standard_tags.py index b7de9e438e..9beb0e2127 100644 --- a/tests/test_standard_tags.py +++ b/tests/test_standard_tags.py @@ -200,7 +200,7 @@ def test_route(self): if context.library == "nodejs": tags["http.route"] = "/sample_rate_route/:i" if context.library == "golang": - if context.weblog_variant == "net-http": + if "net-http" in context.weblog_variant: # net/http doesn't support parametrized routes but a path catches anything down the tree. tags["http.route"] = "/sample_rate_route/" if context.weblog_variant in ("gin", "echo", "uds-echo"): diff --git a/utils/build/docker/golang/install_ddtrace.sh b/utils/build/docker/golang/install_ddtrace.sh index ab12a42b72..a6fa2d402d 100755 --- a/utils/build/docker/golang/install_ddtrace.sh +++ b/utils/build/docker/golang/install_ddtrace.sh @@ -15,6 +15,22 @@ else go get -v -d -u gopkg.in/DataDog/dd-trace-go.v1 fi +# Install orchestrion +if [ -n "$INSTALL_ORCHESTRION" ]; then + if [ -e "/binaries/orchestrion" ]; then + echo "Install from folder /binaries/orchestrion" + go mod edit -replace github.com/DataDog/orchestrion=/binaries/orchestrion + go -C /binaries/orchestrion build -o "$(go env GOPATH)/bin/orchestrion" . + elif [ -e "/binaries/orchestrion-load-from-go-get" ]; then + echo "Install from go get -d $(cat /binaries/orchestrion-load-from-go-get)" + go install "$(cat /binaries/orchestrion-load-from-go-get)" + else + echo "Installing production orchestrion" + go install github.com/DataDog/orchestrion@latest + fi +fi + + # Downloading a newer version of the tracer may require to resolve again all dependencies go mod tidy diff --git a/utils/build/docker/golang/net-http-orchestrion.Dockerfile b/utils/build/docker/golang/net-http-orchestrion.Dockerfile index e20fde2499..2e7fa2ef47 100644 --- a/utils/build/docker/golang/net-http-orchestrion.Dockerfile +++ b/utils/build/docker/golang/net-http-orchestrion.Dockerfile @@ -9,20 +9,18 @@ COPY utils/build/docker/golang/app/go.mod utils/build/docker/golang/app/go.sum / WORKDIR /app RUN go mod download && go mod verify -RUN go install github.com/DataDog/orchestrion@main - # copy the app code COPY utils/build/docker/golang/app /app # download the proper tracer version COPY utils/build/docker/golang/install_ddtrace.sh binaries* /binaries/ -RUN /binaries/install_ddtrace.sh +RUN INSTALL_ORCHESTRION=true /binaries/install_ddtrace.sh ENV DD_ORCHESTRION_IS_GOMOD_VERSION=true RUN orchestrion pin -RUN orchestrion go build -v -tags appsec -o weblog ./net-http +RUN orchestrion go build -v -tags appsec -o weblog ./net-http-orchestrion # ============================================================================== diff --git a/utils/scripts/load-binary.sh b/utils/scripts/load-binary.sh index 743f23bb54..ed96fc38bd 100755 --- a/utils/scripts/load-binary.sh +++ b/utils/scripts/load-binary.sh @@ -190,9 +190,6 @@ elif [ "$TARGET" = "php" ]; then mv ./temp/dd-library-php*.tar.gz . && mv ./temp/datadog-setup.php . && rm -rf ./temp elif [ "$TARGET" = "golang" ]; then assert_version_is_dev - rm -rf golang-load-from-go-get - - # COMMIT_ID=$(curl -s 'https://api.github.com/repos/DataDog/dd-trace-go/branches/main' | jq -r .commit.sha) echo "Using gopkg.in/DataDog/dd-trace-go.v1@main" echo "gopkg.in/DataDog/dd-trace-go.v1@main" > golang-load-from-go-get @@ -200,6 +197,9 @@ elif [ "$TARGET" = "golang" ]; then echo "Using ghcr.io/datadog/dd-trace-go/service-extensions-callout:dev" echo "ghcr.io/datadog/dd-trace-go/service-extensions-callout:dev" > golang-service-extensions-callout-image + echo "Using github.com/DataDog/orchestrion@main" + echo "github.com/DataDog/orchestrion@main" > orchestrion-load-from-go-get + elif [ "$TARGET" = "cpp" ]; then assert_version_is_dev # get_circleci_artifact "gh/DataDog/dd-opentracing-cpp" "build_test_deploy" "build" "TBD"