Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add experimental tracing using a native event collector #4250

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/collector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Collector

on:
pull_request:
push:
branches: [master]

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true

jobs:
express:
runs-on: ubuntu-latest
env:
PLUGINS: express|body-parser|cookie-parser
steps:
- uses: actions/checkout@v4
- run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
- uses: ./.github/actions/testagent/start
- uses: ./.github/actions/node/setup
- run: yarn install
- run: git clone https://github.com/DataDog/libdatadog-nodejs.git
- uses: ./.github/actions/node/oldest
- run: cd libdatadog-nodejs && npm install && npm run build
- run: NODE_OPTIONS="-r $PWD/libdatadog-nodejs/global" yarn test:plugins:ci
- uses: ./.github/actions/node/latest
- run: cd libdatadog-nodejs && npm install && npm run build
- run: NODE_OPTIONS="-r $PWD/libdatadog-nodejs/global" yarn test:plugins:ci
- if: always()
uses: ./.github/actions/testagent/logs
34 changes: 34 additions & 0 deletions integration-tests/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,40 @@ class FakeAgent extends EventEmitter {
payload: msgpack.decode(req.body, { codec })
})
})
app.put('/v0.5/traces', (req, res) => {
if (req.body.length === 0) return res.status(200).send()
res.status(200).send({ rate_by_service: { 'service:,env:': 1 } })
const [strings, traces] = msgpack.decode(req.body, { codec })
this.emit('message', {
headers: req.headers,
payload: traces.map(trace => {
return trace.map(span => {
const meta = {}
const metrics = {}

Object.keys(span[9]).forEach(key => { meta[strings[key]] = strings[span[9][key]] })
Object.keys(span[10]).forEach(key => { metrics[strings[key]] = span[10][key] })

span = {
service: strings[span[0]],
name: strings[span[1]],
resource: strings[span[2]],
trace_id: span[3],
span_id: span[4],
parent_id: span[5],
start: span[6],
duration: span[7],
error: span[8],
meta,
metrics,
type: strings[span[11]]
}

return span
})
})
})
})
app.post('/profiling/v1/input', upload.any(), (req, res) => {
res.status(200).send()
this.emit('message', {
Expand Down
4 changes: 2 additions & 2 deletions packages/datadog-plugin-express/test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1471,13 +1471,13 @@ describe('Plugin', () => {
})

describe('with configuration for middleware disabled', () => {
before(() => {
beforeEach(() => {
return agent.load(['express', 'http'], [{
middleware: false
}, { client: false }])
})

after(() => {
afterEach(() => {
return agent.close({ ritmReset: false })
})

Expand Down
Loading
Loading