Documentation ¶
Index ¶
- Variables
- func FaviconHandler(w http.ResponseWriter, r *http.Request)
- type BindUnixSocket
- type BuildInfo
- type IgnoreRegexPattern
- type JaegerReporter
- type MaxRecursionDepth
- type MaxRegexpLength
- type MetricPushInterval
- type Option
- type ProgramPath
- type Server
- type SetBuildInfo
- type TestServer
- func (ts *TestServer) ExpectExpvarDeltaWithDeadline(name string, want int64) func()
- func (ts *TestServer) ExpectMapExpvarDeltaWithDeadline(name, key string, want int64) func()
- func (ts *TestServer) ExpectProgMetricDeltaWithDeadline(name, prog string, want int64) func()
- func (ts *TestServer) GetExpvar(name string) expvar.Var
- func (ts *TestServer) GetProgramMetric(name, prog string) datum.Datum
- func (ts *TestServer) PollWatched(n int)
- func (ts *TestServer) Start() func()
Constants ¶
This section is empty.
Variables ¶
var CompileOnly = &niladicOption{ func(m *Server) error { m.rOpts = append(m.rOpts, runtime.CompileOnly()) m.compileOnly = true return nil }, }
CompileOnly sets compile-only mode in the Server.
var DumpAst = &niladicOption{ func(m *Server) error { m.rOpts = append(m.rOpts, runtime.DumpAst()) return nil }, }
DumpAst instructs the Server's compiler to print the AST after parsing.
var DumpAstTypes = &niladicOption{ func(m *Server) error { m.rOpts = append(m.rOpts, runtime.DumpAstTypes()) return nil }, }
DumpAstTypes instructs the Server's copmiler to print the AST after type checking.
var DumpBytecode = &niladicOption{ func(m *Server) error { m.rOpts = append(m.rOpts, runtime.DumpBytecode()) return nil }, }
DumpBytecode instructs the Server's compiuler to print the program bytecode after code generation.
var EmitMetricTimestamp = &niladicOption{ func(m *Server) error { m.eOpts = append(m.eOpts, exporter.EmitTimestamp()) return nil }, }
EmitMetricTimestamp tells the Server to export the metric's timestamp.
var ErrDuplicateHTTPBindAddress = errors.New("HTTP server bind address already supplied")
var LogRuntimeErrors = &niladicOption{ func(m *Server) error { m.rOpts = append(m.rOpts, runtime.LogRuntimeErrors()) return nil }, }
LogRuntimeErrors instructs the VM to emit runtime errors to the log.
var OmitMetricSource = &niladicOption{ func(m *Server) error { m.rOpts = append(m.rOpts, runtime.OmitMetricSource()) return nil }, }
OmitMetricSource sets the Server to not link created metrics to their source program.
var OmitProgLabel = &niladicOption{ func(m *Server) error { m.eOpts = append(m.eOpts, exporter.OmitProgLabel()) return nil }, }
OmitProgLabel sets the Server to not put the program name as a label in exported metrics.
var OneShot = &niladicOption{ func(m *Server) error { m.rOpts = append(m.rOpts, runtime.ErrorsAbort()) m.tOpts = append(m.tOpts, tailer.OneShot) m.oneShot = true return nil }, }
OneShot sets one-shot mode in the Server.
var SyslogUseCurrentYear = &niladicOption{ func(m *Server) error { m.rOpts = append(m.rOpts, runtime.SyslogUseCurrentYear()) return nil }, }
SyslogUseCurrentYear instructs the Server to use the current year for year-less log timestamp during parsing.
Functions ¶
func FaviconHandler ¶
func FaviconHandler(w http.ResponseWriter, r *http.Request)
FaviconHandler is used to serve up the favicon.ico for mtail's http server.
Types ¶
type BindUnixSocket ¶
type BindUnixSocket string
BindUnixSocket sets the UNIX socket path in Server.
type BuildInfo ¶
type BuildInfo struct {
Version string
}
BuildInfo records the compile-time information for use when reporting the mtail version.
type IgnoreRegexPattern ¶
type IgnoreRegexPattern string
IgnoreRegexPattern sets the regex pattern to ignore files.
type JaegerReporter ¶
type JaegerReporter string
JaegerReporter creates a new jaeger reporter that sends to the given Jaeger endpoint address.
type MaxRecursionDepth ¶
type MaxRecursionDepth int
MaxRecursionDepth sets the maximum depth the abstract syntax tree built during lexation can have.
type MaxRegexpLength ¶
type MaxRegexpLength int
MaxRegexpLength sets the maximum length an mtail regular expression can have, in terms of characters.
type MetricPushInterval ¶
MetricPushInterval sets the interval between metrics pushes to passive collectors.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option configures mtail.Server.
func BindAddress ¶
BindAddress sets the HTTP server address in Server.
func LogPathPatterns ¶
LogPathPatterns sets the patterns to find log paths in the Server.
func LogPatternPollWaker ¶
LogPatternPollWaker triggers polls on the filesystem for new logs that match the log glob patterns.
func LogstreamPollWaker ¶
LogstreamPollWaker triggers polls on the filesystem for new logs that match the log glob streams.
func OverrideLocation ¶
OverrideLocation sets the timezone location for log timestamps without any such information.
func StaleLogGcWaker ¶
StaleLogGcWaker triggers garbage collection runs for stale logs in the tailer.
type ProgramPath ¶
type ProgramPath string
ProgramPath sets the path to find mtail programs in the Server.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server contains the state of the main mtail program.
func New ¶
New creates a Server from the supplied Options. The Server is started by the time New returns, it watches the LogPatterns for files, starts tailing their changes and sends any new lines found to the virtual machines loaded from ProgramPath. If OneShot mode is enabled, it will exit after reading each log file from start to finish. TODO(jaq): this doesn't need to be a constructor anymore, it could start and block until quit, once TestServer.PollWatched is addressed.
func (*Server) GetRegistry ¶
func (m *Server) GetRegistry() *prometheus.Registry
func (*Server) Run ¶
Run awaits mtail's shutdown. TODO(jaq): remove this once the test server is able to trigger polls on the components.
func (*Server) ServeHTTP ¶
func (m *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP satisfies the http.Handler interface, and is used to serve the root page of mtail for online status reporting.
type SetBuildInfo ¶
type SetBuildInfo BuildInfo
SetBuildInfo sets the mtail program build information in the Server.
type TestServer ¶
type TestServer struct { *Server // Set this to change the poll deadline when using DoOrTimeout within this TestServer. DoOrTimeoutDeadline time.Duration // contains filtered or unexported fields }
func TestMakeServer ¶
func TestMakeServer(tb testing.TB, wakers int, options ...Option) *TestServer
TestMakeServer makes a new TestServer for use in tests, but does not start the server. If an error occurs during creation, a testing.Fatal is issued.
func TestStartServer ¶
func TestStartServer(tb testing.TB, wakers int, options ...Option) (*TestServer, func())
TestStartServer creates a new TestServer and starts it running. It returns the server, and a stop function.
func (*TestServer) ExpectExpvarDeltaWithDeadline ¶
func (ts *TestServer) ExpectExpvarDeltaWithDeadline(name string, want int64) func()
ExpectExpvarDeltaWithDeadline returns a deferrable function which tests if the expvar metric with name has changed by delta within the given deadline, once the function begins. Before returning, it fetches the original value for comparison.
func (*TestServer) ExpectMapExpvarDeltaWithDeadline ¶
func (ts *TestServer) ExpectMapExpvarDeltaWithDeadline(name, key string, want int64) func()
ExpectMapExpvarMetricDeltaWithDeadline returns a deferrable function which tests if the expvar map metric with name and key has changed by delta within the given deadline, once the function begins. Before returning, it fetches the original value for comparison.
func (*TestServer) ExpectProgMetricDeltaWithDeadline ¶
func (ts *TestServer) ExpectProgMetricDeltaWithDeadline(name, prog string, want int64) func()
ExpectProgMetricDeltaWithDeadline tests that a given program metric increases by want within the deadline. It assumes that the named metric is an Int type datum.Datum.
func (*TestServer) GetExpvar ¶
func (ts *TestServer) GetExpvar(name string) expvar.Var
GetExpvar is a helper function on TestServer that acts like TestGetExpvar.
func (*TestServer) GetProgramMetric ¶
func (ts *TestServer) GetProgramMetric(name, prog string) datum.Datum
GetProgramMetric fetches the datum of the program metric name.
func (*TestServer) PollWatched ¶
func (ts *TestServer) PollWatched(n int)
Poll all watched objects for updates. The parameter n indicates how many logstreams to wait on before waking them.
func (*TestServer) Start ¶
func (ts *TestServer) Start() func()
Start starts the TestServer and returns a stop function.