Skip to content

Add Serialization & Deserialization of Sink File Properties with CLI Commands #2749

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 3, 2025

This PR implements file sink telemetry configuration for Data API Builder, enabling users to send logs to a file sink through CLI commands and JSON configuration.

Changes Made

CLI Commands Added

The following new CLI configure options are now available:

  • --runtime.telemetry.file.enabled - Enable/disable file sink telemetry (default: false)
  • --runtime.telemetry.file.path - File path for telemetry logs (default: "/logs/dab-log.txt")
  • --runtime.telemetry.file.rolling-interval - Rolling interval: hour, day, week (default: day)
  • --runtime.telemetry.file.retained-file-count-limit - Number of retained files (default: 1, minimum: 1)
  • --runtime.telemetry.file.file-size-limit-bytes - Max file size in bytes (default: 1048576, minimum: 1)

Usage Examples

# Enable file sink with default settings
dab configure --runtime.telemetry.file.enabled true

# Configure all file sink options
dab configure --runtime.telemetry.file.enabled true \
  --runtime.telemetry.file.path "/var/log/dab.log" \
  --runtime.telemetry.file.rolling-interval week \
  --runtime.telemetry.file.retained-file-count-limit 7 \
  --runtime.telemetry.file.file-size-limit-bytes 10485760

JSON Configuration Schema

The configuration now supports the following structure under runtime.telemetry:

{
  "runtime": {
    "telemetry": {
      "file": {
        "enabled": true,
        "path": "/logs/dab-log.txt",
        "rolling-interval": "day",
        "retained-file-count-limit": 7,
        "file-size-limit-bytes": 1048576
      }
    }
  }
}

Implementation Details

Object Model Changes:

  • Added FileOptions record with proper JSON serialization
  • Added RollingInterval enum supporting hour/day/week intervals
  • Updated TelemetryOptions to include file sink configuration

JSON Schema Updates:

  • Added complete file sink schema definition with constraints and defaults
  • Proper enum validation for rolling intervals
  • Minimum value constraints for numeric fields

Configuration & Validation:

  • Full integration with existing dab configure command infrastructure
  • Input validation for numeric constraints (minimum values)
  • Support for configuring multiple options in a single command
  • Comprehensive error handling and logging

Testing:

  • Added 14 unit tests covering all configuration scenarios
  • Tests for successful updates, validation failures, and multi-option configuration
  • End-to-end validation from CLI to JSON serialization

Validation

All tests pass and the implementation follows existing patterns in the codebase for telemetry providers (similar to ApplicationInsights and OpenTelemetry implementations).

Fixes #2576.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] Add Serialization & Deserialization of Sink File Properties with CLI Commands Add Serialization & Deserialization of Sink File Properties with CLI Commands Jul 3, 2025
@Copilot Copilot AI requested a review from RubenCerna2079 July 3, 2025 18:35
Copilot finished work on behalf of RubenCerna2079 July 3, 2025 18:35
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.

Add Serialization & Deserialization of Sink File Properties with CLI Commands
2 participants