Skip to content
Merged
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
53 changes: 53 additions & 0 deletions .github/workflows/build.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

name: Build

on:
pull_request:
push:
branches:
- master

jobs:
Build:
runs-on: ubuntu-18.04
timeout-minutes: 30
strategy:
matrix:
node-version: [ 12, 14 ]
steps:
- uses: actions/checkout@v2
with:
submodules: true

- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Set Up NodeJS ${{ matrix.node-version }}
uses: actions/setup-node@v2-beta
with:
node-version: ${{ matrix.node-version }}

- name: Build
run: |
npm i
npm run build
53 changes: 53 additions & 0 deletions .github/workflows/test.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

name: Test

on:
pull_request:
push:
branches:
- master

jobs:
Build:
runs-on: ubuntu-18.04
timeout-minutes: 30
strategy:
matrix:
node-version: [ 12, 14 ]
steps:
- uses: actions/checkout@v2
with:
submodules: true

- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Set Up NodeJS ${{ matrix.node-version }}
uses: actions/setup-node@v2-beta
with:
node-version: ${{ matrix.node-version }}

- name: Test
run: |
npm i
npm run test
37 changes: 11 additions & 26 deletions tests/plugins/http/expected.data.yaml
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,21 +21,25 @@ segmentItems:
segments:
- segmentId: not null
spans:
- operationName: /xml
- operationName: /test
operationId: 0
parentSpanId: 0
spanId: 2
parentSpanId: -1
spanId: 0
spanLayer: Http
startTime: gt 0
endTime: gt 0
componentId: 2
componentId: 49
isError: false
spanType: Exit
peer: httpbin.org
spanType: Entry
peer: ''
skipAnalysis: false
tags:
- { key: http.url, value: httpbin.org/xml }
- { key: http.url, value: /test }
- { key: http.status.code, value: '200' }
refs:
- { parentEndpoint: '', networkAddress: 'server:5000', refType: CrossProcess,
parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstance: not null,
parentService: client, traceId: not null }
- operationName: /json
operationId: 0
parentSpanId: 0
Expand All@@ -51,25 +55,6 @@ segmentItems:
tags:
- { key: http.url, value: httpbin.org/json }
- { key: http.status.code, value: '200' }
- operationName: /test
operationId: 0
parentSpanId: -1
spanId: 0
spanLayer: Http
startTime: gt 0
endTime: gt 0
componentId: 49
isError: false
spanType: Entry
peer: ''
skipAnalysis: false
tags:
- { key: http.url, value: /test }
- { key: http.status.code, value: '200' }
refs:
- { parentEndpoint: '', networkAddress: 'server:5000', refType: CrossProcess,
parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstance: not null,
parentService: client, traceId: not null }
- serviceName: client
segmentSize: 1
segments:
Expand Down
10 changes: 1 addition & 9 deletions tests/plugins/http/server.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,15 +30,7 @@ const server = http.createServer((req, res) => {
.request('http://httpbin.org/json', (r) => {
let data = '';
r.on('data', (chunk) => (data += chunk));
r.on('end', () => setImmediate(() => res.write(data)));
})
.end();

http
.request('http://httpbin.org/xml', async (r) => {
let data = '';
r.on('data', (chunk) => (data += chunk));
r.on('end', () => setTimeout(() => res.end(data), 1000));
r.on('end', () => res.end(data));
})
.end();
});
Expand Down