dash

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: MPL-2.0 Imports: 34 Imported by: 0

Documentation

Overview

Package dash serves the Encore Developer Dashboard.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheOp added in v1.7.0

type CacheOp struct {
	Type      string `json:"type"` // "CacheOp"
	Goid      uint32 `json:"goid"`
	DefLoc    int32  `json:"def_loc"`
	StartTime int64  `json:"start_time"`
	EndTime   *int64 `json:"end_time,omitempty"`

	Operation string   `json:"operation"`
	Keys      []string `json:"keys"`
	Inputs    [][]byte `json:"inputs"`
	Outputs   [][]byte `json:"outputs"`
	Stack     Stack    `json:"stack"`
	Err       []byte   `json:"err"`
	Result    int      `json:"result"`
	Write     bool     `json:"write"`
}

type CacheResult added in v1.7.0

type CacheResult uint8

CacheResult defines the result of a cache op. The values are identical to that of tracepb.CacheOp_Result.

type DBQuery

type DBQuery struct {
	Type      string  `json:"type"`
	Goid      uint32  `json:"goid"`
	Txid      *uint32 `json:"txid"`
	CallLoc   int32   `json:"call_loc"`
	StartTime int64   `json:"start_time"`
	EndTime   *int64  `json:"end_time,omitempty"`
	Query     []byte  `json:"query"`
	HTMLQuery []byte  `json:"html_query"`
	Err       []byte  `json:"err"`
	Stack     Stack   `json:"stack"`
}

type DBTransaction

type DBTransaction struct {
	Type           string     `json:"type"`
	Goid           uint32     `json:"goid"`
	Txid           uint32     `json:"txid"`
	StartLoc       int32      `json:"start_loc"`
	EndLoc         int32      `json:"end_loc"`
	StartTime      int64      `json:"start_time"`
	EndTime        *int64     `json:"end_time,omitempty"`
	Err            []byte     `json:"err"`
	CompletionType string     `json:"completion_type"`
	Queries        []*DBQuery `json:"queries"`
	BeginStack     Stack      `json:"begin_stack"`
	EndStack       *Stack     `json:"end_stack"`
}

type Event

type Event interface {
	// contains filtered or unexported methods
}

type Goroutine

type Goroutine struct {
	Type      string `json:"type"`
	Goid      uint32 `json:"goid"`
	CallLoc   int32  `json:"call_loc"`
	StartTime int64  `json:"start_time"`
	EndTime   *int64 `json:"end_time,omitempty"`
}

type HTTPCall

type HTTPCall struct {
	Type       string          `json:"type"`
	Goid       uint32          `json:"goid"`
	ReqID      string          `json:"req_id"`
	StartTime  int64           `json:"start_time"`
	EndTime    *int64          `json:"end_time,omitempty"`
	Method     string          `json:"method"`
	Host       string          `json:"host"`
	Path       string          `json:"path"`
	URL        string          `json:"url"`
	StatusCode int             `json:"status_code"`
	Err        []byte          `json:"err"`
	Metrics    HTTPCallMetrics `json:"metrics"`
}

type HTTPCallMetrics

type HTTPCallMetrics struct {
	// Times are all 0 if not set
	GotConn           *int64 `json:"got_conn,omitempty"`
	ConnReused        bool   `json:"conn_reused,omitempty"`
	DNSDone           *int64 `json:"dns_done,omitempty"`
	TLSHandshakeDone  *int64 `json:"tls_handshake_done,omitempty"`
	WroteHeaders      *int64 `json:"wrote_headers,omitempty"`
	WroteRequest      *int64 `json:"wrote_request,omitempty"`
	FirstResponseByte *int64 `json:"first_response,omitempty"`
	BodyClosed        *int64 `json:"body_closed,omitempty"`
}

type KeyValue added in v1.10.0

type KeyValue[K comparable, V any] struct {
	Key   K `json:"key"`
	Value V `json:"value"`
}

type LogField added in v0.12.0

type LogField struct {
	Key   string      `json:"key"`
	Value interface{} `json:"value"`
	Stack *Stack      `json:"stack"`
}

type LogMessage added in v0.12.0

type LogMessage struct {
	Type    string     `json:"type"` // "LogMessage"
	Goid    uint32     `json:"goid"`
	Time    int64      `json:"time"`
	Level   string     `json:"level"` // TRACE", "DEBUG", "INFO", "WARN", or "ERROR"
	Message string     `json:"msg"`
	Fields  []LogField `json:"fields"`
	Stack   Stack      `json:"stack"`
}

type PubSubPublish added in v1.3.0

type PubSubPublish struct {
	Type      string `json:"type"` // "PubSubPublish"
	Goid      uint64 `json:"goid"`
	StartTime int64  `json:"start_time"`
	EndTime   *int64 `json:"end_time,omitempty"`
	Topic     string `json:"topic"`
	Message   []byte `json:"message"`
	MessageID string `json:"message_id"`
	Err       []byte `json:"err"`
	Stack     Stack  `json:"stack"`
}

type RPCCall

type RPCCall struct {
	Type      string `json:"type"`
	Goid      uint32 `json:"goid"`
	ReqID     string `json:"req_id"`
	CallLoc   int32  `json:"call_loc"`
	DefLoc    int32  `json:"def_loc"`
	StartTime int64  `json:"start_time"`
	EndTime   *int64 `json:"end_time,omitempty"`
	Err       []byte `json:"err"`
	Stack     Stack  `json:"stack"`
}

type Request

type Request struct {
	ID        string  `json:"id"`
	Type      string  `json:"type"`
	ParentID  *string `json:"parent_id"`
	Goid      uint32  `json:"goid"`
	StartTime int64   `json:"start_time"`
	EndTime   *int64  `json:"end_time,omitempty"`

	SvcName        string  `json:"svc_name"`
	RPCName        string  `json:"rpc_name"`
	TopicName      string  `json:"topic_name"`
	SubscriberName string  `json:"subscriber_name"`
	MessageID      string  `json:"msg_id"`
	Attempt        uint32  `json:"attempt"`
	Published      *uint64 `json:"published"`

	CallLoc *int32 `json:"call_loc"`
	DefLoc  int32  `json:"def_loc"`

	HTTPMethod       string                     `json:"http_method"`
	UserID           string                     `json:"user_id"`
	Path             string                     `json:"path"`
	PathParams       []string                   `json:"path_params"`
	RequestPayload   []byte                     `json:"request_payload"`
	ResponsePayload  []byte                     `json:"response_payload"`
	RawReqHeaders    []KeyValue[string, string] `json:"raw_req_headers"`
	RawRespHeaders   []KeyValue[string, string] `json:"raw_resp_headers"`
	ExtRequestID     string                     `json:"ext_request_id"`
	ExtCorrelationID string                     `json:"ext_correlation_id"`

	// Deprecated: Use RequestPayload, ResponsePayload etc instead.
	Inputs  [][]byte `json:"inputs"`
	Outputs [][]byte `json:"outputs"` // Deprecated: same as above

	Err      []byte     `json:"err"`
	ErrStack *Stack     `json:"err_stack"`
	Events   []Event    `json:"events"`
	Children []*Request `json:"children"`
}

type Server

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

Server is the http.Handler for serving the developer dashboard.

func NewServer

func NewServer(runMgr *run.Manager, tr *trace.Store) *Server

NewServer starts a new server and returns it.

func (*Server) OnError added in v1.8.0

func (s *Server) OnError(r *run.Run, err *errlist.List)

func (*Server) OnReload

func (s *Server) OnReload(r *run.Run)

OnReload notifies active websocket clients about the reloaded run.

func (*Server) OnStart

func (s *Server) OnStart(r *run.Run)

OnStart notifies active websocket clients about the started run.

func (*Server) OnStderr

func (s *Server) OnStderr(r *run.Run, out []byte)

OnStderr forwards the output to active websocket clients.

func (*Server) OnStdout

func (s *Server) OnStdout(r *run.Run, out []byte)

OnStdout forwards the output to active websocket clients.

func (*Server) OnStop

func (s *Server) OnStop(r *run.Run)

OnStop notifies active websocket clients about the stopped run.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*Server) WebSocket

func (s *Server) WebSocket(w http.ResponseWriter, req *http.Request)

WebSocket serves the jsonrpc2 API over WebSocket.

type ServiceInit added in v1.5.0

type ServiceInit struct {
	Type      string `json:"type"` // "ServiceInit"
	Goid      uint64 `json:"goid"`
	DefLoc    int32  `json:"def_loc"`
	StartTime int64  `json:"start_time"`
	EndTime   *int64 `json:"end_time,omitempty"`
	Service   string `json:"service"`
	Err       []byte `json:"err"`
	ErrStack  *Stack `json:"err_stack"` // can be null
}

type Stack added in v0.16.2

type Stack struct {
	Frames []StackFrame `json:"frames"`
}

type StackFrame added in v0.16.2

type StackFrame struct {
	FullFile  string `json:"full_file"`
	ShortFile string `json:"short_file"`
	Func      string `json:"func"`
	Line      int    `json:"line"`
}

type Trace

type Trace struct {
	ID        uuid.UUID `json:"id"`
	Date      time.Time `json:"date"`
	StartTime int64     `json:"start_time"`
	EndTime   int64     `json:"end_time"`
	Root      *Request  `json:"root"`
	Auth      *Request  `json:"auth"`
	UID       *string   `json:"uid"`
	UserData  []byte    `json:"user_data"`

	Locations map[int32]json.RawMessage `json:"locations"`
	Meta      json.RawMessage           `json:"meta"`
}

func TransformTrace

func TransformTrace(ct *trace.TraceMeta) (*Trace, error)

Jump to

Keyboard shortcuts

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