Skip to content

Commit bd53c35

Browse files
authored
Merge branch 'master' into sabrenner/vertexai-llmobs
2 parents 018e735 + 3bff850 commit bd53c35

File tree

104 files changed

+2086
-820
lines changed

Some content is hidden

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

104 files changed

+2086
-820
lines changed

.github/actions/install/action.yml

+19-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
11
name: Install dependencies
22
description: Install dependencies
3+
inputs:
4+
cache:
5+
description: "Whether to enable caching of node_modules."
6+
required: false
7+
default: 'false'
38
runs:
49
using: composite
5-
steps: # retry in case of server error from registry
10+
steps:
11+
- id: yarn-cache
12+
uses: actions/cache@v4
13+
with:
14+
key: yarn-cache-${{ github.workflow }}-${{ github.job }}-${{ hashFiles('yarn.lock') }}
15+
path: node_modules.tar
16+
if: inputs.cache == 'true'
17+
- run: 7z x -y node_modules.tar
18+
shell: bash
19+
if: inputs.cache == 'true' && steps.yarn-cache.outputs.cache-hit == 'true'
20+
# Retry in case of server error from registry.
621
- run: yarn install --frozen-lockfile --ignore-engines || yarn install --frozen-lockfile --ignore-engines
722
shell: bash
8-
23+
- run: 7z -mx0 a node_modules.tar node_modules
24+
shell: bash
25+
if: inputs.cache == 'true' && steps.yarn-cache.outputs.cache-hit != 'true'

.github/actions/node/active-lts/action.yml

-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ runs:
55
steps:
66
- uses: actions/setup-node@v4
77
with:
8-
cache: yarn
98
node-version: '22'

.github/actions/node/latest/action.yml

-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ runs:
55
steps:
66
- uses: actions/setup-node@v4
77
with:
8-
cache: yarn
98
node-version: 'latest'

.github/actions/node/newest-maintenance-lts/action.yml

-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ runs:
55
steps:
66
- uses: actions/setup-node@v4
77
with:
8-
cache: yarn
98
node-version: '20'

.github/actions/node/oldest-maintenance-lts/action.yml

-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ runs:
55
steps:
66
- uses: actions/setup-node@v4
77
with:
8-
cache: yarn
98
node-version: '18'

.github/actions/testagent/start/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ runs:
44
using: composite
55
steps:
66
- uses: actions/checkout@v4
7-
- run: docker compose up -d testagent
7+
- run: docker compose up -d testagent || docker compose up -d testagent
88
shell: bash

.github/workflows/appsec.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ jobs:
4444
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4545
- uses: ./.github/actions/node/active-lts
4646
- uses: ./.github/actions/install
47+
with:
48+
cache: 'true'
4749
- run: yarn test:appsec:ci
4850
- uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1
4951

@@ -230,7 +232,6 @@ jobs:
230232
- uses: ./.github/actions/testagent/start
231233
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
232234
with:
233-
cache: yarn
234235
node-version: ${{ matrix.version }}
235236
- uses: ./.github/actions/install
236237
- run: yarn test:appsec:plugins:ci
@@ -257,7 +258,7 @@ jobs:
257258
runs-on: ubuntu-latest
258259
steps:
259260
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
260-
- run: yarn install
261+
- uses: ./.github/actions/install
261262
- uses: ./.github/actions/node/oldest-maintenance-lts
262263
- run: yarn test:integration:appsec
263264
- uses: ./.github/actions/node/active-lts

.github/workflows/instrumentations.yml

+24-9
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,33 @@ concurrency:
1717

1818

1919
jobs:
20-
21-
# These ones don't have a plugin directory, but exist in the
22-
# instrumentations directory, so they need to be run somewhere. This seems to
23-
# be a reasonable place to run them for now.
24-
25-
check_require_cache:
20+
instrumentations-misc:
2621
runs-on: ubuntu-latest
27-
env:
28-
PLUGINS: check_require_cache
2922
steps:
3023
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31-
- uses: ./.github/actions/plugins/test
24+
- uses: ./.github/actions/testagent/start
25+
- uses: ./.github/actions/node/oldest-maintenance-lts
26+
- uses: ./.github/actions/install
27+
- run: yarn test:instrumentations:misc:ci
28+
shell: bash
29+
- uses: ./.github/actions/node/newest-maintenance-lts
30+
- run: yarn test:instrumentations:misc:ci
31+
shell: bash
32+
- uses: ./.github/actions/node/active-lts
33+
- run: yarn test:instrumentations:misc:ci
34+
shell: bash
35+
- uses: ./.github/actions/node/latest
36+
- run: yarn test:instrumentations:misc:ci
37+
shell: bash
38+
- uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1
39+
- if: always()
40+
uses: ./.github/actions/testagent/logs
41+
with:
42+
suffix: test-${{ github.job }}
43+
44+
# These ones don't have a plugin directory, but exist in the root
45+
# instrumentations directory, so they need to be run somewhere. This seems to
46+
# be a reasonable place to run them for now.
3247

3348
express-session:
3449
runs-on: ubuntu-latest

.github/workflows/llmobs.yml

+7-8
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,22 @@ concurrency:
1515

1616
jobs:
1717
sdk:
18+
strategy:
19+
matrix:
20+
version: [18, 20, 22, latest]
1821
runs-on: ubuntu-latest
1922
steps:
2023
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2124
- uses: ./.github/actions/testagent/start
22-
- uses: ./.github/actions/node/oldest-maintenance-lts
25+
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
26+
with:
27+
node-version: ${{ matrix.version }}
2328
- uses: ./.github/actions/install
2429
- run: yarn test:llmobs:sdk:ci
25-
- uses: ./.github/actions/node/newest-maintenance-lts
26-
- run: yarn test:llmobs:sdk:ci
27-
- uses: ./.github/actions/node/active-lts
28-
- run: yarn test:llmobs:sdk:ci
29-
- uses: ./.github/actions/node/latest
30-
- run: yarn test:llmobs:sdk:ci
3130
- if: always()
3231
uses: ./.github/actions/testagent/logs
3332
with:
34-
suffix: llmobs-${{ github.job }}
33+
suffix: llmobs-${{ github.job }}-${{ matrix.version }}
3534
- uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1
3635

3736
openai:

.github/workflows/plugins.yml

-1
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,6 @@ jobs:
877877
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
878878
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
879879
with:
880-
cache: yarn
881880
node-version: '16'
882881
- uses: ./.github/actions/install
883882
- run: yarn config set ignore-engines true

.github/workflows/profiling.yml

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ jobs:
4949
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5050
- uses: ./.github/actions/node/active-lts
5151
- uses: ./.github/actions/install
52+
with:
53+
cache: 'true'
5254
- run: yarn test:profiler:ci
5355
- run: yarn test:integration:profiler
5456
- uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1

.github/workflows/project.yml

+22-1
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,32 @@ jobs:
6161
env:
6262
DD_INJECTION_ENABLED: 'true'
6363

64+
integration-playwright:
65+
strategy:
66+
matrix:
67+
version: [18, latest]
68+
runs-on: ubuntu-latest
69+
env:
70+
DD_SERVICE: dd-trace-js-integration-tests
71+
DD_CIVISIBILITY_AGENTLESS_ENABLED: 1
72+
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_APP }}
73+
steps:
74+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
75+
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
76+
with:
77+
node-version: ${{ matrix.version }}
78+
- uses: ./.github/actions/install
79+
# Install system dependencies for playwright
80+
- run: npx playwright install-deps
81+
- run: yarn test:integration:playwright
82+
env:
83+
NODE_OPTIONS: '-r ./ci/init'
84+
6485
integration-ci:
6586
strategy:
6687
matrix:
6788
version: [18, latest]
68-
framework: [cucumber, playwright, selenium, jest, mocha]
89+
framework: [cucumber, selenium, jest, mocha]
6990
runs-on: ubuntu-latest
7091
env:
7192
DD_SERVICE: dd-trace-js-integration-tests

.github/workflows/tracing.yml

+2
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,7 @@ jobs:
4444
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4545
- uses: ./.github/actions/node/active-lts
4646
- uses: ./.github/actions/install
47+
with:
48+
cache: 'true'
4749
- run: yarn test:trace:core:ci
4850
- uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1

.gitlab-ci.yml

+3-12
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,9 @@ variables:
2323
SYSTEM_TESTS_LIBRARY: nodejs
2424
REPO_NOTIFICATION_CHANNEL: "#notifications-apm-js"
2525

26-
onboarding_tests_installer:
27-
parallel:
28-
matrix:
29-
- ONBOARDING_FILTER_WEBLOG: [test-app-nodejs,test-app-nodejs-container]
30-
SCENARIO: [ SIMPLE_INSTALLER_AUTO_INJECTION, SIMPLE_AUTO_INJECTION_PROFILING ]
31-
32-
onboarding_tests_k8s_injection:
33-
parallel:
34-
matrix:
35-
- WEBLOG_VARIANT: [sample-app]
36-
SCENARIO: [K8S_LIB_INJECTION, K8S_LIB_INJECTION_UDS, K8S_LIB_INJECTION_NO_AC, K8S_LIB_INJECTION_NO_AC_UDS, K8S_LIB_INJECTION_PROFILING_DISABLED, K8S_LIB_INJECTION_PROFILING_ENABLED, K8S_LIB_INJECTION_PROFILING_OVERRIDE]
37-
K8S_CLUSTER_VERSION: ['7.56.2', '7.57.0', '7.59.0']
26+
configure_system_tests:
27+
variables:
28+
SYSTEM_TESTS_SCENARIOS_GROUPS: "simple_onboarding,simple_onboarding_profiling,docker-ssi,lib-injection"
3829

3930
requirements_json_test:
4031
rules:

index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2347,7 +2347,7 @@ declare namespace tracer {
23472347
* ```javascript
23482348
* llmobs.trace({ kind: 'llm', name: 'myLLM', modelName: 'gpt-4o', modelProvider: 'openai' }, () => {
23492349
* llmobs.annotate({
2350-
* inputData: [{ content: 'system prompt, role: 'system' }, { content: 'user prompt', role: 'user' }],
2350+
* inputData: [{ content: 'system prompt', role: 'system' }, { content: 'user prompt', role: 'user' }],
23512351
* outputData: { content: 'response', role: 'ai' },
23522352
* metadata: { temperature: 0.7 },
23532353
* tags: { host: 'localhost' },
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const { test, expect } = require('@playwright/test')
2+
3+
test.beforeEach(async ({ page }) => {
4+
await page.goto(process.env.PW_BASE_URL)
5+
})
6+
7+
test('should work with passing tests', async ({ page }) => {
8+
await expect(page.locator('.hello-world')).toHaveText([
9+
'Hello World'
10+
])
11+
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
const { expect } = require('chai')
2+
3+
let globalAttempts = 0
4+
5+
describe('describe', function () {
6+
this.retries(2)
7+
8+
beforeEach(() => {
9+
// eslint-disable-next-line no-console
10+
console.log('beforeEach')
11+
})
12+
13+
afterEach(() => {
14+
// eslint-disable-next-line no-console
15+
console.log('afterEach')
16+
})
17+
18+
it('is not nested', function () {
19+
// eslint-disable-next-line no-console
20+
console.log('is not nested')
21+
expect(process.env.SHOULD_FAIL ? globalAttempts++ : 1).to.equal(1)
22+
})
23+
24+
context('context', () => {
25+
beforeEach(() => {
26+
// eslint-disable-next-line no-console
27+
console.log('beforeEach in context')
28+
})
29+
30+
afterEach(() => {
31+
// eslint-disable-next-line no-console
32+
console.log('afterEach in context')
33+
})
34+
35+
it('nested test with retries', function () {
36+
// eslint-disable-next-line no-console
37+
console.log('nested test with retries')
38+
expect(0).to.equal(0)
39+
})
40+
})
41+
})

integration-tests/cypress/cypress.spec.js

+36
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,42 @@ moduleTypes.forEach(({
113113
await receiver.stop()
114114
})
115115

116+
if (version === '6.7.0') {
117+
// to be removed when we drop support for cypress@6.7.0
118+
it('logs a warning if using a deprecated version of cypress', (done) => {
119+
let stdout = ''
120+
const {
121+
NODE_OPTIONS,
122+
...restEnvVars
123+
} = getCiVisEvpProxyConfig(receiver.port)
124+
125+
childProcess = exec(
126+
`${testCommand} --spec cypress/e2e/spec.cy.js`,
127+
{
128+
cwd,
129+
env: {
130+
...restEnvVars,
131+
CYPRESS_BASE_URL: `http://localhost:${webAppPort}`
132+
},
133+
stdio: 'pipe'
134+
}
135+
)
136+
137+
childProcess.stdout.on('data', (chunk) => {
138+
stdout += chunk.toString()
139+
})
140+
141+
childProcess.on('exit', () => {
142+
assert.include(
143+
stdout,
144+
'WARNING: dd-trace support for Cypress<10.2.0 is deprecated' +
145+
' and will not be supported in future versions of dd-trace.'
146+
)
147+
done()
148+
})
149+
})
150+
}
151+
116152
it('does not crash if badly init', (done) => {
117153
const {
118154
NODE_OPTIONS, // NODE_OPTIONS dd-trace config does not work with cypress

0 commit comments

Comments
 (0)