Add multiple output formats to nchan_stub_status directive#710
Open
lloydzhou wants to merge 1 commit intoslact:masterfrom
Open
Add multiple output formats to nchan_stub_status directive#710lloydzhou wants to merge 1 commit intoslact:masterfrom
lloydzhou wants to merge 1 commit intoslact:masterfrom
Conversation
Extend the nchan_stub_status directive to support four output formats: - plain (default): original text format - json: formatted JSON with nested structure - html: HTML table with styling - prometheus: Prometheus metrics format
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.
Summary
Extend
nchan_stub_statusdirective to support multiple output formats: plain text, JSON, HTML, and Prometheus metrics. related #381 (comment)Changes
nchan_stub_statusnow accepts an optional format argument (plain,json,html,prometheus)src/util/nchan_stub_status_formats.handsrc/util/nchan_stub_status_formats.csrc/nchan_types.h- Addedstub_status_formatconfiguration fieldsrc/nchan_commands.rb- Updated directive to accept 0..1 argumentssrc/nchan_setup.c- Added format parsing logicsrc/nchan_module.c- Refactored handler to dispatch based on formatconfig- Added new source file to buildOutput Formats
Plain Text (default, backward compatible)
total published messages: 0
shared memory used: 16K
...
JSON (formatted with nested structure)
{ "interprocess": { "alerts": { "sent": 0, "received": 0, "in_transit": 0 }, ... }, "version": "1.3.7" }HTML (styled table)
Prometheus Metrics
nchan_published_messages_total 0
nchan_shared_memory_used_kb 16
...
Configuration Example
Backward Compatibility
Fully backward compatible - omitting the format argument defaults to plain text format.