Documentation
¶
Overview ¶
Package observability turns a short provider form into data export destinations. Provider facts live in presets.json, this code only renders.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalid = fmt.Errorf("invalid observability export")
ErrInvalid wraps every form validation failure so callers can answer 400.
Functions ¶
func DestinationName ¶
DestinationName builds the stored name of one signal destination.
func ParseDestinationName ¶
ParseDestinationName splits a stored name made by DestinationName.
Types ¶
type Choice ¶
type Choice struct {
Value string `json:"value"`
Label string `json:"label"`
Vars map[string]string `json:"vars,omitempty"`
}
Choice is one allowed value of a select field. Vars are extra template variables that apply when it is picked, such as a regional host.
type Field ¶
type Field struct {
Key string `json:"key"`
Label string `json:"label"`
Type string `json:"type,omitempty"`
Secret bool `json:"secret,omitempty"`
Required bool `json:"required,omitempty"`
Default string `json:"default,omitempty"`
Placeholder string `json:"placeholder,omitempty"`
Help string `json:"help,omitempty"`
Choices []Choice `json:"choices,omitempty"`
}
Field is one input of a preset form. Secret fields are never echoed back.
type Preset ¶
type Preset struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
DocsAnchor string `json:"docs_anchor"`
Fields []Field `json:"fields"`
Signals []SignalSpec `json:"signals"`
Hints map[string]string `json:"hints"`
}
Preset is one provider entry of the catalog.
func (Preset) DefaultSignals ¶
DefaultSignals lists the signals exported when the caller names none.
func (Preset) Hint ¶
Hint maps a delivery error to the provider's remedy text. It returns the HTTP status found in the error (0 if none) and the hint, which may be empty.
func (Preset) Render ¶
Render builds the destinations for the chosen signals. An empty signal list means the preset defaults. name groups the destinations of one export.
func (Preset) SignalNames ¶
SignalNames lists the signals a preset can export.
type Rendered ¶
type Rendered struct {
Signal string
Input dataexport.Input
Endpoint string
HeaderNames []string
}
Rendered is one destination ready to create. Endpoint and HeaderNames are safe to show; Input carries the credential and must not be logged.
type SignalSpec ¶
type SignalSpec struct {
Signal string `json:"signal"`
Kind store.ExportKind `json:"kind"`
Default bool `json:"default"`
Endpoint string `json:"endpoint,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Options map[string]string `json:"options,omitempty"`
APIKey string `json:"api_key,omitempty"`
}
SignalSpec describes how one signal is delivered for a preset.