Documentation
¶
Index ¶
- Constants
- func DisableHTTP2(cli *http.Client)
- func NewConfiguredClient(opts ...func(*http.Client)) *http.Client
- func NewConfiguredRequestFunc(token string) ...
- func NewConfiguredWebsocketFunc(token string) func(ctx context.Context, streamEndpoint string) (*websocket.Conn, error)
- func WithFlagSet(cond bool, method func(*http.Client)) func(*http.Client)
- type SignalFx
- func (sfx *SignalFx) GetAllDetectors(ctx context.Context) ([]*types.Detector, error)
- func (sfx *SignalFx) GetDetectorByID(ctx context.Context, detectorID string) (*types.Detector, error)
- func (sfx *SignalFx) GetIncidentsByDetectorID(ctx context.Context, detectorID string, query map[string]interface{}) ([]*types.Incident, error)
- func (sfx *SignalFx) GetMetricTimeSeries(ctx context.Context, programText string, params map[string]interface{}) ([]types.Message, []*types.MetricDataPoint, error)
Constants ¶
const ( // UserAgent is set to ensure that application is mistaken as a bot UserAgent = "detector-doctor" // ContentType is set on each out going request that is not a GET method ContentType = "application/json" // DefaultTimeout used when making outbound requests DefaultTimeout = 10 * time.Second )
const ( // DefaultRealm is used when no realm is given as this is the default realm used by SignalFx DefaultRealm = "us0" // DefaultAPIEndpoint is the domain to be used when querying the API with the realm set DefaultAPIEndpoint = `https://api.%s.signalfx.com/v2` // DefaultStreamEndpoint is the domain to be used when using websockets to get data DefaultStreamEndpoint = `https://stream.%s.signalfx.com/v2` )
Variables ¶
This section is empty.
Functions ¶
func DisableHTTP2 ¶
DisableHTTP2 follows the default standard on how to disable HTTP/2 with the default http client
func NewConfiguredClient ¶
NewConfiguredClient returns a configured client and allows the caller to update any client settings they desire
func NewConfiguredRequestFunc ¶
func NewConfiguredRequestFunc(token string) func(ctx context.Context, method, url string, body io.Reader) (*http.Request, error)
NewConfiguredRequestFunc caches the token and applies them to each newly created request.
func NewConfiguredWebsocketFunc ¶
func NewConfiguredWebsocketFunc(token string) func(ctx context.Context, streamEndpoint string) (*websocket.Conn, error)
NewConfiguredWebsocketFunc returns a new configured websocket to adhere to the docs provided here: https://developers.signalfx.com/signalflow_analytics/websocket_request_messages.html
Types ¶
type SignalFx ¶
type SignalFx struct {
// contains filtered or unexported fields
}
SignalFx is the wrapper around the developer API
func NewRateLimitedSignalFxClient ¶
func NewRateLimitedSignalFxClient(realm, accessToken string, client *http.Client, limit ratelimit.Limiter) *SignalFx
NewRateLimitedSignalFxClient returns a SignalFx client with a configured limiter to be used on each outbound request
func NewSignalFxClient ¶
NewSignalFxClient returns a configured client that will interact with the API using the access token realm set. If client or realm are not configured the defaults are used
func (*SignalFx) GetAllDetectors ¶
GetAllDetectors will fetch all V2 detectors from the SignalFx api with a limit of fetching 100 per request in order to keep performance high.
func (*SignalFx) GetDetectorByID ¶
func (sfx *SignalFx) GetDetectorByID(ctx context.Context, detectorID string) (*types.Detector, error)
GetDetectorByID retrives the provided detector as defined by https://developers.signalfx.com/detectors_reference.html#tag/Retrieve-Detector-ID
func (*SignalFx) GetIncidentsByDetectorID ¶
func (sfx *SignalFx) GetIncidentsByDetectorID(ctx context.Context, detectorID string, query map[string]interface{}) ([]*types.Incident, error)
GetIncidentsByDetectorID retrives the provided incidents as defined by https://developers.signalfx.com/detectors_reference.html#tag/Retrieve-Incidents-Single-Detector
func (*SignalFx) GetMetricTimeSeries ¶
func (sfx *SignalFx) GetMetricTimeSeries(ctx context.Context, programText string, params map[string]interface{}) ([]types.Message, []*types.MetricDataPoint, error)
GetMetricTimeSeries returns the messages and data provided by the websocket API. The list of allowed parameters are documented here: https://developers.signalfx.com/signalflow_analytics/websocket_request_messages.html#_syntax_2 Some of the values are predefined for you to avoid causing issues with handling computation All time values passed should be in UTC and all time values will be configured to be int64 values