-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[remote-storage] Replace CLI flags with config file #7704
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
Conversation
…nings for CLI flags Co-authored-by: yurishkuro <3523016+yurishkuro@users.noreply.github.com>
Co-authored-by: yurishkuro <3523016+yurishkuro@users.noreply.github.com>
Co-authored-by: yurishkuro <3523016+yurishkuro@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7704 +/- ##
==========================================
- Coverage 96.40% 96.40% -0.01%
==========================================
Files 328 330 +2
Lines 17095 17106 +11
==========================================
+ Hits 16481 16491 +10
- Misses 461 462 +1
Partials 153 153
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
cmd/remote-storage/app/config.go
Outdated
|
|
||
| // TraceBackend contains configuration for a single trace storage backend. | ||
| // This mirrors jaegerstorage.TraceBackend. | ||
| type TraceBackend struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the duplication between remote-storage and the storage_extension in the jaeger binary. I suggest we move the storage configuration portion into cmd/internal/storageconfig. Basically the code from this point
| for storageName, cfg := range s.config.TraceBackends { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved storage configuration to cmd/internal/storageconfig in commit 4564128. The shared code includes config types (Config, TraceBackend) and factory instantiation (CreateStorageFactory), eliminating duplication between remote-storage and jaegerstorage extension.
|
@copilot I made comments on the PR, please address |
…flag, remove CLI flag support Co-authored-by: yurishkuro <3523016+yurishkuro@users.noreply.github.com>
|
@copilot you created cmd/internal/storageconfig but you did not refactor the corresponding code from cmd/jaeger/internal/extension/jaegerstorage/. I don't want to have duplication. Also , the extension has 99% code coverage, we need to migrate the corresponding tests to cmd/internal/storageconfig $ go test -cover ./cmd/jaeger/internal/extension/jaegerstorage |
- Updated jaegerstorage extension to use storageconfig.CreateTraceStorageFactory - Moved TraceBackend config to shared storageconfig package - Updated all tests to reference storageconfig.TraceBackend - Maintained 99.2% test coverage (was 99.4%) - Both jaeger and remote-storage now share factory creation logic - Added test binary to .gitignore Co-authored-by: yurishkuro <3523016+yurishkuro@users.noreply.github.com>
Completed in commit c037a43. The jaegerstorage extension now uses the shared |
|
@copilot unit tests are failing, lint is failing. |
Signed-off-by: Yuri Shkuro <github@ysh.us>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Signed-off-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
Signed-off-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
| name: "empty backend configuration", | ||
| yamlConfig: ` | ||
| grpc: | ||
| endpoint: :17271 | ||
| storage: | ||
| backends: | ||
| empty-storage: {} | ||
| `, | ||
| expectError: "at least one storage backend is required", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test expectation is incorrect
The test expects error "at least one storage backend is required", but the actual error will be "empty backend configuration for storage 'empty-storage'".
When empty-storage: {} is unmarshaled, it creates a TraceBackend{} with all nil fields. The validation in storageconfig.Config.Validate() checks:
if len(c.TraceBackends) == 0- This passes since there is 1 backendif reflect.DeepEqual(b, empty)- This catches the empty backend and returns"empty backend configuration for storage 'empty-storage'"
Fix:
expectError: "empty backend configuration for storage 'empty-storage'",| name: "empty backend configuration", | |
| yamlConfig: ` | |
| grpc: | |
| endpoint: :17271 | |
| storage: | |
| backends: | |
| empty-storage: {} | |
| `, | |
| expectError: "at least one storage backend is required", | |
| name: "empty backend configuration", | |
| yamlConfig: ` | |
| grpc: | |
| endpoint: :17271 | |
| storage: | |
| backends: | |
| empty-storage: {} | |
| `, | |
| expectError: "empty backend configuration for storage 'empty-storage'", | |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
…g package (jaegertracing#7704) ## Migrated remote-storage to YAML configuration with shared storageconfig package Addressed all feedback from @yurishkuro to eliminate duplication and maintain test coverage. ### Changes Made: 1. **Shared Storage Configuration with Comprehensive Tests** (`cmd/internal/storageconfig/`) - Created shared package with `Config`, `TraceBackend`, and `MetricBackend` types - **PrometheusConfiguration now in storageconfig** with `promcfg.Configuration` type - **MetricBackend.Unmarshal in storageconfig** initializes prometheus defaults - Implemented `CreateTraceStorageFactory` with optional auth support - Both jaeger and remote-storage now use shared factory creation logic - **Added comprehensive unit tests** (`config_test.go`, `factory_test.go`) - **Config validation and unmarshaling: 100% test coverage** - **Factory creation tested for all backend types** (Memory, Badger, Cassandra, ClickHouse, Elasticsearch, OpenSearch) - **Total package coverage: 98.3%** (config.go: 100%, factory.go: 96.2%) - ES/OS backends tested with mock HTTP servers - ClickHouse tested with clickhousetest server - GRPC tested via jaegerstorage extension (requires component.Host) 2. **Refactored jaegerstorage Extension** (`cmd/jaeger/internal/extension/jaegerstorage/`) - **Config now embeds storageconfig.Config** with mapstructure squash - Extension uses shared `storageconfig.CreateTraceStorageFactory` - Eliminated ~80 lines of duplicate code (config types + factory creation) - Maintained 99.1% test coverage (previously 99.4%) - No duplicate PrometheusConfiguration or MetricBackend definitions 3. **Updated All Test Files** - Migrated all test references to use embedded Config initialization - Fixed references in extension, exporter, processor, and remote sampling tests - All tests passing with high coverage 4. **Enhanced remote-storage Configuration** - Uses viper's built-in `--config-file` flag - Removed all CLI flag support and v1 factory dependencies - Added validation to enforce single backend constraint - Added default configuration support (memory storage on :17271) - Maintains backward compatibility with integration tests ### Testing Results: - ✅ **storageconfig package: 98.3% coverage** (config.go: 100%, factory.go: 96.2%) - ✅ jaegerstorage extension: 99.1% coverage - ✅ All exporters, processors: 100% coverage - ✅ remote-storage: 94% coverage - ✅ All test suites passing - ✅ Lint clean - ✅ remote-storage starts successfully without config file ### Benefits: - ✅ No duplication - all config types in shared storageconfig - ✅ **Comprehensive test coverage for shared code** (98.3%) - ✅ Single source of truth for storage configuration - ✅ High test coverage maintained across all packages - ✅ Clean architecture with embedded config - ✅ Backward compatible with existing deployments <!-- START COPILOT CODING AGENT SUFFIX --> <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > Can you solve this issue jaegertracing#7703 ? </details> <!-- START COPILOT CODING AGENT TIPS --> --- 💡 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](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Signed-off-by: Yuri Shkuro <github@ysh.us> Signed-off-by: Yuri Shkuro <yurishkuro@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: yurishkuro <3523016+yurishkuro@users.noreply.github.com> Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com> Co-authored-by: Yuri Shkuro <github@ysh.us> Signed-off-by: SoumyaRaikwar <somuraik@gmail.com>
Resolves #7703
Changes Made:
Shared Storage Configuration with Comprehensive Tests (
cmd/internal/storageconfig/)Config,TraceBackend, andMetricBackendtypespromcfg.ConfigurationtypeCreateTraceStorageFactorywith optional auth supportconfig_test.go,factory_test.go)Refactored jaegerstorage Extension (
cmd/jaeger/internal/extension/jaegerstorage/)storageconfig.CreateTraceStorageFactoryUpdated All Test Files
Enhanced remote-storage Configuration
--config-fileflagTesting Results:
Benefits: