Dedup metrics influx 1#1648
Open
mountaindude wants to merge 6 commits into
Open
Conversation
- Implemented functionality to send UDP queue metrics to InfluxDB for monitoring and analysis. - Added configuration options for enabling metrics collection, including drop counters, message counters, queue state, processing times, deduplication, and rate limiting. - Created a new documentation file detailing the UDP queue metrics feature, including configuration and example Grafana queries. - Updated existing configuration files to include new metrics settings. - Enhanced error handling and logging for InfluxDB writes. - Added unit tests for the new metrics functionality to ensure reliability and correctness.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an optional feature to persist internal UDP queue/dedup/drop metrics from Butler’s UDP processing pipeline into the existing InfluxDB backend, making these operational metrics available for long-term monitoring and alerting.
Changes:
- Add a periodic InfluxDB writer for UDP queue metrics and start it during UDP server initialization when enabled.
- Extend configuration schema and YAML templates to support per-category metric toggles and feature-specific tags.
- Add documentation and unit tests for the new UDP queue metrics → InfluxDB feature (plus some unrelated formatting/doc housekeeping).
Reviewed changes
Copilot reviewed 19 out of 24 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/udp/udp_handlers.js | Starts UDP queue metrics timer when both InfluxDB + queueMetrics are enabled. |
| src/qrs_util/tests/reload_task_execution_results.test.js | Formatting-only test file adjustment. |
| src/lib/qseow/scriptlog.js | Log formatting change (multi-line warn). |
| src/lib/qseow/qliksense_version.js | Log formatting refactor in error handling. |
| src/lib/influxdb/udp_queue_metrics.js | New module: builds/writes UDP queue metrics datapoints and schedules periodic writes. |
| src/lib/influxdb/index.js | Re-exports new UDP queue metrics functions. |
| src/lib/influxdb/tests/udp_queue_metrics.test.js | New unit tests for UDP queue metrics writer + timer behavior. |
| src/lib/incident_mgmt/tests/new_relic.test.js | Formatting-only change. |
| src/lib/assert/config-file-schema.js | Adds schema support for per-category UDP queue metrics config. |
| src/lib/assert/assert_config_file.js | Formatting-only change in long config key access. |
| src/config/production_template.yaml | Adds new UDP queue metrics config block in template. |
| src/config/config-gen-api-docs.yaml | Adds new UDP queue metrics config block used for API docs generation. |
| docs/to-doc-site/udp-queue-metrics-influxdb.md | New operator-facing documentation for UDP queue metrics written to InfluxDB. |
| docs/to-doc-site/udp-message-deduplication-fix.md | Removes a doc staging file. |
| docs/to-doc-site/rest-api-https-support.md | Removes a doc staging file. |
| docs/to-doc-site/README.md | New README describing the docs staging workflow and conventions. |
| docs/to-doc-site/qrs-api-error-messages.md | Removes a doc staging file. |
| docs/to-doc-site/app-dump-lineage.md | Removes a doc staging file. |
| CLAUDE.md | Updates GitNexus index counts. |
| AGENTS.md | Updates GitNexus index counts. |
| .claude/skills/generated/smtp/SKILL.md | Updates generated line references. |
| .claude/skills/generated/qrs-util/SKILL.md | Updates generated line references. |
| .claude/skills/generated/assert/SKILL.md | Updates generated line references. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
❌ The last analysis has failed. |
|
Comment on lines
+12
to
+16
| * @param {string} measurementName InfluxDB measurement name | ||
| * @param {() => (void|Promise<void>)} [onSuccess] Optional callback invoked after successful write | ||
| * @returns {void} | ||
| */ | ||
| export function postUdpQueueMetricsToInfluxDb(metrics, measurementName, onSuccess) { |
Comment on lines
+103
to
+116
| // Asynchronously write the datapoint to InfluxDB | ||
| globals.influx | ||
| .writePoints(deepClonedDatapoint) | ||
| .then(() => { | ||
| globals.logger.silly(`UDP QUEUE METRICS: InfluxDB datapoint for UDP queue metrics: ${JSON.stringify(datapoint, null, 2)}`); | ||
| datapoint = null; | ||
| globals.logger.verbose('UDP QUEUE METRICS: Sent UDP queue metrics to InfluxDB'); | ||
| if (typeof onSuccess === 'function') { | ||
| onSuccess(); | ||
| } | ||
| }) | ||
| .catch((err) => { | ||
| globals.logger.error(`UDP QUEUE METRICS: Error saving UDP queue metrics to InfluxDB! ${globals.getErrorMessage(err)}`); | ||
| }); |
Comment on lines
+129
to
+131
| const writeFrequency = globals.config.get('Butler.udpServerConfig.queueMetrics.influxdb.writeFrequency'); | ||
| const measurementName = globals.config.get('Butler.udpServerConfig.queueMetrics.influxdb.measurementName'); | ||
|
|
Comment on lines
+136
to
+141
| const timer = setInterval(async () => { | ||
| // Guard: skip if queue manager is not yet initialized | ||
| if (!globals.udpQueueManager) { | ||
| globals.logger.warn('UDP QUEUE METRICS: Queue manager not initialized, skipping write'); | ||
| return; | ||
| } |
Comment on lines
+151
to
+155
| postUdpQueueMetricsToInfluxDb(metrics, measurementName, () => { | ||
| globals.udpQueueManager.clearMetrics().catch((err) => { | ||
| globals.logger.error(`UDP QUEUE METRICS: Error clearing metrics after write: ${globals.getErrorMessage(err)}`); | ||
| }); | ||
| }); |
Comment on lines
+156
to
+158
| } catch (err) { | ||
| globals.logger.error(`UDP QUEUE METRICS: Error in periodic write: ${globals.getErrorMessage(err)}`); | ||
| } |
Comment on lines
+159
to
+163
| }, writeFrequency); | ||
|
|
||
| // Unref the timer so it doesn't prevent process exit | ||
| timer.unref(); | ||
| } |
| logger.error( | ||
| `[QSEOW] QLIKSENSE VERSION MONITOR: ${formatHttpErrorWithContext(err, endpoint, requestContext, { method: 'GET' })}`, | ||
| ); | ||
| logger.error(`[QSEOW] QLIKSENSE VERSION MONITOR: ${formatHttpErrorWithContext(err, endpoint, requestContext, { method: 'GET' })}`); |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




This PR implements this issue: #1647