Skip to content

Commit

Permalink
setup new variant for orchestrion
Browse files Browse the repository at this point in the history
Signed-off-by: Eliott Bouhana <[email protected]>
  • Loading branch information
eliottness committed Jan 9, 2025
1 parent 41200b2 commit 700c3dc
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 9 deletions.
6 changes: 6 additions & 0 deletions docs/execute/binaries.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ Create a file `golang-load-from-go-get` under the `binaries` directory that spec
* `gopkg.in/DataDog/[email protected]` Test the 1.67.0 release
* `gopkg.in/DataDog/dd-trace-go.v1@<commit_hash>` 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/[email protected]` Test the 1.1.0 release
* `github.com/DataDog/orchestrion@<commit_hash>` Test un-merged changes

## Java library

Follow these steps to run Parametric tests with a custom Java Tracer version:
Expand Down
1 change: 1 addition & 0 deletions manifests/golang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_semantic_conventions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
2 changes: 1 addition & 1 deletion tests/test_standard_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand Down
16 changes: 16 additions & 0 deletions utils/build/docker/golang/install_ddtrace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 2 additions & 4 deletions utils/build/docker/golang/net-http-orchestrion.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

# ==============================================================================

Expand Down
6 changes: 3 additions & 3 deletions utils/scripts/load-binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,16 @@ 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

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"
Expand Down

0 comments on commit 700c3dc

Please sign in to comment.