You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2022/10/07 10:33:23 UTC
[skywalking-nodejs] branch master updated: Ignore no requests if ignoreSuffix is empty (#94)
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-nodejs.git
The following commit(s) were added to refs/heads/master by this push:
new f838ffc Ignore no requests if ignoreSuffix is empty (#94)
f838ffc is described below
commit f838ffc762807fdab4eed74865d77ac8e711ca57
Author: Michael Zangl <gi...@michaelzangl.de>
AuthorDate: Fri Oct 7 12:33:19 2022 +0200
Ignore no requests if ignoreSuffix is empty (#94)
An empty ignore suffix currently causes all requests to be ignored. This makes it impossible to disable ignoring by suffix.
---
src/config/AgentConfig.ts | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/config/AgentConfig.ts b/src/config/AgentConfig.ts
index 8394a61..bda72f2 100644
--- a/src/config/AgentConfig.ts
+++ b/src/config/AgentConfig.ts
@@ -53,10 +53,19 @@ export function finalizeConfig(config: AgentConfig): void {
'i',
);
- const ignoreSuffix = `^.+(?:${config
- .ignoreSuffix!.split(',')
- .map((s) => escapeRegExp(s.trim()))
- .join('|')})$`;
+ const convertIgnoreSuffix = (configuredIgnoreSuffix: string | undefined) => {
+ if (!configuredIgnoreSuffix) {
+ // This regexp will never match => no files are ignored.
+ return '\\A(?!x)x';
+ } else {
+ return `^.+(?:${configuredIgnoreSuffix!
+ .split(',')
+ .map((s) => escapeRegExp(s.trim()))
+ .join('|')})$`;
+ }
+ };
+
+ const ignoreSuffix = convertIgnoreSuffix(config.ignoreSuffix);
const ignorePath =
'^(?:' +
config