Skip to content

Refactored and modernized version of textfile-exporter #23

@SckyzO

Description

@SckyzO

I’ve been using textfile-exporter and found it very useful. To better fit modern environments and improve maintainability, I have performed a significant refactor of the codebase.

I have published the updated version here: https://github.com/SckyzO/textfile_exporter

Major Improvements Over the Original

This version is more than just a fork; it's a complete overhaul with significant enhancements:

  • Enhanced Security: Hardened the external command execution to prevent potential command injection vulnerabilities (gosec G204) that were present in the original version.
  • Modern Project Structure: Adopted a standard Go project layout (cmd/, internal/) for better organization, easier maintenance, and clearer contribution paths.
  • Improved CLI: Integrated the kingpin library for a more powerful and user-friendly command-line experience with detailed help text and better flag support.
  • Full Build Automation: Implemented a Makefile and a complete GoReleaser workflow for automated, multi-platform builds and releases with embedded version information.
  • Better Code Modularity: Refactored the entire codebase to separate concerns into distinct packages (collector, scanner, logger), resulting in a cleaner, more robust, and more maintainable application.
  • Recursive Scanning: Added the ability to recursively scan subdirectories for .prom files, enhancing flexibility for metric file organization.
  • Comprehensive Error Reporting: Introduced detailed Prometheus metrics for file scanning and parsing errors, providing better observability and troubleshooting capabilities.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions