Skip to content

Commit

Permalink
Merge pull request #891 from mountaindude/889
Browse files Browse the repository at this point in the history
889
  • Loading branch information
mountaindude authored Sep 11, 2024
2 parents 1163d9c + 2481a99 commit 4e8624e
Show file tree
Hide file tree
Showing 13 changed files with 1,639 additions and 108 deletions.
59 changes: 41 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"@fastify/static": "^7.0.4",
"@influxdata/influxdb-client": "^1.35.0",
"@influxdata/influxdb-client-apis": "^1.35.0",
"axios": "^1.7.5",
"async-mutex": "^0.5.0",
"axios": "^1.7.7",
"commander": "^12.1.0",
"config": "^3.3.12",
"fastify": "^4.28.1",
Expand All @@ -61,15 +62,15 @@
"yaml-validator": "^5.0.1"
},
"devDependencies": {
"@eslint/js": "^9.9.1",
"@eslint/js": "^9.10.0",
"esbuild": "^0.23.1",
"eslint": "^9.9.1",
"eslint": "^9.10.0",
"eslint-config-prettier": "^9.1.0",
"eslint-formatter-table": "^7.32.1",
"eslint-plugin-prettier": "^5.2.1",
"globals": "^15.9.0",
"prettier": "^3.3.3",
"snyk": "^1.1293.0"
"snyk": "^1.1293.1"
},
"pkg": {
"assets": [
Expand Down
9 changes: 7 additions & 2 deletions src/butler-sos.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { setupAnonUsageReportTimer } from './lib/telemetry.js';
import { setupPromClient } from './lib/prom-client.js';
import { verifyConfigFile } from './lib/config-file-verify.js';
import { setupConfigVisServer } from './lib/config-visualise.js';
import { setupUdpEventsStorage } from './lib/udp-event.js';

// Suppress experimental warnings
// https://stackoverflow.com/questions/55778283/how-to-disable-warnings-when-node-is-launched-via-a-global-shell-script
Expand All @@ -51,7 +52,6 @@ process.emit = function (name, data, ...args) {
};

async function sleep(ms) {
// eslint-disable-next-line no-promise-executor-return
return new Promise((resolve) => setTimeout(resolve, ms));
}

Expand Down Expand Up @@ -81,7 +81,6 @@ async function mainScript() {
// Sleep 5 seconds otherwise to llow globals to be initialised

function sleepLocal(ms) {
// eslint-disable-next-line no-promise-executor-return
return new Promise((resolve) => setTimeout(resolve, ms));
}

Expand Down Expand Up @@ -285,6 +284,12 @@ async function mainScript() {
if (globals.config.get('Butler-SOS.configVisualisation.enable') === true) {
await setupConfigVisServer();
}

// Set up rejected user/log events storage, if enabled
if (globals.config.get('Butler-SOS.qlikSenseEvents.rejectedEventCount.enable') === true) {
globals.logger.verbose('MAIN: Rejected events storage enabled');
await setupUdpEventsStorage();
}
}

mainScript();
118 changes: 114 additions & 4 deletions src/config/production_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,27 @@ Butler-SOS:
# insertApiKey: <API key 2 (with insert permissions) from New Relic>
# accountId: <New Relic account ID 2>

# Shared settings for user and log events (see below)
qlikSenseEvents: # Shared settings for user and log events (see below)
influxdb:
enable: true # Should summary (counter) of user and log events be stored in InfluxDB?
writeFrequency: 20000 # How often (milliseconds) should rejected event count be written to InfluxDB?
eventCount: # Track how many events are received from Sense.
# Some events are valid, some are not. Of the valid events, some are rejected by Butler SOS
# based on the configuration in this file.
enable: true # Should event count be stored in InfluxDB?
influxdb:
measurementName: event_count # Name of the InfluxDB measurement where event count is stored
tags: # Tags are added to the data before it's stored in InfluxDB
# - name: env
# value: DEV
# - name: foo
# value: bar
rejectedEventCount:
enable: true # Should rejected events be counted and stored in InfluxDB?
influxdb:
measurementName: rejected_event_count # Name of the InfluxDB measurement where rejected event count is stored

# Track individual users opening/closing apps and starting/stopping sessions.
# Requires log appender XML file(s) to be added to Sense server(s).
userEvents:
Expand All @@ -90,9 +111,9 @@ Butler-SOS:
serverHost: <IP or FQDN> # Host/IP where user event server will listen for events from Sense
portUserActivityEvents: 9997 # Port on which user event server will listen for events from Sense
tags: # Tags are added to the data before it's stored in InfluxDB
# - tag: env
# - name: env
# value: DEV
# - tag: foo
# - name: foo
# value: bar
sendToMQTT:
enable: false # Set to true if user events should be forwarded as MQTT messages
Expand Down Expand Up @@ -127,9 +148,9 @@ Butler-SOS:
serverHost: <IP or FQDN> # Host/IP where log event server will listen for events from Sense
portLogEvents: 9996 # Port on which log event server will listen for events from Sense
tags:
# - tag: env
# - name: env
# value: DEV
# - tag: foo
# - name: foo
# value: bar
source:
engine:
Expand Down Expand Up @@ -205,6 +226,95 @@ Butler-SOS:
category:
- name: qs_log_category
value: unknown
enginePerformanceMonitor: # Detailed app performance data extraction from log events
enable: false # Should app performance data be extracted from log events?
appNameLookup: # Should app names be looked up based on app IDs?
enable: false
trackRejectedEvents:
enable: false # Should events that are rejected by the app performance monitor be tracked?
tags: # Tags are added to the data before it's stored in InfluxDB
# - name: env
# value: DEV
# - name: foo
# value: bar
monitorFilter: # What objects should be monitored? Entire apps or just specific object(s) within some specific app(s)?
# Two kinds of monitoring can be done:
# 1) Monitor all apps, except those listed for exclusion. This is defined in the allApps section.
# 2) Monitor only specific apps. This is defined in the appSpecific section.
# An event will be accepted if it matches any of the rules in the allApps section OR any of the rules in the appSpecific section.
allApps:
enable: false # Should all apps be monitored?
appExclude: # What apps should be excluded from monitoring?
# If both appId and appName are specified, both must match the event's data for it to be considered a match.
- appId: 5b817efe-472d-43ce-8a31-6cce34af7de9
- appName: Sales forecast
- appId: f42d6b16-8faf-45ca-a783-59f9da47db6e
appName: Inventory analysis
objectType:
allObjectTypes: true # Should all object types be monitored?
allObjectTypesExclude: # If allObjectTypes is set to true, the object types in this array are excluded from monitoring.
# someObjectTypesInclude (below) is ignored in that case.
- LoadModelList
- <Unknown>
- linechart
- map
someObjectTypesInclude: # What object types should be included in monitoring?
# Only applicable if allObjectTypes is set to false.
- LoadModelList
- sheet
- barchart
method:
allMethods: true # Should all methods be monitored?
allMethodsExclude: # If allMethods is set to true, the methods in this array are excluded from monitoring.
# someMethodsInclude (below) is ignored in that case.
- Global::OpenApp
- Doc::GetAppLayout
- Doc::CreateSessionObject
someMethodsInclude: # What methods should be included in monitoring?
# Only applicable if allMethods is set to false.
- GenericObject::GetLayout
- GenericObject::GetHyperCubeContinuousData
appSpecific:
enable: false # Should app specific monitoring be done?
app:
- include: # What apps should be monitored?
# If both appId and appName are specified, both must match the event's data for it to be considered a match.
- appId: d7cf16f9-6a95-462a-9ff1-a6d413326de4
- appName: Budget 2025
- appId: 6931136d-c234-4358-a40c-e37153aba7c9
appName: Sales basket analysis
objectType:
allObjectTypes: true # Should all object types be monitored?
allObjectTypesExclude: # If allObjectTypes is set to true, the object types in this array are excluded from monitoring.
# someObjectTypesInclude (below) is ignored in that case.
- table
- map
someObjectTypesInclude: # What object types should be included in monitoring?
# Only applicable if allObjectTypes is set to false.
- sheet
- barchart
- linechart
- map
appObject:
allAppObjects: true # Should all app objects be monitored?
allAppObjectsExclude: # If allAppObjects is set to true, the app objects in this array are excluded from monitoring.
# someAppObjectsInclude (below) is ignored in that case.
- objectId: AaBbCc
- objectId: DdEeFf
someAppObjectsInclude: # What app objects should be included in monitoring?
# Only applicable if allAppObjects is set to false.
- objectId: YJEpPT
method:
allMethods: true # Should all methods be monitored?
allMethodsExclude: # If allMethods is set to true, the methods in this array are excluded from monitoring.
# someMethodsInclude (below) is ignored in that case.
- Global::OpenApp
- Doc::GetAppLayout
- Doc::CreateSessionObject
someMethodsInclude: # What methods should be included in monitoring?
# Only applicable if allMethods is set to false.
- GenericObject::GetLayout
- GenericObject::GetHyperCubeContinuousData
sendToMQTT:
enable: false # Should log events be sent as MQTT messages?
baseTopic: qliksense/logevent # What topic should log events be forwarded to?
Expand Down
Loading

0 comments on commit 4e8624e

Please sign in to comment.