Documentation
¶
Overview ¶
Package diagnostics provides bounded, native-free application measurements.
Index ¶
- Constants
- func ErrorCode(err error) string
- func SourceState() string
- type Capture
- type CaptureRequest
- type CaptureSummary
- type Catalog
- type Client
- type Comparison
- type EndpointIdentity
- type Error
- type HTTPOptions
- type HTTPServer
- type Health
- type History
- type Identity
- type Limits
- type Metric
- type MetricComparison
- type MetricDescriptor
- type Options
- type Point
- type Service
- func (s *Service) Aggregation(k sdkmetric.InstrumentKind) sdkmetric.Aggregation
- func (s *Service) CancelCapture(id string) (Capture, error)
- func (s *Service) Close() error
- func (s *Service) CompareCaptures(baseline, candidate string) (Comparison, error)
- func (s *Service) DeleteCapture(id string) error
- func (s *Service) Export(ctx context.Context, data *metricdata.ResourceMetrics) error
- func (s *Service) ForceFlush(ctx context.Context) error
- func (s *Service) Fresh() bool
- func (s *Service) GetCapture(id string) (Capture, error)
- func (s *Service) GetCatalog() Catalog
- func (s *Service) GetHistory() History
- func (s *Service) GetSnapshot() Snapshot
- func (s *Service) ListCaptures() []CaptureSummary
- func (s *Service) Prometheus() string
- func (s *Service) SetConfigID(id string)
- func (s *Service) SetRemote(exp sdkmetric.Exporter)
- func (s *Service) SetRemoteEnabled(enabled bool)
- func (s *Service) Shutdown(ctx context.Context) error
- func (s *Service) StartCapture(r CaptureRequest) (Capture, error)
- func (s *Service) Temporality(k sdkmetric.InstrumentKind) metricdata.Temporality
- type Snapshot
Constants ¶
const SchemaVersion = 1
Variables ¶
This section is empty.
Functions ¶
func SourceState ¶
func SourceState() string
SourceState reports build-time VCS evidence, never the current working tree. An unknown result means the binary contains no vcs.modified build setting.
Types ¶
type Capture ¶
type Capture struct {
SchemaVersion int `json:"schemaVersion"`
ID string `json:"id"`
Name string `json:"name"`
Workload string `json:"workload"`
Status string `json:"status"`
Identity Identity `json:"identity"`
StartedAt time.Time `json:"startedAt"`
EndedAt time.Time `json:"endedAt"`
DurationSeconds int `json:"durationSeconds"`
ElapsedSeconds float64 `json:"elapsedSeconds"`
Samples []Snapshot `json:"samples"`
Coverage Health `json:"coverage"`
Error string `json:"error"`
}
type CaptureRequest ¶
type CaptureSummary ¶
type CaptureSummary struct {
SchemaVersion int `json:"schemaVersion"`
ID string `json:"id"`
Name string `json:"name"`
Workload string `json:"workload"`
Status string `json:"status"`
Identity Identity `json:"identity"`
StartedAt time.Time `json:"startedAt"`
EndedAt time.Time `json:"endedAt"`
DurationSeconds int `json:"durationSeconds"`
ElapsedSeconds float64 `json:"elapsedSeconds"`
SampleCount int `json:"sampleCount"`
Coverage Health `json:"coverage"`
Error string `json:"error"`
}
CaptureSummary is the bounded polling/list representation. Samples are fetched only by GetCapture.
type Catalog ¶
type Catalog struct {
SchemaVersion int `json:"schemaVersion"`
Identity Identity `json:"identity"`
Metrics []MetricDescriptor `json:"metrics"`
Limits Limits `json:"limits"`
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func DiscoverClient ¶
func DiscoverClient(ctx context.Context, options HTTPOptions) (*Client, error)
DiscoverClient verifies private files, process lifetime, profile and authenticated identity.
type Comparison ¶
type Comparison struct {
Baseline string `json:"baseline"`
Candidate string `json:"candidate"`
Compatible bool `json:"compatible"`
Warnings []string `json:"warnings"`
Metrics []MetricComparison `json:"metrics"`
}
type EndpointIdentity ¶
type EndpointIdentity struct {
SchemaVersion int `json:"schemaVersion"`
WorkspaceID string `json:"workspaceId"`
InstanceID string `json:"instanceId"`
Generation string `json:"generation"`
StateRoot string `json:"stateRoot"`
Endpoint string `json:"endpoint"`
Process devcontract.ProcessIdentity `json:"process"`
Capabilities []string `json:"capabilities"`
}
EndpointIdentity is public identity proof; it contains no credential references.
type HTTPOptions ¶
type HTTPOptions struct{ RuntimeDirectory, WorkspaceID, StateRoot, Source string }
HTTPOptions selects one profile. Diagnostics never writes control discovery.
type HTTPServer ¶
type HTTPServer struct {
// contains filtered or unexported fields
}
func StartHTTP ¶
func StartHTTP(ctx context.Context, service *Service, options HTTPOptions) (*HTTPServer, error)
StartHTTP starts diagnostics in desktop and development builds alike.
func (*HTTPServer) Close ¶
func (s *HTTPServer) Close() error
func (*HTTPServer) ServeHTTP ¶
func (s *HTTPServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Identity ¶
type Identity struct {
InstanceID string `json:"instanceID"`
Version string `json:"version"`
Revision string `json:"revision"`
ConfigID string `json:"configID"`
// SessionID identifies one process launch; InstanceID identifies its stable profile.
SessionID string `json:"sessionID"`
Generation string `json:"generation"`
// SourceState is clean, modified, or unknown. Revision alone is not a source fingerprint.
SourceState string `json:"sourceState"`
BuildDate string `json:"buildDate"`
// ConfigScope describes exactly which settings ConfigID covers.
ConfigScope string `json:"configScope"`
}
type Limits ¶
type Limits struct {
HistorySamples int `json:"historySamples"`
CaptureCount int `json:"captureCount"`
CaptureSeconds int `json:"captureSeconds"`
ConcurrentCaptures int `json:"concurrentCaptures"`
DiskBytes int64 `json:"diskBytes"`
Metrics int `json:"metrics"`
SeriesPerMetric int `json:"seriesPerMetric"`
SampleBytes int `json:"sampleBytes"`
CaptureBytes int `json:"captureBytes"`
}
type MetricComparison ¶
type MetricComparison struct {
Name string `json:"name"`
Unit string `json:"unit"`
Kind string `json:"kind"`
Attributes map[string]string `json:"attributes"`
Baseline float64 `json:"baseline"`
Candidate float64 `json:"candidate"`
Delta float64 `json:"delta"`
Semantics string `json:"semantics"`
Valid bool `json:"valid"`
Warning string `json:"warning"`
}
type MetricDescriptor ¶
type MetricDescriptor struct {
Name string `json:"name"`
Description string `json:"description"`
Unit string `json:"unit"`
Kind string `json:"kind"`
}
MetricDescriptor describes an instrument without copying its collected points.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) Aggregation ¶
func (s *Service) Aggregation(k sdkmetric.InstrumentKind) sdkmetric.Aggregation
func (*Service) CompareCaptures ¶
func (s *Service) CompareCaptures(baseline, candidate string) (Comparison, error)
func (*Service) DeleteCapture ¶
DeleteCapture removes a finished capture from memory and disk so its slot and storage can be reused. Running captures must be canceled first.
func (*Service) Export ¶
func (s *Service) Export(ctx context.Context, data *metricdata.ResourceMetrics) error
func (*Service) Fresh ¶
Fresh reports whether collection is current, so scrapes can fail instead of republishing cached values under new scrape timestamps.
func (*Service) GetCatalog ¶
func (*Service) GetHistory ¶
func (*Service) GetSnapshot ¶
func (*Service) ListCaptures ¶
func (s *Service) ListCaptures() []CaptureSummary
func (*Service) Prometheus ¶
func (*Service) SetConfigID ¶
func (*Service) SetRemoteEnabled ¶
func (*Service) StartCapture ¶
func (s *Service) StartCapture(r CaptureRequest) (Capture, error)
func (*Service) Temporality ¶
func (s *Service) Temporality(k sdkmetric.InstrumentKind) metricdata.Temporality