Skip to content

Commit 4082fe6

Browse files
mahadzaryab1amol-verma-allen
authored andcommitted
[v2][remote-storage] Implement remote storage extension (jaegertracing#7043)
## Which problem is this PR solving? - Towards jaegertracing#7038 ## Description of the changes - Introduces a new remote_storage extension that wraps the existing remote-storage binary. This extension allows a remote storage gRPC server to be started within jaeger-v2, delegating to one of the configured backends. - Adds a new configuration file (config-remote-storage-backend.yaml) used by the integration tests. This replaces the need to manually start the test remote storage server. Integration tests are updated to use this config and remove related boilerplate. ## How was this change tested? - Updated the integration tests and added new unit tests ## Checklist - [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [x] I have signed all commits - [x] I have added unit tests for the new functionality - [x] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `npm run lint` and `npm run test` --------- Signed-off-by: Mahad Zaryab <[email protected]>
1 parent aae8e37 commit 4082fe6

File tree

21 files changed

+566
-78
lines changed

21 files changed

+566
-78
lines changed

.github/workflows/ci-e2e-grpc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
SPAN_STORAGE_TYPE=memory make grpc-storage-integration-test
3838
;;
3939
v2)
40-
STORAGE=grpc SPAN_STORAGE_TYPE=memory make jaeger-v2-storage-integration-test
40+
STORAGE=grpc make jaeger-v2-storage-integration-test
4141
;;
4242
esac
4343

.github/workflows/ci-e2e-query.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
- name: Run Memory storage integration tests
3030
run: |
31-
STORAGE=query SPAN_STORAGE_TYPE=memory make jaeger-v2-storage-integration-test
31+
STORAGE=query make jaeger-v2-storage-integration-test
3232
3333
- name: Upload coverage to codecov
3434
uses: ./.github/actions/upload-codecov

cmd/jaeger/config-query.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,14 @@ service:
1515
exporter:
1616
prometheus:
1717
host: 0.0.0.0
18-
# use different port to avoid conflict with collector on 8888
19-
port: 8887
18+
port: 8888
2019
logs:
2120
level: info
2221

2322
extensions:
2423
healthcheckv2:
2524
use_v2: true
2625
http:
27-
# use different port to avoid conflict with collector on 13133
28-
endpoint: 0.0.0.0:12133
2926

3027
jaeger_query:
3128
storage:
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
service:
2+
extensions: [jaeger_storage, jaeger_query, remote_storage, remote_storage/archive, healthcheckv2]
3+
pipelines:
4+
traces:
5+
receivers: [otlp]
6+
processors: [batch]
7+
exporters: [jaeger_storage_exporter]
8+
telemetry:
9+
resource:
10+
service.name: jaeger
11+
metrics:
12+
level: detailed
13+
readers:
14+
- pull:
15+
exporter:
16+
prometheus:
17+
host: 0.0.0.0
18+
port: 8887
19+
logs:
20+
level: debug
21+
# TODO Initialize telemetry tracer once OTEL released new feature.
22+
# https://github.com/open-telemetry/opentelemetry-collector/issues/10663
23+
24+
extensions:
25+
healthcheckv2:
26+
use_v2: true
27+
http:
28+
# use different port to avoid conflict with collector on 13133
29+
endpoint: 0.0.0.0:12133
30+
31+
jaeger_query:
32+
storage:
33+
traces: memory-storage
34+
traces_archive: memory-storage-archive
35+
ui:
36+
config_file: ./cmd/jaeger/config-ui.json
37+
grpc:
38+
endpoint: "${env:JAEGER_QUERY_GRPC_ENDPOINT:-localhost:16685}"
39+
http:
40+
endpoint: "${env:JAEGER_QUERY_HTTP_ENDPOINT:-localhost:16686}"
41+
42+
jaeger_storage:
43+
backends:
44+
memory-storage:
45+
memory:
46+
max_traces: 100000
47+
memory-storage-archive:
48+
memory:
49+
max_traces: 100000
50+
remote_storage:
51+
endpoint: localhost:17271
52+
storage: memory-storage
53+
remote_storage/archive:
54+
endpoint: localhost:17272
55+
storage: memory-storage-archive
56+
57+
receivers:
58+
otlp:
59+
protocols:
60+
grpc:
61+
62+
processors:
63+
batch:
64+
65+
exporters:
66+
jaeger_storage_exporter:
67+
trace_storage: memory-storage

cmd/jaeger/config-remote-storage.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ extensions:
3232
traces_archive: another-storage
3333
ui:
3434
config_file: ./cmd/jaeger/config-ui.json
35-
grpc:
36-
endpoint: "${env:JAEGER_QUERY_GRPC_ENDPOINT:-localhost:16685}"
37-
http:
38-
endpoint: "${env:JAEGER_QUERY_HTTP_ENDPOINT:-localhost:16686}"
3935
jaeger_storage:
4036
backends:
4137
some-storage:
@@ -53,6 +49,8 @@ receivers:
5349
otlp:
5450
protocols:
5551
grpc:
52+
# use different port to avoid conflict with remote storage backend on 4317
53+
endpoint: 0.0.0.0:4316
5654
http:
5755

5856
processors:

cmd/jaeger/internal/components.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636
"github.com/jaegertracing/jaeger/cmd/jaeger/internal/extension/jaegerquery"
3737
"github.com/jaegertracing/jaeger/cmd/jaeger/internal/extension/jaegerstorage"
3838
"github.com/jaegertracing/jaeger/cmd/jaeger/internal/extension/remotesampling"
39+
"github.com/jaegertracing/jaeger/cmd/jaeger/internal/extension/remotestorage"
3940
"github.com/jaegertracing/jaeger/cmd/jaeger/internal/integration/storagecleaner"
4041
"github.com/jaegertracing/jaeger/cmd/jaeger/internal/processors/adaptivesampling"
4142
)
@@ -69,9 +70,11 @@ func (b builders) build() (otelcol.Factories, error) {
6970
// add-ons
7071
jaegerquery.NewFactory(),
7172
jaegerstorage.NewFactory(),
72-
storagecleaner.NewFactory(),
7373
remotesampling.NewFactory(),
7474
expvar.NewFactory(),
75+
// only for e2e testing
76+
storagecleaner.NewFactory(),
77+
remotestorage.NewFactory(),
7578
)
7679
if err != nil {
7780
return otelcol.Factories{}, err
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright (c) 2025 The Jaeger Authors.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package remotestorage
5+
6+
import (
7+
"github.com/asaskevich/govalidator"
8+
9+
"github.com/jaegertracing/jaeger/cmd/remote-storage/app"
10+
)
11+
12+
type Config struct {
13+
app.Options `mapstructure:",squash"`
14+
Storage string `mapstructure:"storage" valid:"required"`
15+
}
16+
17+
func (cfg *Config) Validate() error {
18+
_, err := govalidator.ValidateStruct(cfg)
19+
return err
20+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Copyright (c) 2025 The Jaeger Authors.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package remotestorage
5+
6+
import (
7+
"testing"
8+
9+
"github.com/stretchr/testify/require"
10+
)
11+
12+
func TestValidate(t *testing.T) {
13+
tests := []struct {
14+
name string
15+
config *Config
16+
expectedErr string
17+
}{
18+
{
19+
name: "Empty config",
20+
config: &Config{},
21+
expectedErr: "Storage: non zero value required",
22+
},
23+
{
24+
name: "Non empty-config",
25+
config: &Config{
26+
Storage: "some-storage",
27+
},
28+
expectedErr: "",
29+
},
30+
}
31+
32+
for _, tt := range tests {
33+
t.Run(tt.name, func(t *testing.T) {
34+
err := tt.config.Validate()
35+
if tt.expectedErr == "" {
36+
require.NoError(t, err)
37+
} else {
38+
require.Equal(t, tt.expectedErr, err.Error())
39+
}
40+
})
41+
}
42+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright (c) 2025 The Jaeger Authors.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package remotestorage
5+
6+
import (
7+
"context"
8+
9+
"go.opentelemetry.io/collector/component"
10+
"go.opentelemetry.io/collector/config/configgrpc"
11+
"go.opentelemetry.io/collector/config/confignet"
12+
"go.opentelemetry.io/collector/extension"
13+
14+
"github.com/jaegertracing/jaeger/cmd/remote-storage/app"
15+
"github.com/jaegertracing/jaeger/ports"
16+
)
17+
18+
// componentType is the name of this extension in configuration.
19+
var componentType = component.MustNewType("remote_storage")
20+
21+
// ID is the identifier of this extension.
22+
var ID = component.NewID(componentType)
23+
24+
func NewFactory() extension.Factory {
25+
return extension.NewFactory(
26+
componentType,
27+
createDefaultConfig,
28+
createExtension,
29+
component.StabilityLevelDevelopment,
30+
)
31+
}
32+
33+
func createDefaultConfig() component.Config {
34+
return &Config{
35+
Options: app.Options{
36+
ServerConfig: configgrpc.ServerConfig{
37+
NetAddr: confignet.AddrConfig{
38+
Endpoint: ports.PortToHostPort(ports.RemoteStorageGRPC),
39+
Transport: confignet.TransportTypeTCP,
40+
},
41+
},
42+
},
43+
}
44+
}
45+
46+
func createExtension(
47+
_ context.Context,
48+
set extension.Settings,
49+
cfg component.Config,
50+
) (extension.Extension, error) {
51+
return newServer(cfg.(*Config), set.TelemetrySettings), nil
52+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright (c) 2025 The Jaeger Authors.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package remotestorage
5+
6+
import (
7+
"context"
8+
"testing"
9+
10+
"github.com/stretchr/testify/require"
11+
"go.opentelemetry.io/collector/extension"
12+
)
13+
14+
func TestNewFactory(t *testing.T) {
15+
factory := NewFactory()
16+
require.Equal(t, componentType, factory.Type())
17+
require.Equal(t, factory.CreateDefaultConfig(), createDefaultConfig())
18+
}
19+
20+
func TestCreateExtension(t *testing.T) {
21+
set := extension.Settings{
22+
ID: ID,
23+
}
24+
cfg := createDefaultConfig()
25+
ext, err := createExtension(context.Background(), set, cfg)
26+
27+
require.NoError(t, err)
28+
require.NotNil(t, ext)
29+
}

0 commit comments

Comments
 (0)