Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Json log format support #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

mohammedalics
Copy link
Member

Requirements for Adding, Changing, or Removing a Feature

This change introduces a new feature for SLO Exporter logging output format, allowing it to be formatted in JSON for better parsing and readability in logging systems.

Description of the Change

This MR introduces support for configuring the SLO Exporter’s logging output format via the SLO_EXPORTER_LOGFORMAT environment variable, similar to the existing SLO_EXPORTER_LOGLEVEL.

Default Value: The logging format defaults to text.
New Behavior: When SLO_EXPORTER_LOGFORMAT is set to json, logs are outputted in JSON format for easier integration with logging tools that support structured data.

This addition maintains backward compatibility as it defaults to the text format unless explicitly set to json.

Verification Process

To verify this change:

  • Set SLO_EXPORTER_LOGFORMAT to text and json and verified the output format aligns with the specified setting.
    Result: Logs appear in standard text when SLO_EXPORTER_LOGFORMAT is unset or set to text.
    Result: Logs are formatted as JSON when SLO_EXPORTER_LOGFORMAT is set to json.
  • Verified that setting an invalid value for SLO_EXPORTER_LOGFORMAT (e.g., xml) falls back to text without errors, ensuring stability in cases of misconfiguration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant