-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[jaeger-v2] add GRPC storage backend integration test (#5259)
## Which problem is this PR solving? - Resolves GRPC integration test sub-task at #5254 ## Description of the changes - Created a `grpc-integration-test.sh` script to run a jaeger remote storage and execute the end-to-end test through the OpenTelemetry Collector pipeline with the jaeger storage extension inside connected to the remote storage. To have a visualization of this architecture, see the proposal at #5254 - Separate the GRPC and Badger integration test CI because GRPC need to be run twice for the v1 and v2 versions. ## How was this change tested? - Run `./scripts/grpc-integration-test.sh latest` and the whole remote storage and pipeline will be built and executed for you. - I also ran a `jaeger-query`component to query traces from the remote storage for manual checks. <img width="1440" alt="Screenshot 2024-03-08 at 09 58 13" src="https://github.com/jaegertracing/jaeger/assets/46216691/2388e8bc-baf9-41bd-8baa-c3d51703fc8e"> ## 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`: `yarn lint` and `yarn test` --------- Signed-off-by: James Ryans <[email protected]>
- Loading branch information
1 parent
3912f00
commit b82c806
Showing
33 changed files
with
898 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: CIT gRPC | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
|
||
pull_request: | ||
branches: [main] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ (github.event.pull_request && github.event.pull_request.number) || github.ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
# See https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions | ||
permissions: # added using https://github.com/step-security/secure-workflows | ||
contents: read | ||
|
||
jobs: | ||
grpc: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
version: [v1, v2] | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 | ||
with: | ||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs | ||
|
||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
|
||
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | ||
with: | ||
go-version: 1.22.x | ||
|
||
- name: Run gRPC storage integration tests | ||
run: | | ||
case ${{ matrix.version }} in | ||
v1) | ||
make grpc-storage-integration-test | ||
;; | ||
v2) | ||
bash scripts/grpc-integration-test.sh latest | ||
;; | ||
esac | ||
- name: Setup CODECOV_TOKEN | ||
uses: ./.github/actions/setup-codecov | ||
|
||
- name: Upload coverage to codecov | ||
uses: codecov/codecov-action@54bcd8715eee62d40e33596ef5e8f0f48dbbccab # v4.1.0 | ||
with: | ||
files: cover.out | ||
verbose: true | ||
flags: grpc | ||
fail_ci_if_error: true | ||
token: ${{ env.CODECOV_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Integration | ||
|
||
Jaeger v2 integration tests are built on top of [OTEL Testbed module](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/testbed). OTEL Testbed provide comprehensive tools for conducting end-to-end tests for the OTEL Collector, such as reproducible short-term benchmarks, correctness tests, long-running stability tests and maximum load stress tests. However, we only utilize the correctness tests from testbed, it generates and sends every combinatorial trace attributes and matches every single of them with the received traces from another end. To learn more about OTEL Testbed, please refer to the their [README](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/testbed/README.md). | ||
|
||
## Architecture | ||
|
||
Here's the architecture to test the OpenTelemetry Collector pipeline from end-to-end with the designated storage backends. | ||
 | ||
|
||
Testbed components: | ||
| Component | Description | | ||
|-----------|-------------| | ||
| **LoadGenerator** | Encapsulates DataProvider and DataSender in order to generate and send data. | | ||
| Golden DataProvider | Generates traces from the "Golden" dataset generated using pairwise combinatorial testing techniques. Testbed example uses [PICT](https://github.com/microsoft/pict/) to generate the test data, e.g. [testdata](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/internal/coreinternal/goldendataset/testdata). | | ||
| OTLP Trace DataSender | With the generated traces from DataProvider, the DataSender sends traces to OTLP receiver in the collector instance. | | ||
| **Mockbackend** | Encapsulates DataReceiver and provides consume functionality. | | ||
| DataReceiver | A custom DataReceiver that will host a Jaeger storage extension to retrieve traces from the database by pulling them using our artificial Jaeger storage receiver. | | ||
| Consumer | Consumer does not actually a thing in MockBackend but only to make the diagram intuitive, the traces received from our artificial receiver will be stored inside MockBackend. | | ||
| **Correctness Test Validator** | Checks if the traces received from MockBackend are all matches with the generated traces from DataProvider. | | ||
|
||
## gRPC Integration Test | ||
|
||
To conduct the tests, run the following command: | ||
|
||
``` | ||
scripts/grpc-integration-test.sh <remote_storage_image_version> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A custom testbed data receiver for integration testing purpose |
87 changes: 87 additions & 0 deletions
87
cmd/jaeger/internal/integration/datareceivers/jaegerstorage.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// Copyright (c) 2024 The Jaeger Authors. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package datareceivers | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage/storagetest" | ||
"github.com/open-telemetry/opentelemetry-collector-contrib/testbed/testbed" | ||
"go.opentelemetry.io/collector/component" | ||
"go.opentelemetry.io/collector/component/componenttest" | ||
"go.opentelemetry.io/collector/consumer" | ||
"go.opentelemetry.io/collector/extension" | ||
"go.opentelemetry.io/collector/receiver" | ||
"go.opentelemetry.io/collector/receiver/receivertest" | ||
|
||
"github.com/jaegertracing/jaeger/cmd/jaeger/internal/extension/jaegerstorage" | ||
"github.com/jaegertracing/jaeger/cmd/jaeger/internal/integration/receivers/storagereceiver" | ||
) | ||
|
||
type jaegerStorageDataReceiver struct { | ||
TraceStorage string | ||
StorageConfig *jaegerstorage.Config | ||
host *storagetest.StorageHost | ||
receiver receiver.Traces | ||
} | ||
|
||
func NewJaegerStorageDataReceiver(traceStorage string, storageConfig *jaegerstorage.Config) testbed.DataReceiver { | ||
return &jaegerStorageDataReceiver{ | ||
TraceStorage: traceStorage, | ||
StorageConfig: storageConfig, | ||
} | ||
} | ||
|
||
func (dr *jaegerStorageDataReceiver) Start(tc consumer.Traces, _ consumer.Metrics, _ consumer.Logs) error { | ||
ctx := context.Background() | ||
|
||
extFactory := jaegerstorage.NewFactory() | ||
ext, err := extFactory.CreateExtension(ctx, extension.CreateSettings{ | ||
TelemetrySettings: componenttest.NewNopTelemetrySettings(), | ||
BuildInfo: component.NewDefaultBuildInfo(), | ||
}, dr.StorageConfig) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
rcvSet := receivertest.NewNopCreateSettings() | ||
rcvFactory := storagereceiver.NewFactory() | ||
rcvCfg := rcvFactory.CreateDefaultConfig().(*storagereceiver.Config) | ||
rcvCfg.TraceStorage = dr.TraceStorage | ||
rcv, err := rcvFactory.CreateTracesReceiver(ctx, rcvSet, rcvCfg, tc) | ||
if err != nil { | ||
return err | ||
} | ||
dr.receiver = rcv | ||
|
||
dr.host = storagetest.NewStorageHost() | ||
dr.host.WithExtension(jaegerstorage.ID, ext) | ||
|
||
err = dr.host.GetExtensions()[jaegerstorage.ID].Start(ctx, dr.host) | ||
if err != nil { | ||
return err | ||
} | ||
return dr.receiver.Start(ctx, dr.host) | ||
} | ||
|
||
func (dr *jaegerStorageDataReceiver) Stop() error { | ||
ctx := context.Background() | ||
err := dr.receiver.Shutdown(ctx) | ||
if err != nil { | ||
return err | ||
} | ||
return dr.host.GetExtensions()[jaegerstorage.ID].Shutdown(ctx) | ||
} | ||
|
||
func (dr *jaegerStorageDataReceiver) GenConfigYAMLStr() string { | ||
return fmt.Sprintf(` | ||
jaeger_storage_receiver: | ||
trace_storage: %s | ||
`, dr.TraceStorage) | ||
} | ||
|
||
func (dr *jaegerStorageDataReceiver) ProtocolName() string { | ||
return "jaeger_storage_receiver" | ||
} |
Oops, something went wrong.