Skip to content

Commit 66cc6ad

Browse files
committed
Add ignoreLogs configuration option
Read the `ignoreLogs` config option from `appsignal.cjs`, or the `APPSIGNAL_IGNORE_LOGS` environment variable, and re-export it for the AppSignal agent as the `_APPSIGNAL_IGNORE_LOGS` environment variable. [skip changeset] because the corresponding changeset will be added (modified slightly) from the [agent PR][agent] [agent]: appsignal/appsignal-agent#1127
1 parent ae4a6a5 commit 66cc6ad

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

src/__tests__/config.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ describe("Configuration", () => {
3636
filterSessionData: [],
3737
ignoreActions: [],
3838
ignoreErrors: [],
39+
ignoreLogs: [],
3940
ignoreNamespaces: [],
4041
initializeOpentelemetrySdk: true,
4142
log: "file",
@@ -360,6 +361,7 @@ describe("Configuration", () => {
360361
expect(env("_APPSIGNAL_HTTP_PROXY")).toBeUndefined()
361362
expect(env("_APPSIGNAL_IGNORE_ACTIONS")).toBeUndefined()
362363
expect(env("_APPSIGNAL_IGNORE_ERRORS")).toBeUndefined()
364+
expect(env("_APPSIGNAL_IGNORE_LOGS")).toBeUndefined()
363365
expect(env("_APPSIGNAL_IGNORE_NAMESPACES")).toBeUndefined()
364366
expect(env("_APPSIGNAL_LOG")).toEqual("file")
365367
expect(env("_APPSIGNAL_LOG_LEVEL")).toBeUndefined()
@@ -412,6 +414,7 @@ describe("Configuration", () => {
412414
httpProxy: "http://localhost",
413415
ignoreActions: ["MyAction", "MyOtherAction"],
414416
ignoreErrors: ["MyError", "MyOtherError"],
417+
ignoreLogs: ["^start$", "^Completed 2.* in .*ms$"],
415418
ignoreNamespaces: ["MyNamespace", "MyOtherNamespace"],
416419
logLevel: "debug",
417420
logPath: "/tmp/other",
@@ -445,6 +448,9 @@ describe("Configuration", () => {
445448
"MyAction,MyOtherAction"
446449
)
447450
expect(env("_APPSIGNAL_IGNORE_ERRORS")).toEqual("MyError,MyOtherError")
451+
expect(env("_APPSIGNAL_IGNORE_LOGS")).toEqual(
452+
"^start$,^Completed 2.* in .*ms$"
453+
)
448454
expect(env("_APPSIGNAL_IGNORE_NAMESPACES")).toEqual(
449455
"MyNamespace,MyOtherNamespace"
450456
)

src/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ export class Configuration {
135135
filterSessionData: [],
136136
ignoreActions: [],
137137
ignoreErrors: [],
138+
ignoreLogs: [],
138139
ignoreNamespaces: [],
139140
initializeOpentelemetrySdk: true,
140141
log: "file",

src/config/configmap.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const ENV_TO_KEY_MAPPING = {
2222
APPSIGNAL_HTTP_PROXY: "httpProxy",
2323
APPSIGNAL_IGNORE_ACTIONS: "ignoreActions",
2424
APPSIGNAL_IGNORE_ERRORS: "ignoreErrors",
25+
APPSIGNAL_IGNORE_LOGS: "ignoreLogs",
2526
APPSIGNAL_IGNORE_NAMESPACES: "ignoreNamespaces",
2627
APPSIGNAL_INITIALIZE_OPENTELEMETRY_SDK: "initializeOpentelemetrySdk",
2728
APPSIGNAL_LOG: "log",
@@ -61,6 +62,7 @@ export const PRIVATE_ENV_MAPPING: Record<string, keyof AppsignalOptions> = {
6162
_APPSIGNAL_HTTP_PROXY: "httpProxy",
6263
_APPSIGNAL_IGNORE_ACTIONS: "ignoreActions",
6364
_APPSIGNAL_IGNORE_ERRORS: "ignoreErrors",
65+
_APPSIGNAL_IGNORE_LOGS: "ignoreLogs",
6466
_APPSIGNAL_IGNORE_NAMESPACES: "ignoreNamespaces",
6567
_APPSIGNAL_LOG: "log",
6668
_APPSIGNAL_LOG_LEVEL: "logLevel",
@@ -100,6 +102,7 @@ export const JS_TO_RUBY_MAPPING: Record<keyof AppsignalOptions, string> = {
100102
httpProxy: "http_proxy",
101103
ignoreActions: "ignore_actions",
102104
ignoreErrors: "ignore_errors",
105+
ignoreLogs: "ignore_logs",
103106
ignoreNamespaces: "ignore_namespaces",
104107
initializeOpentelemetrySdk: "initialize_opentelemetry_sdk",
105108
log: "log",
@@ -159,6 +162,7 @@ export const LIST_KEYS: (keyof typeof ENV_TO_KEY_MAPPING)[] = [
159162
"APPSIGNAL_FILTER_SESSION_DATA",
160163
"APPSIGNAL_IGNORE_ACTIONS",
161164
"APPSIGNAL_IGNORE_ERRORS",
165+
"APPSIGNAL_IGNORE_LOGS",
162166
"APPSIGNAL_IGNORE_NAMESPACES",
163167
"APPSIGNAL_REQUEST_HEADERS"
164168
]

src/config/options.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export type AppsignalOptions = {
2222
httpProxy: string
2323
ignoreActions: string[]
2424
ignoreErrors: string[]
25+
ignoreLogs: string[]
2526
ignoreNamespaces: string[]
2627
initializeOpentelemetrySdk: boolean
2728
log: string

0 commit comments

Comments
 (0)