grpc

package
v1.72.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

README

gRPC Remote Storage

Jaeger supports a gRPC-based Remote Storage API that enables integration with custom storage backends not natively supported by Jaeger.

A remote storage backend must implement a gRPC server with the following services:

  • TraceReader Enables Jaeger to read traces from the storage backend.
  • DependencyReader Used to load service dependency graphs from storage.
  • TraceService Allows trace data to be pushed to the storage. This service can run on a separate port if needed.

An example configuration for setting up a remote storage backend is available here. Note: In this example, the TraceService is configured to run on a different port (0.0.0.0:4316), which is overridden in the config file.

The integration tests also require a POST HTTP endpoint that can be called to purge the storage backend, ensuring a clean state before each test run.

Certifying compliance

To verify that your remote storage backend works correctly with Jaeger, you can run the integration tests provided by the Jaeger project.

Step 1: Clone the Jaeger Repository

Begin by cloning the Jaeger repository to your local machine:

git clone https://github.com/jaegertracing/jaeger.git
cd jaeger
Step 2: Run the Integration Tests

Run the integration tests for the gRPC storage backend using the following command:

STORAGE=grpc \
CUSTOM_STORAGE=true \
REMOTE_STORAGE_ENDPOINT=${MY_REMOTE_STORAGE_ENDPOINT} \
REMOTE_STORAGE_WRITER_ENDPOINT=${MY_REMOTE_STORAGE_WRITER_ENDPOINT} \
PURGER_ENDPOINT=${MY_PURGER_ENDPOINT} \
make jaeger-v2-storage-integration-test

The diagram below demonstrates the architecture of the gRPC storage integration test.

flowchart LR

Test --> |writeSpan| SpanWriter
Test --> |http:$PURGER_ENDPOINT| Purger
SpanWriter --> |0.0.0.0:4317| OTLP_Receiver1
OTLP_Receiver1 --> GRPCStorage
GRPCStorage --> |grpc:$REMOTE_STORAGE_WRITER_ENDPOINT| TraceService
Test --> |readSpan| SpanReader
SpanReader --> |0.0.0.0:16685| QueryExtension
QueryExtension --> GRPCStorage
GRPCStorage --> |grpc:$REMOTE_STORAGE_ENDPOINT| TraceReader
GRPCStorage --> |grpc:$REMOTE_STORAGE_ENDPOINT| DependencyReader
subgraph Integration Test Executable
    Test
    SpanWriter
    SpanReader
end
subgraph Jaeger Collector
    OTLP_Receiver1[OTLP Receiver]
    QueryExtension[Query Extension]
    GRPCStorage[gRPC Storage]
end
subgraph Custom Storage Backend
    TraceService
    TraceReader
    DependencyReader
    Purger[HTTP/Purger]
end

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	configgrpc.ClientConfig `mapstructure:",squash"`
	// Writer allows overriding the endpoint for writes, e.g. to an OTLP receiver.
	// If not defined the main endpoint is used for reads and writes.
	Writer configgrpc.ClientConfig `mapstructure:"writer"`

	Tenancy                      tenancy.Options `mapstructure:"multi_tenancy"`
	exporterhelper.TimeoutConfig `mapstructure:",squash"`
}

func DefaultConfig

func DefaultConfig() Config

type DependencyReader

type DependencyReader struct {
	// contains filtered or unexported fields
}

func NewDependencyReader

func NewDependencyReader(conn *grpc.ClientConn) *DependencyReader

NewDependencyReader creates a DependencyReader that communicates with a remote gRPC storage server. The provided gRPC connection is used exclusively for reading dependencies, meaning it is safe to enable instrumentation on the connection.

func (*DependencyReader) GetDependencies

func (dr *DependencyReader) GetDependencies(
	ctx context.Context,
	query depstore.QueryParameters,
) ([]model.DependencyLink, error)

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

func NewFactory

func NewFactory(
	ctx context.Context,
	cfg Config,
	telset telemetry.Settings,
) (*Factory, error)

NewFactory initializes a new gRPC (remote) storage backend.

func (*Factory) Close

func (f *Factory) Close() error

func (*Factory) CreateDependencyReader

func (f *Factory) CreateDependencyReader() (depstore.Reader, error)

func (*Factory) CreateTraceReader

func (f *Factory) CreateTraceReader() (tracestore.Reader, error)

func (*Factory) CreateTraceWriter

func (f *Factory) CreateTraceWriter() (tracestore.Writer, error)

type Handler added in v1.69.0

type Handler struct {
	storage.UnimplementedTraceReaderServer
	storage.UnimplementedDependencyReaderServer
	ptraceotlp.UnimplementedGRPCServer
	// contains filtered or unexported fields
}

func NewHandler added in v1.69.0

func NewHandler(
	traceReader tracestore.Reader,
	traceWriter tracestore.Writer,
	depReader depstore.Reader,
) *Handler

func (*Handler) Export added in v1.69.0

func (*Handler) FindTraceIDs added in v1.69.0

func (h *Handler) FindTraceIDs(
	ctx context.Context,
	req *storage.FindTracesRequest,
) (*storage.FindTraceIDsResponse, error)

func (*Handler) FindTraces added in v1.69.0

func (h *Handler) FindTraces(
	req *storage.FindTracesRequest,
	srv storage.TraceReader_FindTracesServer,
) error

func (*Handler) GetDependencies added in v1.69.0

func (h *Handler) GetDependencies(
	ctx context.Context,
	req *storage.GetDependenciesRequest,
) (*storage.GetDependenciesResponse, error)

func (*Handler) GetOperations added in v1.69.0

func (h *Handler) GetOperations(
	ctx context.Context,
	req *storage.GetOperationsRequest,
) (*storage.GetOperationsResponse, error)

func (*Handler) GetServices added in v1.69.0

func (h *Handler) GetServices(
	ctx context.Context,
	_ *storage.GetServicesRequest,
) (*storage.GetServicesResponse, error)

func (*Handler) GetTraces added in v1.69.0

func (h *Handler) GetTraces(
	req *storage.GetTracesRequest,
	srv storage.TraceReader_GetTracesServer,
) error

func (*Handler) Register added in v1.69.0

func (h *Handler) Register(ss *grpc.Server, hs *health.Server)

type TraceReader

type TraceReader struct {
	// contains filtered or unexported fields
}

func NewTraceReader

func NewTraceReader(conn *grpc.ClientConn) *TraceReader

NewTraceReader creates a TraceReader that communicates with a remote gRPC storage server. The provided gRPC connection is used exclusively for reading traces, meaning it is safe to enable instrumentation on the connection without risk of recursively generating traces.

func (*TraceReader) FindTraceIDs

func (*TraceReader) FindTraces

func (tr *TraceReader) FindTraces(
	ctx context.Context,
	params tracestore.TraceQueryParams,
) iter.Seq2[[]ptrace.Traces, error]

func (*TraceReader) GetOperations

func (tr *TraceReader) GetOperations(
	ctx context.Context,
	params tracestore.OperationQueryParams,
) ([]tracestore.Operation, error)

func (*TraceReader) GetServices

func (tr *TraceReader) GetServices(ctx context.Context) ([]string, error)

func (*TraceReader) GetTraces

func (tr *TraceReader) GetTraces(
	ctx context.Context,
	traceIDs ...tracestore.GetTraceParams,
) iter.Seq2[[]ptrace.Traces, error]

type TraceWriter

type TraceWriter struct {
	// contains filtered or unexported fields
}

func NewTraceWriter

func NewTraceWriter(conn *grpc.ClientConn) *TraceWriter

NewTraceWriter creates a TraceWriter that exports traces to a remote gRPC storage server.

The provided gRPC connection is used exclusively for sending trace data to the backend. To prevent recursive trace generation, this connection should not have instrumentation enabled.

func (*TraceWriter) WriteTraces

func (tw *TraceWriter) WriteTraces(ctx context.Context, td ptrace.Traces) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL