fix(http): build error
This commit is contained in:
parent
4571ede515
commit
5cc7794daa
12
package.json
12
package.json
@ -31,6 +31,13 @@
|
|||||||
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.ts'",
|
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.ts'",
|
||||||
"watch": "tsc -w"
|
"watch": "tsc -w"
|
||||||
},
|
},
|
||||||
|
"keywords": [
|
||||||
|
"tachybase",
|
||||||
|
"opentelemetry",
|
||||||
|
"nodejs",
|
||||||
|
"tracing",
|
||||||
|
"instrumentation"
|
||||||
|
],
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://git.daoyoucloud.com/TomyJan/opentelemetry-auto-instrumentations/issues"
|
"url": "https://git.daoyoucloud.com/TomyJan/opentelemetry-auto-instrumentations/issues"
|
||||||
},
|
},
|
||||||
@ -103,7 +110,10 @@
|
|||||||
"files": [
|
"files": [
|
||||||
"build/src/**/*.js",
|
"build/src/**/*.js",
|
||||||
"build/src/**/*.js.map",
|
"build/src/**/*.js.map",
|
||||||
"build/src/**/*.d.ts"
|
"build/src/**/*.d.ts",
|
||||||
|
"doc",
|
||||||
|
"LICENSE",
|
||||||
|
"README.md"
|
||||||
],
|
],
|
||||||
"changelog": {
|
"changelog": {
|
||||||
"labels": {
|
"labels": {
|
||||||
|
2
plugins/node/opentelemetry-instrumentation-http/.npmrc
Normal file
2
plugins/node/opentelemetry-instrumentation-http/.npmrc
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
registry=https://registry.npmjs.org/
|
||||||
|
@tachybase:registry=https://registry.npmjs.org/
|
14801
plugins/node/opentelemetry-instrumentation-http/package-lock.json
generated
Normal file
14801
plugins/node/opentelemetry-instrumentation-http/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,30 +1,38 @@
|
|||||||
{
|
{
|
||||||
"name": "@opentelemetry/instrumentation-http",
|
"name": "@tachybase/opentelemetry-instrumentation-http",
|
||||||
"version": "0.52.1",
|
"version": "0.0.1",
|
||||||
"description": "OpenTelemetry instrumentation for `node:http` and `node:https` http client and server modules",
|
"description": "OpenTelemetry instrumentation for `node:http` and `node:https` http client and server modules for TachyBase",
|
||||||
|
"author": "TachyBase Team",
|
||||||
|
"homepage": "https://git.daoyoucloud.com/TomyJan/opentelemetry-auto-instrumentations/plugins/node/opentelemetry-instrumentation-http",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14"
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public",
|
||||||
|
"registry": "https://registry.npmjs.org/"
|
||||||
|
},
|
||||||
"main": "build/src/index.js",
|
"main": "build/src/index.js",
|
||||||
"types": "build/src/index.d.ts",
|
"types": "build/src/index.d.ts",
|
||||||
"repository": "open-telemetry/opentelemetry-js",
|
"exports": {
|
||||||
|
".": "./build/src/index.js",
|
||||||
|
"./register": "./build/src/register.js"
|
||||||
|
},
|
||||||
|
"repository": "https://git.daoyoucloud.com/TomyJan/opentelemetry-auto-instrumentations",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepublishOnly": "npm run compile",
|
|
||||||
"compile": "tsc --build",
|
|
||||||
"clean": "tsc --build --clean",
|
"clean": "tsc --build --clean",
|
||||||
"test:cjs": "nyc mocha test/**/*.test.ts",
|
"compile": "tsc --build",
|
||||||
"test:esm": "nyc node --experimental-loader=@opentelemetry/instrumentation/hook.mjs ../../../node_modules/mocha/bin/mocha 'test/**/*.test.mjs'",
|
|
||||||
"test": "npm run test:cjs && npm run test:esm",
|
|
||||||
"tdd": "npm run test -- --watch-extensions ts --watch",
|
|
||||||
"lint": "eslint . --ext .ts",
|
"lint": "eslint . --ext .ts",
|
||||||
"lint:fix": "eslint . --ext .ts --fix",
|
"lint:fix": "eslint . --ext .ts --fix",
|
||||||
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../",
|
"precompile": "cross-var lerna run version --include-dependencies",
|
||||||
"version": "node ../../../scripts/version-update.js",
|
"prewatch": "npm run precompile",
|
||||||
"watch": "tsc --build --watch",
|
"prepublishOnly": "npm run compile",
|
||||||
"precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies",
|
"tdd": "npm run test -- --watch-extensions ts --watch",
|
||||||
"prewatch": "node ../../../scripts/version-update.js",
|
"test": "npm run test:cjs && npm run test:esm",
|
||||||
"peer-api-check": "node ../../../scripts/peer-api-check.js",
|
"watch": "tsc --build --watch"
|
||||||
"align-api-deps": "node ../../../scripts/align-api-deps.js",
|
|
||||||
"maint:regenerate-test-certs": "cd test/fixtures && ./regenerate.sh"
|
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
"tachybase",
|
||||||
"opentelemetry",
|
"opentelemetry",
|
||||||
"http",
|
"http",
|
||||||
"nodejs",
|
"nodejs",
|
||||||
@ -32,21 +40,11 @@
|
|||||||
"profiling",
|
"profiling",
|
||||||
"instrumentation"
|
"instrumentation"
|
||||||
],
|
],
|
||||||
"author": "OpenTelemetry Authors",
|
"bugs": {
|
||||||
"license": "Apache-2.0",
|
"url": "https://git.daoyoucloud.com/TomyJan/opentelemetry-auto-instrumentations/issues"
|
||||||
"engines": {
|
|
||||||
"node": ">=14"
|
|
||||||
},
|
},
|
||||||
"files": [
|
"peerDependencies": {
|
||||||
"build/src/**/*.js",
|
"@opentelemetry/api": "^1.3.0"
|
||||||
"build/src/**/*.js.map",
|
|
||||||
"build/src/**/*.d.ts",
|
|
||||||
"doc",
|
|
||||||
"LICENSE",
|
|
||||||
"README.md"
|
|
||||||
],
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@opentelemetry/api": "1.9.0",
|
"@opentelemetry/api": "1.9.0",
|
||||||
@ -73,15 +71,18 @@
|
|||||||
"superagent": "9.0.2",
|
"superagent": "9.0.2",
|
||||||
"typescript": "4.4.4"
|
"typescript": "4.4.4"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
|
||||||
"@opentelemetry/api": "^1.3.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@opentelemetry/core": "1.25.1",
|
"@opentelemetry/core": "1.25.1",
|
||||||
"@opentelemetry/instrumentation": "0.52.1",
|
"@opentelemetry/instrumentation": "0.52.1",
|
||||||
"@opentelemetry/semantic-conventions": "1.25.1",
|
"@opentelemetry/semantic-conventions": "1.25.1",
|
||||||
"semver": "^7.5.2"
|
"semver": "^7.5.2"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-http",
|
"files": [
|
||||||
"sideEffects": false
|
"build/src/**/*.js",
|
||||||
|
"build/src/**/*.js.map",
|
||||||
|
"build/src/**/*.d.ts",
|
||||||
|
"doc",
|
||||||
|
"LICENSE",
|
||||||
|
"README.md"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ import {
|
|||||||
Https,
|
Https,
|
||||||
} from './types';
|
} from './types';
|
||||||
import * as utils from './utils';
|
import * as utils from './utils';
|
||||||
import { VERSION } from './version';
|
import packageJson from '../package.json';
|
||||||
import {
|
import {
|
||||||
InstrumentationBase,
|
InstrumentationBase,
|
||||||
InstrumentationNodeModuleDefinition,
|
InstrumentationNodeModuleDefinition,
|
||||||
@ -70,7 +70,7 @@ export class HttpInstrumentation extends InstrumentationBase<HttpInstrumentation
|
|||||||
private _httpClientDurationHistogram!: Histogram;
|
private _httpClientDurationHistogram!: Histogram;
|
||||||
|
|
||||||
constructor(config: HttpInstrumentationConfig = {}) {
|
constructor(config: HttpInstrumentationConfig = {}) {
|
||||||
super('@opentelemetry/instrumentation-http', VERSION, config);
|
super('@opentelemetry/instrumentation-http', packageJson?.version, config);
|
||||||
this._headerCapture = this._createHeaderCapture();
|
this._headerCapture = this._createHeaderCapture();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,8 +39,8 @@ import {
|
|||||||
SEMATTRS_NET_PEER_PORT,
|
SEMATTRS_NET_PEER_PORT,
|
||||||
SEMATTRS_NET_TRANSPORT,
|
SEMATTRS_NET_TRANSPORT,
|
||||||
} from '@opentelemetry/semantic-conventions';
|
} from '@opentelemetry/semantic-conventions';
|
||||||
import * as assert from 'assert';
|
import assert from 'assert';
|
||||||
import * as nock from 'nock';
|
import nock from 'nock';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import { HttpInstrumentation } from '../../src/http';
|
import { HttpInstrumentation } from '../../src/http';
|
||||||
import { HttpInstrumentationConfig } from '../../src/types';
|
import { HttpInstrumentationConfig } from '../../src/types';
|
||||||
@ -609,7 +609,7 @@ describe('HttpInstrumentation', () => {
|
|||||||
)}`, async () => {
|
)}`, async () => {
|
||||||
try {
|
try {
|
||||||
await httpRequest.get(arg);
|
await httpRequest.get(arg);
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
// request has been made
|
// request has been made
|
||||||
// nock throw
|
// nock throw
|
||||||
assert.ok(error.message.startsWith('Nock: No match for request'));
|
assert.ok(error.message.startsWith('Nock: No match for request'));
|
||||||
@ -625,7 +625,7 @@ describe('HttpInstrumentation', () => {
|
|||||||
)}`, async () => {
|
)}`, async () => {
|
||||||
try {
|
try {
|
||||||
await httpRequest.get(arg as any);
|
await httpRequest.get(arg as any);
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
// request has been made
|
// request has been made
|
||||||
// nock throw
|
// nock throw
|
||||||
assert.ok(
|
assert.ok(
|
||||||
|
@ -33,7 +33,7 @@ instrumentation.enable();
|
|||||||
instrumentation.disable();
|
instrumentation.disable();
|
||||||
|
|
||||||
import * as http from 'http';
|
import * as http from 'http';
|
||||||
import * as request from 'request-promise-native';
|
import request from 'request-promise-native';
|
||||||
import * as superagent from 'superagent';
|
import * as superagent from 'superagent';
|
||||||
// Temporarily removed. See https://github.com/open-telemetry/opentelemetry-js/issues/3344
|
// Temporarily removed. See https://github.com/open-telemetry/opentelemetry-js/issues/3344
|
||||||
// import * as got from 'got';
|
// import * as got from 'got';
|
||||||
|
@ -40,7 +40,7 @@ import {
|
|||||||
} from '@opentelemetry/semantic-conventions';
|
} from '@opentelemetry/semantic-conventions';
|
||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as nock from 'nock';
|
import nock from 'nock';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import { HttpInstrumentation } from '../../src/http';
|
import { HttpInstrumentation } from '../../src/http';
|
||||||
import { assertSpan } from '../utils/assertSpan';
|
import { assertSpan } from '../utils/assertSpan';
|
||||||
@ -473,7 +473,7 @@ describe('HttpsInstrumentation', () => {
|
|||||||
)}`, async () => {
|
)}`, async () => {
|
||||||
try {
|
try {
|
||||||
await httpsRequest.get(arg);
|
await httpsRequest.get(arg);
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
// request has been made
|
// request has been made
|
||||||
// nock throw
|
// nock throw
|
||||||
assert.ok(error.message.startsWith('Nock: No match for request'));
|
assert.ok(error.message.startsWith('Nock: No match for request'));
|
||||||
@ -489,7 +489,7 @@ describe('HttpsInstrumentation', () => {
|
|||||||
)}`, async () => {
|
)}`, async () => {
|
||||||
try {
|
try {
|
||||||
await httpsRequest.get(arg as any);
|
await httpsRequest.get(arg as any);
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
// request has been made
|
// request has been made
|
||||||
// nock throw
|
// nock throw
|
||||||
assert.ok(
|
assert.ok(
|
||||||
|
@ -33,7 +33,7 @@ instrumentation.enable();
|
|||||||
instrumentation.disable();
|
instrumentation.disable();
|
||||||
|
|
||||||
import * as http from 'http';
|
import * as http from 'http';
|
||||||
import * as request from 'request-promise-native';
|
import request from 'request-promise-native';
|
||||||
import * as superagent from 'superagent';
|
import * as superagent from 'superagent';
|
||||||
// Temporarily removed. See https://github.com/open-telemetry/opentelemetry-js/issues/3344
|
// Temporarily removed. See https://github.com/open-telemetry/opentelemetry-js/issues/3344
|
||||||
// import * as got from 'got';
|
// import * as got from 'got';
|
||||||
|
@ -390,7 +390,7 @@ describe('HttpInstrumentation Integration tests', () => {
|
|||||||
`${protocol}://localhost:${mockServerPort}/timeout`,
|
`${protocol}://localhost:${mockServerPort}/timeout`,
|
||||||
{ timeout: 1 }
|
{ timeout: 1 }
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err: any) {
|
||||||
assert.ok(err.message.startsWith('timeout'));
|
assert.ok(err.message.startsWith('timeout'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,36 +2,12 @@
|
|||||||
"extends": "../../../tsconfig.base.json",
|
"extends": "../../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "build",
|
"outDir": "build",
|
||||||
"rootDir": "."
|
"rootDir": ".",
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"resolveJsonModule": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*.ts",
|
"src/**/*.ts",
|
||||||
"test/**/*.ts"
|
"test/**/*.ts"
|
||||||
],
|
|
||||||
"references": [
|
|
||||||
{
|
|
||||||
"path": "../../../api"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "../../../packages/opentelemetry-context-async-hooks"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "../../../packages/opentelemetry-core"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "../../../packages/opentelemetry-sdk-trace-base"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "../../../packages/opentelemetry-sdk-trace-node"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "../../../packages/opentelemetry-semantic-conventions"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "../../../packages/sdk-metrics"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "../opentelemetry-instrumentation"
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user