-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore traces on incoming request on / and /ping
Add `deployment.environment=local` as default env variable. Default diagLogLevel to ERROR.
- Loading branch information
1 parent
0e0afeb
commit 07a433b
Showing
18 changed files
with
171 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
OPEN_TELEMETRY_PROJECT_NAME := open-telemetry | ||
OPEN_TELEMETRY_PROJECT_DIR := ./packages/open-telemetry | ||
|
||
# == Code format == | ||
|
||
open-telemetry/format: | ||
npx nx format:write --projects ${OPEN_TELEMETRY_PROJECT_NAME} | ||
|
||
open-telemetry/lint: | ||
npx nx lint ${OPEN_TELEMETRY_PROJECT_NAME} -- --fix | ||
|
||
open-telemetry/format/check: | ||
npx nx format:check --projects ${OPEN_TELEMETRY_PROJECT_NAME} | ||
|
||
open-telemetry/lint/check: | ||
npx nx lint ${OPEN_TELEMETRY_PROJECT_NAME} | ||
|
||
# == Testing == | ||
|
||
open-telemetry/test/type: | ||
npx tsc \ | ||
--project ${OPEN_TELEMETRY_PROJECT_DIR}/tsconfig.lib.json \ | ||
--noEmit | ||
|
||
open-telemetry/test/unit: | ||
npx nx test:unit ${OPEN_TELEMETRY_PROJECT_NAME} -- ${ARGS} | ||
|
||
open-telemetry/test/unit/watch: | ||
make open-telemetry/test/unit ARGS=--watch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
/* eslint-disable */ | ||
export default { | ||
import type { Config } from 'jest' | ||
|
||
const config: Config = { | ||
displayName: 'open-telemetry', | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], | ||
preset: '../../jest.preset.js', | ||
testEnvironment: 'node', | ||
transform: { | ||
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }] | ||
}, | ||
moduleFileExtensions: ['ts', 'js', 'html'], | ||
coverageDirectory: '../../coverage/packages/open-telemetry' | ||
'^.+\\.[tj]sx?$': [ | ||
'ts-jest', | ||
{ | ||
tsconfig: '<rootDir>/tsconfig.spec.json' | ||
} | ||
] | ||
} | ||
} | ||
|
||
export default config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import type { Config } from 'jest' | ||
import sharedConfig from './jest.config' | ||
|
||
const config: Config = { | ||
...sharedConfig, | ||
testMatch: ['<rootDir>/**/__test__/unit/**/*.spec.ts'] | ||
} | ||
|
||
export default config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
packages/open-telemetry/src/lib/__test__/unit/open-telemetry.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { IncomingMessage } from 'http' | ||
import { Socket } from 'net' | ||
import { ignoreIncomingRequestHook } from '../../open-telemetry' | ||
|
||
const buildIncomingMessage = (url: string, method = 'GET') => { | ||
const socket = new Socket() | ||
const message = new IncomingMessage(socket) | ||
|
||
message.url = url | ||
message.method = method | ||
message.headers = { | ||
host: 'localhost:3000', | ||
'user-agent': 'Mozilla/5.0', | ||
accept: '*/*' | ||
} | ||
|
||
return message | ||
} | ||
|
||
describe('ignoreIncomingRequestHook', () => { | ||
const rootTestCases = [ | ||
buildIncomingMessage('/'), | ||
buildIncomingMessage('/?foo='), | ||
buildIncomingMessage('/?foo=bar'), | ||
buildIncomingMessage('/?'), | ||
buildIncomingMessage('/&') | ||
] | ||
|
||
const pingTestCases = [ | ||
buildIncomingMessage('/ping'), | ||
buildIncomingMessage('/ping?foo='), | ||
buildIncomingMessage('/ping?foo=bar'), | ||
buildIncomingMessage('/ping?'), | ||
buildIncomingMessage('/ping&') | ||
] | ||
|
||
const ignoreTestCases = [...rootTestCases, ...pingTestCases] | ||
|
||
for (const request of ignoreTestCases) { | ||
it(`ignores ${request.url}`, () => { | ||
expect(ignoreIncomingRequestHook(request)).toEqual(true) | ||
}) | ||
} | ||
|
||
const doNotIgnoreTestCases = [ | ||
buildIncomingMessage('/foo'), | ||
buildIncomingMessage('/ready'), | ||
buildIncomingMessage('/bar'), | ||
buildIncomingMessage('/client') | ||
] | ||
|
||
for (const request of doNotIgnoreTestCases) { | ||
it(`does not ignore ${request.url}`, () => { | ||
expect(ignoreIncomingRequestHook(request)).toEqual(false) | ||
}) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 1 addition & 8 deletions
9
packages/transaction-request-intent/src/lib/__test__/unit/decoders.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters