server

package
v0.49.0-rc.5 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package server implements a dummy http Datadog intake, meant to be used with integration and e2e tests. It runs an catch-all http server that stores submitted payloads into a dictionary of api.Payloads, indexed by the route It implements 3 testing endpoints:

  • /fakeintake/payloads/<payload_route> returns any received payloads on the specified route as [api.Payload]s
  • /fakeintake/health returns current fakeintake server health
  • /fakeintake/routestats returns stats for collected payloads, by route
  • /fakeintake/flushPayloads returns all stored payloads and clear them up

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithClock

func WithClock(clock clock.Clock) func(*Server)

func WithPort

func WithPort(port int) func(*Server)

WithPort changes the server port. If the port is 0, a port number is automatically chosen

func WithReadyChannel

func WithReadyChannel(ready chan bool) func(*Server)

WithReadyChannel assign a boolean channel to get notified when the server is ready.

func WithRetention

func WithRetention(retention time.Duration) func(*Server)

Types

type Server

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

func NewServer

func NewServer(options ...func(*Server)) *Server

NewServer creates a new fake intake server and starts it on localhost:port options accept WithPort and WithReadyChan. Call Server.Start() to start the server in a separate go-routine If the port is 0, a port number is automatically chosen

func (*Server) IsRunning

func (fi *Server) IsRunning() bool

func (*Server) Start

func (fi *Server) Start()

Start Starts a fake intake server in a separate go-routine Notifies when ready to the ready channel

func (*Server) Stop

func (fi *Server) Stop() error

Stop Gracefully stop the http server

func (*Server) URL

func (fi *Server) URL() string

Directories

Path Synopsis
Package serverstore implements storing logic for fakeintake server Stores raw payloads and try parsing known payloads dumping them to json
Package serverstore implements storing logic for fakeintake server Stores raw payloads and try parsing known payloads dumping them to json

Jump to

Keyboard shortcuts

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