traceapp

package
v0.0.0-...-e2786a6 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: MIT Imports: 26 Imported by: 141

Documentation

Overview

Package traceapp implements the Appdash web UI.

The web UI can be effectively launched using the appdash command (see cmd/appdash) or via embedding this package within your app.

Templates and other resources needed by this package to render the UI are built into the program using vfsgen, so you still get to have single binary deployment.

For an example of embedding the Appdash web UI within your own application via the traceapp package, see the examples/cmd/webapp example.

Index

Constants

View Source
const (
	RootRoute             = "traceapp.root"               // route name for root
	StaticRoute           = "traceapp.static"             // route name for static data files
	TraceRoute            = "traceapp.trace"              // route name for a single trace page
	TraceSpanRoute        = "traceapp.trace.span"         // route name for a single trace sub-span page
	TraceProfileRoute     = "traceapp.trace.profile"      // route name for a JSON trace profile
	TraceSpanProfileRoute = "traceapp.trace.span.profile" // route name for a JSON trace sub-span profile
	TraceUploadRoute      = "traceapp.trace.upload"       // route name for a JSON trace upload
	TracesRoute           = "traceapp.traces"             // route name for traces page
	DashboardRoute        = "traceapp.dashboard"          // route name for dashboard page
	DashboardDataRoute    = "traceapp.dashboard.data"     // route name for dashboard JSON data
	AggregateRoute        = "traceapp.aggregate"          // route name for aggregate trace view
)

Traceapp's route names.

Variables

View Source
var (
	// ReloadTemplates is whether to reload html/template templates
	// before each request. It is useful during development.
	ReloadTemplates = true
)

Functions

This section is empty.

Types

type App

type App struct {
	*Router

	Store      appdash.Store
	Queryer    appdash.Queryer
	Aggregator appdash.Aggregator

	Log *log.Logger
	// contains filtered or unexported fields
}

App is an HTTP application handler that also exposes methods for constructing URL routes.

func New

func New(r *Router, base *url.URL) (*App, error)

New creates a new application handler. If r is nil, a new router is created.

The given base URL is the absolute base URL under which traceapp is being served, e.g., "https://appdash.mysite.com" or "https://mysite.com/appdash". The base URL must contain a scheme and host, or else an error will be returned.

func (*App) ServeHTTP

func (a *App) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler.

type Router

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

Router is a URL router for traceapp applications. It should be created via the NewRouter function.

func NewRouter

func NewRouter(base *mux.Router) *Router

NewRouter creates a new URL router for a traceapp application.

func (*Router) URLTo

func (r *Router) URLTo(route string) (*url.URL, error)

URLTo constructs a URL to a given route.

func (*Router) URLToTrace

func (r *Router) URLToTrace(id appdash.ID) (*url.URL, error)

URLToTrace constructs a URL to a given trace by ID.

func (*Router) URLToTraceProfile

func (r *Router) URLToTraceProfile(trace appdash.ID) (*url.URL, error)

URLToTraceProfile constructs a URL to a trace's JSON profile.

func (*Router) URLToTraceSpan

func (r *Router) URLToTraceSpan(trace, span appdash.ID) (*url.URL, error)

URLToTraceSpan constructs a URL to a sub-span in a trace.

func (*Router) URLToTraceSpanProfile

func (r *Router) URLToTraceSpanProfile(trace, span appdash.ID) (*url.URL, error)

URLToTraceSpanProfile constructs a URL to a sub-span's JSON profile in a trace.

type TemplateCommon

type TemplateCommon struct {
	CurrentRoute  string
	CurrentURI    *url.URL
	BaseURL       *url.URL
	HaveDashboard bool
}

TemplateCommon is data that is passed to (and available to) all templates.

Directories

Path Synopsis
Package tmpl contains template data used by Appdash.
Package tmpl contains template data used by Appdash.

Jump to

Keyboard shortcuts

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