Skip to content

fix(tracing): write logs as compact JSONL for filesystem adapter #1333

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Pouyanpi
Copy link
Collaborator

Description

Update filesystem tracing adapter to write logs as compact JSONL (no indentation), ensuring each record is a single line. Add and update tests to verify correct JSONL formatting, multiple records, and streaming compatibility.

Switch filesystem tracing adapter to write logs as compact JSONL (no
indentation), ensuring each record is a single line. Add and update tests
to verify correct JSONL formatting, multiple records, and streaming
compatibility.
@Pouyanpi Pouyanpi requested a review from Copilot August 15, 2025 07:46
@Pouyanpi Pouyanpi added this to the v0.16.0 milestone Aug 15, 2025
Copy link

@Copilot Copilot AI left a comment

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 updates the filesystem tracing adapter to write logs in compact JSONL format by removing indentation from JSON output, ensuring each record is written as a single line for better compatibility with streaming processors and log analysis tools.

Key changes:

  • Remove indent=2 parameter from json.dumps() calls in both sync and async methods
  • Add comprehensive tests to verify JSONL format compliance and streaming compatibility

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
nemoguardrails/tracing/adapters/filesystem.py Updated JSON serialization to remove indentation for compact JSONL output
tests/test_tracing_adapters_filesystem.py Added three new test methods to verify JSONL formatting and streaming behavior
Comments suppressed due to low confidence (1)

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 70.61%. Comparing base (3018024) to head (9dd4077).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
nemoguardrails/tracing/adapters/filesystem.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1333   +/-   ##
========================================
  Coverage    70.61%   70.61%           
========================================
  Files          161      161           
  Lines        16304    16304           
========================================
  Hits         11513    11513           
  Misses        4791     4791           
Flag Coverage Δ
python 70.61% <50.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
nemoguardrails/tracing/adapters/filesystem.py 64.70% <50.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Pouyanpi Pouyanpi added the bug Something isn't working label Aug 15, 2025
@Pouyanpi Pouyanpi self-assigned this Aug 15, 2025
@Pouyanpi Pouyanpi requested a review from tgasser-nv August 15, 2025 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants