Skip to content

Dedup metrics influx 1#1648

Open
mountaindude wants to merge 6 commits into
masterfrom
dedup-metrics-influx-1
Open

Dedup metrics influx 1#1648
mountaindude wants to merge 6 commits into
masterfrom
dedup-metrics-influx-1

Conversation

@mountaindude

Copy link
Copy Markdown
Collaborator

This PR implements this issue: #1647

- 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/lib/influxdb/udp_queue_metrics.js Outdated
Comment thread src/lib/influxdb/udp_queue_metrics.js Outdated
Comment thread src/lib/influxdb/udp_queue_metrics.js Outdated
Comment thread src/config/production_template.yaml Outdated
mountaindude and others added 4 commits June 22, 2026 20:38
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>
@sonarqubecloud

Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
44.3% Duplication on New Code (required ≤ 3%)
E Reliability Rating on New Code (required ≥ A)
B Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 24 changed files in this pull request and generated 8 comments.

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' })}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants