traceapp - ActiveState ActiveGo 1.8
...

Package traceapp

import "sourcegraph.com/sourcegraph/appdash/traceapp"
Overview
Index
Subdirectories

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.

Constants

Traceapp's route names.

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
)

Variables

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

type App

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

type App struct {
    *Router

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

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

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

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

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

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

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

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

Subdirectories

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