How signalfx/splunk-otel-go works
Main Components
• Build & CI/CD Infrastructure:
• Components: • Build directory (all.go, bump.go, clean.go, etc.), Makefile, and GitHub workflow files (.github/workflows/ci.yml, cla.yml).
• Role: These files/scripts automate building, testing, linting, and releasing the distribution. They are the “infrastructure” side of the project.
• Distribution Package:
• Components: The “distro” directory contains code that is specific to the Splunk distribution (configuration, limits, logging, OTEL exporter integration, version management, etc.).
• Role: Acts as a wrapper/adaptor that modifies or extends standard OpenTelemetry functionality to meet Splunk’s needs.
• Instrumentation Libraries:
• Components: The large “instrumentation” directory with custom packages for different integrations and technologies (e.g., databases like sql, Kafka client integrations, HTTP wrappers, DNS, etc.). Each vendor-specific instrumentation (e.g., go-sql-driver/mysql/splunkmysql, confluent-kafka-go/splunkkafka, etc.) is a separate module.
• Role: They provide the “glue” that intercepts or extends existing Go libraries and frameworks to capture and forward telemetry data per Splunk’s requirements.
• Examples:
• Components: The “example” directory contains smaller, developer-focused examples (e.g., a docker-compose file, sample main.go, otel-config.yaml) that demonstrate how to use the distribution.
• Role: Serve as a usage guide and proof of concept, showing how an application would integrate with the instrumentation offered.
• Core Versioning & Configuration:
• Components: Files like go.mod, go.sum, version.go, and a versions.yaml provide dependency management and version tracking.
• Role: Ensure consistency, define the project’s external dependencies, and mark releases.
Relationships & Interactions
• The external Go application (that uses this package) would import components from the distro and instrumentation libraries.
• The distro package sits in the middle: it wraps core OpenTelemetry functions and integrates with various instrumentation modules.
• Each instrumentation module (for databases, messaging, HTTP, etc.) intercepts calls or sets up connections to capture telemetry, potentially forwarding it to Splunk endpoints.
• The build layer and CI/CD pipelines integrate with the whole codebase, ensuring that tests (including integration tests in the instrumentation packages) are run consistently, code style is enforced, and releases are generated.
• The examples package acts as a guide by showing end-to-end integration in a sample application.
Architectural Patterns & Design Principles
• Modular Design: The project is split into many modules/pkgs (each with its own go.mod) so that individual instrumentation libraries can evolve independently.
• Wrapper/Adapter Pattern: The distro package adapts and extends the OpenTelemetry Go core functionality for Splunk’s usage.
• Extensibility: The instrumentation folders for various vendors (databases, Kafka, HTTP, etc.) illustrate a clear separation of concerns and a plug-in-like approach.
• CI/CD & Automated Testing: Integration via GitHub workflows, Makefile targets, and testing directories ensures code quality and reproducibility.