Skip to content

Commit 9e6a2a1

Browse files
committed
Merge remote-tracking branch 'origin' into apm-rd/span-source-health-metric
2 parents 6ff2670 + e394045 commit 9e6a2a1

File tree

298 files changed

+22805
-2735
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

298 files changed

+22805
-2735
lines changed

.github/workflows/apps/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
github.com/Masterminds/semver/v3 v3.3.1
77
github.com/stretchr/testify v1.10.0
88
golang.org/x/mod v0.22.0
9-
gopkg.in/DataDog/dd-trace-go.v1 v1.70.1
9+
gopkg.in/DataDog/dd-trace-go.v1 v1.70.3
1010
)
1111

1212
require (

.github/workflows/apps/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf
88
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
99
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
1010
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
11-
gopkg.in/DataDog/dd-trace-go.v1 v1.70.1 h1:ZIRxAKlr3xr6xbMUDs3IDa6xq+ISv9zxyjaDCfwDjMY=
12-
gopkg.in/DataDog/dd-trace-go.v1 v1.70.1/go.mod h1:PMOSkeY4VfXiuPvGodeNLCZCFYU2VfOvjVI6cX5bGrc=
11+
gopkg.in/DataDog/dd-trace-go.v1 v1.70.3 h1:lXHrxMpQZjxNdA8mGRfgMtwF/O6qIut5QjL7LICUVJ4=
12+
gopkg.in/DataDog/dd-trace-go.v1 v1.70.3/go.mod h1:CVUgctrrPGeB+OSjgyt56CNH5QxQwW3t11QU8R1LQjQ=
1313
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
1414
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
1515
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

.github/workflows/orchestrion.yml

Lines changed: 216 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
name: Orchestrion
22
on:
3-
workflow_dispatch: # manually
3+
workflow_call: # From github.com/DataDog/orchestrion
4+
inputs:
5+
orchestrion-version:
6+
description: Orchestrion version to use for integration testing
7+
type: string
8+
required: true
9+
collect-coverage:
10+
description: Whether to collect orchestrion coverage data or not
11+
type: boolean
12+
default: false
13+
required: false
414
pull_request:
515
merge_group:
616
push:
@@ -14,13 +24,211 @@ permissions: read-all
1424

1525
concurrency:
1626
# Automatically cancel previous runs if a new one is triggered to conserve resources.
17-
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
27+
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}${{ inputs.orchestrion-version && format('-{0}', inputs.orchestrion-version) }}
1828
cancel-in-progress: true
1929

2030
jobs:
21-
test:
22-
name: 'Run Tests'
23-
uses: DataDog/orchestrion/.github/workflows/workflow_call.yml@main # we don't want to pin our own action
24-
with:
25-
dd-trace-go-ref: ${{ github.sha }}
26-
runs-on: ubuntu-latest-16-cores
31+
generate:
32+
name: Verify generated files are up-to-date
33+
# Don't run in workflow_call or workflow_dispatch
34+
if: github.event_name == 'workflow_dispatch' || inputs.orchestrion-version == ''
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Checkout Code
38+
uses: actions/checkout@v4
39+
- name: Setup Go
40+
uses: actions/setup-go@v5
41+
with:
42+
go-version: stable
43+
cache: true
44+
cache-dependency-path: '**/go.mod'
45+
- name: Run generator
46+
run: go generate ./internal/orchestrion/...
47+
- name: Check for changes
48+
run: git diff --exit-code
49+
50+
go-versions-matrix:
51+
name: Go Versions Matrix
52+
runs-on: ubuntu-latest
53+
outputs:
54+
json: ${{ steps.matrix.outputs.json }}
55+
steps:
56+
- name: Checkout Code
57+
uses: actions/checkout@v4
58+
with:
59+
repository: ${{ inputs.orchestrion-version != '' && 'DataDog/dd-trace-go' || github.repository }}
60+
ref: ${{ inputs.orchestrion-version != '' && 'romain.marcadier/APPSEC-55160/orchestrion' || github.sha }} # TODO: Change to `main` in workflow_call case
61+
- name: Setup Go
62+
uses: actions/setup-go@v5
63+
with:
64+
go-version: stable
65+
cache: true
66+
cache-dependency-path: '**/go.mod'
67+
- name: Compute Matrix
68+
id: matrix
69+
run: |-
70+
echo -n "json=" >> "${GITHUB_OUTPUT}"
71+
go run ./internal/orchestrion/matrix >> "${GITHUB_OUTPUT}"
72+
73+
integration-test:
74+
needs: [go-versions-matrix]
75+
strategy:
76+
fail-fast: false
77+
matrix:
78+
runs-on:
79+
- ubuntu
80+
- macos
81+
- windows
82+
go-version: ${{ fromJSON(needs.go-versions-matrix.outputs.json) }}
83+
mode: [DRIVER]
84+
include:
85+
# Alternate build modes (only on ubuntu with oldstable, so we save up CI time)
86+
- runs-on: ubuntu
87+
go-version: oldstable
88+
mode: TOOLEXEC
89+
- runs-on: ubuntu
90+
go-version: oldstable
91+
mode: GOFLAGS
92+
name: Integration Test (${{ matrix.runs-on }} | ${{ matrix.go-version }} | ${{ matrix.mode }})
93+
runs-on: ${{ matrix.runs-on == 'ubuntu' && fromJson('{"labels":"ubuntu-16-core-latest","group":"Large Runner Shared Public"}') || (matrix.runs-on == 'windows' && fromJson('{"labels":"windows-shared-8core","group":"LARGE WINDOWS SHARED"}')) || format('{0}-latest', matrix.runs-on) }}
94+
steps:
95+
- name: Checkout Code
96+
uses: actions/checkout@v4
97+
with:
98+
path: ${{ github.workspace }}/dd-trace-go
99+
repository: ${{ inputs.orchestrion-version != '' && 'DataDog/dd-trace-go' || github.repository }}
100+
ref: ${{ inputs.orchestrion-version != '' && 'romain.marcadier/APPSEC-55160/orchestrion' || github.sha }} # TODO: Change to `main` in workflow_call case
101+
# If we're in workflow_dispatch/call, maybe we need to up/downgrade orchestrion
102+
- name: Check out orchestrion
103+
if: inputs.orchestrion-version != ''
104+
id: checkout-orchestrion
105+
uses: actions/checkout@v4
106+
with:
107+
path: ${{ github.workspace }}/orchestrion
108+
repository: DataDog/orchestrion
109+
ref: ${{ inputs.orchestrion-version }}
110+
111+
- name: Setup Go
112+
id: setup-go
113+
uses: actions/setup-go@v5
114+
with:
115+
go-version: ${{ matrix.go-version }}
116+
cache: true
117+
cache-dependency-path: |-
118+
${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration/go.mod
119+
${{ github.workspace }}/orchestrion/go.mod
120+
121+
# ddapm-test-agent is used to observe side effects from the tracer during integration tests.
122+
- name: Set up Python
123+
uses: actions/setup-python@v5
124+
with:
125+
python-version: 3.x
126+
cache: pip
127+
cache-dependency-path: '${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration/internal/agent/requirements-dev.txt'
128+
- name: Install ddapm-test-agent
129+
run: pip install -r ${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration/internal/agent/requirements-dev.txt
130+
131+
- name: Set up orchestrion
132+
if: inputs.orchestrion-version != ''
133+
run: |-
134+
go mod edit -replace="github.com/DataDog/orchestrion=${{ github.workspace }}/orchestrion"
135+
go mod tidy -go ${{ steps.setup-go.outputs.go-version }}
136+
working-directory: ${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration
137+
env:
138+
VERSION: ${{ inputs.orchestrion-version }}
139+
# We install the binary to the GOBIN, so it's easy to use
140+
- name: Install orchestrion binary
141+
if: '!inputs.collect-coverage'
142+
run: go install "github.com/DataDog/orchestrion"
143+
working-directory: ${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration
144+
- name: Build orchestrion binary
145+
if: inputs.collect-coverage
146+
shell: bash
147+
run: |-
148+
bin=$(go env GOPATH)/bin/orchestrion
149+
if [[ '${{ matrix.runs-on }}' == 'windows' ]]; then
150+
bin="${bin}.exe"
151+
fi
152+
mkdir -p "$(dirname "${bin}")"
153+
go build -cover -covermode=atomic -coverpkg="github.com/DataDog/orchestrion/..." "-o=${bin}" "github.com/DataDog/orchestrion"
154+
echo "GOCOVERDIR=$(mktemp -d)" >> "${GITHUB_ENV}"
155+
working-directory: ${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration
156+
157+
# Run a `go mod tidy` because GitHub will run this on a candidate merge commit, and if there
158+
# have been dependecy updates on the `main` branch, the `go.mod` and `go.sum` files for the
159+
# integration test suite may no longer be up-to-date.
160+
- name: Run 'go mod tidy'
161+
run: go mod tidy
162+
working-directory: ${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration
163+
164+
# Finally, we run the test suite!
165+
- name: Run Tests
166+
shell: bash
167+
run: |-
168+
echo "Working directory: ${PWD}"
169+
orchestrion version
170+
171+
case "${MODE}" in
172+
"DRIVER")
173+
echo "Starting test suite in DRIVER mode"
174+
orchestrion go test -shuffle=on ./...
175+
;;
176+
"TOOLEXEC")
177+
echo "Starting test suite in TOOLEXEC mode"
178+
go test -shuffle=on -toolexec='orchestrion toolexec' ./...
179+
;;
180+
"GOFLAGS")
181+
echo "Starting test suite in GOFLAGS mode"
182+
export GOFLAGS="${GOFLAGS} '-toolexec=orchestrion toolexec'"
183+
go test -shuffle=on ./...
184+
;;
185+
*)
186+
echo "Unknown mode: ${MODE}"
187+
;;
188+
esac
189+
working-directory: ${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration
190+
env:
191+
MODE: ${{ matrix.mode }}
192+
# The "buildtag" tag is used in //dd:span integration tests
193+
GOFLAGS: -timeout=30m ${{ matrix.runs-on == 'ubuntu' && '-p=4' || '' }} -tags=githubci${{ matrix.mode == 'DRIVER' && ',buildtag' || ''}}
194+
# Prevent auto-respawn, which is problematic with installs from commit SHA
195+
DD_ORCHESTRION_IS_GOMOD_VERSION: true
196+
# Ryuk is problematic with concurrent executions, and unnecessary in ephemeral environments like GHA.
197+
TESTCONTAINERS_RYUK_DISABLED: true
198+
199+
# If in workflow_call, we collected coverage data we need to upload
200+
- name: Consolidate coverage report
201+
if: inputs.collect-coverage
202+
shell: bash
203+
run: |-
204+
mkdir -p "${{ github.workspace }}/orchestrion/coverage"
205+
go tool covdata textfmt -i "${GOCOVERDIR}" -o "${WORKSPACE}/orchestrion/coverage/integration.out"
206+
env:
207+
WORKSPACE: ${{ github.workspace }}
208+
- name: Determine go minor version
209+
if: inputs.collect-coverage
210+
id: go
211+
shell: bash
212+
run: |-
213+
set -euo pipefail
214+
echo "version=$(echo '${{ steps.setup-go.outputs.go-version }}' | cut -d'.' -f1,2)" >> "${GITHUB_OUTPUT}"
215+
- name: Upload coverage report
216+
if: inputs.collect-coverage
217+
uses: actions/upload-artifact@v4
218+
with:
219+
name: coverage-integration+${{ matrix.mode }}+go${{ steps.go.outputs.version }}+${{ runner.os }}+${{ runner.arch }}
220+
path: ${{ github.workspace }}/orchestrion/coverage/integration.out
221+
222+
# This is a simple join point to make it easy to set up branch protection rules in GitHub.
223+
integration-test-done:
224+
name: Orchestrion Integration Tests
225+
needs: integration-test
226+
runs-on: ubuntu-latest
227+
if: success() || failure()
228+
steps:
229+
- name: Success
230+
if: needs.integration-test.result == 'success'
231+
run: echo "Success!"
232+
- name: Failure
233+
if: needs.integration-test.result != 'success'
234+
run: echo "Failure!" && exit 1

.github/workflows/system-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ jobs:
8181
scenario: APPSEC_LOW_WAF_TIMEOUT
8282
- weblog-variant: net-http
8383
scenario: APPSEC_STANDALONE
84+
- weblog-variant: net-http
85+
scenario: APPSEC_META_STRUCT_DISABLED
8486
- weblog-variant: net-http
8587
scenario: APPSEC_CUSTOM_OBFUSCATION
8688
# APM scenarios requiring specific environment settings

.github/workflows/unit-integration-tests.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ jobs:
5757
fail_on_error: true
5858
reporter: github-pr-review
5959

60+
- name: golangci-lint (internal/orchestrion/_integration)
61+
uses: reviewdog/action-golangci-lint@v2
62+
with:
63+
golangci_lint_flags: "--timeout 10m" # We are hitting timeout when there is no cache
64+
go_version: ${{ inputs.go-version }}
65+
golangci_lint_version: v1.59.1
66+
fail_on_error: true
67+
reporter: github-pr-review
68+
workdir: internal/orchestrion/_integration
69+
6070
test-contrib:
6171
runs-on:
6272
group: "APM Larger Runners"

.golangci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ linters:
55
disable-all: true
66
enable:
77
- gofmt
8+
- govet
89
- revive
910
- bodyclose
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed
2+
# under the Apache License Version 2.0.
3+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
# Copyright 2023-present Datadog, Inc.
5+
---
6+
# yaml-language-server: $schema=https://datadoghq.dev/orchestrion/schema.json
7+
meta:
8+
name: gopkg.in/DataDog/dd-trace-go.v1/contrib/99designs/gqlgen
9+
description: gqlgen is a Go library for building GraphQL servers without any fuss.
10+
11+
aspects:
12+
- id: New
13+
join-point:
14+
one-of:
15+
- function-call: github.com/99designs/gqlgen/graphql/handler.New
16+
- function-call: github.com/99designs/gqlgen/graphql/handler.NewDefaultServer
17+
advice:
18+
- wrap-expression:
19+
imports:
20+
handler: github.com/99designs/gqlgen/graphql/handler
21+
gqlgentrace: gopkg.in/DataDog/dd-trace-go.v1/contrib/99designs/gqlgen
22+
template: |-
23+
func(s *handler.Server) *handler.Server {
24+
s.Use(gqlgentrace.NewTracer())
25+
return s
26+
}({{ . }})

0 commit comments

Comments
 (0)