diff --git a/.asf.yaml b/.asf.yaml index 0a7c186..c4e9e21 100644 --- a/.asf.yaml +++ b/.asf.yaml @@ -26,6 +26,7 @@ github: - nodejs - typescript - dapper + dependabot_updates: false enabled_merge_buttons: squash: true merge: false diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 0dd5071..5442bd6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -25,11 +25,11 @@ on: jobs: Build: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest timeout-minutes: 30 strategy: matrix: - node-version: [ 10, 12, 14, 16 ] + node-version: [ 10, 12, 14, 16, 18 ] steps: - uses: actions/checkout@v2 with: diff --git a/.github/workflows/license.yaml b/.github/workflows/license.yaml index 8cc198d..818784f 100644 --- a/.github/workflows/license.yaml +++ b/.github/workflows/license.yaml @@ -25,7 +25,7 @@ on: jobs: License: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest timeout-minutes: 30 steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 1169706..3295e1b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -25,11 +25,11 @@ on: jobs: TestPlugins: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest timeout-minutes: 30 strategy: matrix: - node-version: [ 10, 12, 14, 15 ] + node-version: [ 10, 12, 14, 16, 18 ] env: SW_NODE_VERSION: ${{ matrix.node-version }} steps: @@ -63,7 +63,7 @@ jobs: npm run test TestLib: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest timeout-minutes: 30 steps: - uses: actions/checkout@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a6a5d2..ea8eab3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.7.0 + +* Add deadline config for trace request (#118) + # 0.6.0 * Add missing build doc by @kezhenxu94 in https://github.com/apache/skywalking-nodejs/pull/92 diff --git a/README.md b/README.md index 935a5cd..4b19e74 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,8 @@ Environment Variable | Description | Default | `SW_AWS_LAMBDA_CHAIN` | Pass trace ID to AWS Lambda function in its parameters (to allow linking). Only use if both caller and callee will be instrumented. | `false` | | `SW_AWS_SQS_CHECK_BODY` | Incoming SQS messages check inside the body for trace ID in order to allow linking outgoing SNS messages to incoming SQS. | `false` | | `SW_AGENT_MAX_BUFFER_SIZE` | The maximum buffer size before sending the segment data to backend | `'1000'` | +| `SW_AGENT_TRACE_TIMEOUT` | The timeout for trace requests to backend services | `'10000'` | + Note that the various ignore options like `SW_IGNORE_SUFFIX`, `SW_TRACE_IGNORE_PATH` and `SW_HTTP_IGNORE_METHOD` as well as endpoints which are not recorded due to exceeding `SW_AGENT_MAX_BUFFER_SIZE` all propagate their ignored status downstream to any other endpoints they may call. If that endpoint is running the Node Skywalking agent then regardless of its ignore settings it will not be recorded since its upstream parent was not recorded. This allows the elimination of entire trees of endpoints you are not interested in as well as eliminating partial traces if a span in the chain is ignored but calls out to other endpoints which are recorded as children of ROOT instead of the actual parent. diff --git a/package-lock.json b/package-lock.json index 5c8b742..dc873f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "skywalking-backend-js", - "version": "0.6.0", + "version": "0.7.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index b04092d..9da4a27 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "skywalking-backend-js", - "version": "0.6.0", + "version": "0.7.0", "description": "The NodeJS agent for Apache SkyWalking", "homepage": "skywalking.apache.org", "main": "lib/index.js", diff --git a/src/agent/protocol/grpc/clients/TraceReportClient.ts b/src/agent/protocol/grpc/clients/TraceReportClient.ts index 1ef0003..3f6f102 100755 --- a/src/agent/protocol/grpc/clients/TraceReportClient.ts +++ b/src/agent/protocol/grpc/clients/TraceReportClient.ts @@ -60,13 +60,17 @@ export default class TraceReportClient implements Client { return; } - const stream = this.reporterClient.collect(AuthInterceptor(), (error, _) => { - if (error) { - logger.error('Failed to report trace data', error); - } + const stream = this.reporterClient.collect( + AuthInterceptor(), + { deadline: Date.now() + config.traceTimeout }, + (error, _) => { + if (error) { + logger.error('Failed to report trace data', error); + } - if (callback) callback(); - }); + if (callback) callback(); + }, + ); try { for (const segment of this.buffer) { diff --git a/src/config/AgentConfig.ts b/src/config/AgentConfig.ts index ad82b59..ca33587 100644 --- a/src/config/AgentConfig.ts +++ b/src/config/AgentConfig.ts @@ -42,6 +42,7 @@ export type AgentConfig = { reDisablePlugins?: RegExp; reIgnoreOperation?: RegExp; reHttpIgnoreMethod?: RegExp; + traceTimeout?: number; }; export function finalizeConfig(config: AgentConfig): void { @@ -136,6 +137,9 @@ const _config = { reDisablePlugins: RegExp(''), // temporary placeholder so Typescript doesn't throw a fit reIgnoreOperation: RegExp(''), reHttpIgnoreMethod: RegExp(''), + traceTimeout: Number.isSafeInteger(process.env.SW_AGENT_TRACE_TIMEOUT) + ? Number.parseInt(process.env.SW_AGENT_TRACE_TIMEOUT as string, 10) + : 10 * 1000, }; export default _config;