otlpserver

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

otlpserver is an OTLP server with HTTP and gRPC backends available. It takes a lot of shortcuts to keep things simple and is not intended to be used as a serious OTLP service. Primarily it is for the test suite and also supports the otel-cli server features.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

Callback is a type for the function passed to newServer that is called for each incoming span.

type GrpcServer added in v0.1.0

type GrpcServer struct {
	coltracepb.UnimplementedTraceServiceServer
	// contains filtered or unexported fields
}

GrpcServer is a gRPC/OTLP server handle.

func NewGrpcServer added in v0.1.0

func NewGrpcServer(cb Callback, stop Stopper) *GrpcServer

NewGrpcServer takes a callback and stop function and returns a Server ready to run with .Serve().

func (*GrpcServer) Export added in v0.1.0

Export implements the gRPC server interface for exporting messages.

func (*GrpcServer) ListenAndServe added in v0.1.0

func (gs *GrpcServer) ListenAndServe(otlpEndpoint string)

ListenAndServeGRPC starts a TCP listener then starts the GRPC server using ServeGRPC for you.

func (*GrpcServer) Serve added in v0.1.0

func (gs *GrpcServer) Serve(listener net.Listener) error

ServeGRPC takes a listener and starts the GRPC server on that listener. Blocks until Stop() is called.

func (*GrpcServer) Stop added in v0.1.0

func (gs *GrpcServer) Stop()

Stop sends a value to the server shutdown goroutine so it stops GRPC and calls the stop function given to newServer. Safe to call multiple times.

func (*GrpcServer) StopWait added in v0.1.0

func (gs *GrpcServer) StopWait()

StopWait stops the server and waits for it to affirm shutdown.

type HttpServer added in v0.1.0

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

HttpServer is a handle for otlp over http/protobuf.

func NewHttpServer added in v0.1.0

func NewHttpServer(cb Callback, stop Stopper) *HttpServer

NewServer takes a callback and stop function and returns a Server ready to run with .Serve().

func (*HttpServer) ListenAndServe added in v0.1.0

func (hs *HttpServer) ListenAndServe(otlpEndpoint string)

ListenAndServeHttp starts a TCP listener then starts the HTTP server using ServeHttp for you.

func (*HttpServer) Serve added in v0.1.0

func (hs *HttpServer) Serve(listener net.Listener) error

ServeHttp takes a listener and starts the HTTP server on that listener. Blocks until Stop() is called.

func (*HttpServer) ServeHTTP added in v0.1.0

func (hs *HttpServer) ServeHTTP(rw http.ResponseWriter, req *http.Request)

ServeHTTP processes every request as if it is a trace regardless of method and path or anything else.

func (*HttpServer) Stop added in v0.1.0

func (hs *HttpServer) Stop()

Stop closes the http server and all active connections immediately.

func (*HttpServer) StopWait added in v0.1.0

func (hs *HttpServer) StopWait()

StopWait stops the http server gracefully.

type OtlpServer added in v0.1.0

type OtlpServer interface {
	ListenAndServe(otlpEndpoint string)
	Serve(listener net.Listener) error
	Stop()
	StopWait()
}

OtlpServer abstracts the minimum interface required for an OTLP server to be either HTTP or gRPC (but not both, for now).

func NewServer

func NewServer(protocol string, cb Callback, stop Stopper) OtlpServer

NewServer will start the requested server protocol, one of grpc, http/protobuf, and http/json.

type Stopper

type Stopper func(OtlpServer)

Stopper is the function passed to newServer to be called when the server is shut down.

Jump to

Keyboard shortcuts

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