Documentation ¶
Overview ¶
Package lokahi is a generated protocol buffer package.
lokahi is a HTTP health checking and response time monitoring service.
It is generated from these files:
lokahi.proto
It has these top-level messages:
CreateOpts CheckID Check CheckStatus ListOpts ChecksPage HistogramData Nil
Package lokahi is a generated twirp stub package. This code was generated with github.com/twitchtv/twirp/protoc-gen-twirp v5.2.0.
lokahi is a HTTP health checking and response time monitoring service.
It is generated from these files:
lokahi.proto
Index ¶
- Constants
- Variables
- func WriteError(resp http.ResponseWriter, err error)
- type Check
- func (*Check) Descriptor() ([]byte, []int)
- func (m *Check) GetEvery() int32
- func (m *Check) GetId() string
- func (m *Check) GetPlaybookUrl() string
- func (m *Check) GetState() Check_State
- func (m *Check) GetUrl() string
- func (m *Check) GetWebhookResponseTimeNanoseconds() int64
- func (m *Check) GetWebhookUrl() string
- func (*Check) ProtoMessage()
- func (m *Check) Reset()
- func (m *Check) String() string
- type CheckID
- type CheckStatus
- func (*CheckStatus) Descriptor() ([]byte, []int)
- func (m *CheckStatus) GetCheck() *Check
- func (m *CheckStatus) GetHistogramData() *HistogramData
- func (m *CheckStatus) GetLastResponseTimeNanoseconds() int64
- func (m *CheckStatus) GetRespStatusCode() int32
- func (*CheckStatus) ProtoMessage()
- func (m *CheckStatus) Reset()
- func (m *CheckStatus) String() string
- type Check_State
- type Checks
- type ChecksPage
- type ChecksPage_Result
- type CreateOpts
- func (*CreateOpts) Descriptor() ([]byte, []int)
- func (m *CreateOpts) GetEvery() int32
- func (m *CreateOpts) GetPlaybookUrl() string
- func (m *CreateOpts) GetUrl() string
- func (m *CreateOpts) GetWebhookUrl() string
- func (*CreateOpts) ProtoMessage()
- func (m *CreateOpts) Reset()
- func (m *CreateOpts) String() string
- type HTTPClient
- type HistogramData
- func (*HistogramData) Descriptor() ([]byte, []int)
- func (m *HistogramData) GetMaxNanoseconds() float64
- func (m *HistogramData) GetMeanNanoseconds() float64
- func (m *HistogramData) GetMinNanoseconds() float64
- func (m *HistogramData) GetP50Nanoseconds() float64
- func (m *HistogramData) GetP75Nanoseconds() float64
- func (m *HistogramData) GetP95Nanoseconds() float64
- func (m *HistogramData) GetP99Nanoseconds() float64
- func (m *HistogramData) GetStddev() float64
- func (*HistogramData) ProtoMessage()
- func (m *HistogramData) Reset()
- func (m *HistogramData) String() string
- type ListOpts
- type Nil
- type TwirpServer
- type Webhook
Constants ¶
const ChecksPathPrefix = "/twirp/github.xe.lokahi.Checks/"
ChecksPathPrefix is used for all URL paths on a twirp Checks server. Requests are always: POST ChecksPathPrefix/method It can be used in an HTTP mux to route twirp requests along with non-twirp requests on other routes.
const WebhookPathPrefix = "/twirp/github.xe.lokahi.Webhook/"
WebhookPathPrefix is used for all URL paths on a twirp Webhook server. Requests are always: POST WebhookPathPrefix/method It can be used in an HTTP mux to route twirp requests along with non-twirp requests on other routes.
Variables ¶
var Check_State_name = map[int32]string{
0: "INIT",
1: "UP",
2: "DOWN",
3: "ERROR",
}
var Check_State_value = map[string]int32{
"INIT": 0,
"UP": 1,
"DOWN": 2,
"ERROR": 3,
}
Functions ¶
func WriteError ¶
func WriteError(resp http.ResponseWriter, err error)
WriteError writes an HTTP response with a valid Twirp error format. If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)
Types ¶
type Check ¶
type Check struct { // id is the unique id of this check. Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` // url is the HTTP/S url that will be monitored. Url string `protobuf:"bytes,2,opt,name=url" json:"url,omitempty"` // webhook_url is the HTTP/S url that will be HTTPS POST-ed to with the body // containing a protobuf-encoded CheckStatus message. WebhookUrl string `protobuf:"bytes,3,opt,name=webhook_url,json=webhookUrl" json:"webhook_url,omitempty"` // webhook_response_time_nanoseconds is last the response time of the webhook. WebhookResponseTimeNanoseconds int64 `` /* 149-byte string literal not displayed */ // health checks happen every number of seconds (minimum: 60, maximum: 600). Every int32 `protobuf:"varint,5,opt,name=every" json:"every,omitempty"` // playbook_url is the playbook URL that will be passed to status webhooks. PlaybookUrl string `protobuf:"bytes,6,opt,name=playbook_url,json=playbookUrl" json:"playbook_url,omitempty"` // state is the current state of this uptime check. State Check_State `protobuf:"varint,7,opt,name=state,enum=github.xe.lokahi.Check_State" json:"state,omitempty"` }
Check is an individual HTTP check.
func (*Check) Descriptor ¶
func (*Check) GetPlaybookUrl ¶
func (*Check) GetState ¶
func (m *Check) GetState() Check_State
func (*Check) GetWebhookResponseTimeNanoseconds ¶
func (*Check) GetWebhookUrl ¶
func (*Check) ProtoMessage ¶
func (*Check) ProtoMessage()
type CheckID ¶
type CheckID struct { // id is the Check id. Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` }
CheckID is a small wrapper around a Check ID.
func (*CheckID) Descriptor ¶
func (*CheckID) ProtoMessage ¶
func (*CheckID) ProtoMessage()
type CheckStatus ¶
type CheckStatus struct { // check is the information for the relevant Check. Check *Check `protobuf:"bytes,1,opt,name=check" json:"check,omitempty"` // last_response_time_nanoseconds is the last http web response time from the // Check's monitoring URL in nanoseconds. LastResponseTimeNanoseconds int64 `` /* 140-byte string literal not displayed */ // histogram_data is the detailed histogram data for this check. HistogramData *HistogramData `protobuf:"bytes,3,opt,name=histogram_data,json=histogramData" json:"histogram_data,omitempty"` // resp_status_code is the HTTP status response code of the URL being monitored. RespStatusCode int32 `protobuf:"varint,4,opt,name=resp_status_code,json=respStatusCode" json:"resp_status_code,omitempty"` }
CheckStatus contains detailed information about the uptime status of a Check. This is POST-ed to webhook recipients.
func (*CheckStatus) Descriptor ¶
func (*CheckStatus) Descriptor() ([]byte, []int)
func (*CheckStatus) GetCheck ¶
func (m *CheckStatus) GetCheck() *Check
func (*CheckStatus) GetHistogramData ¶
func (m *CheckStatus) GetHistogramData() *HistogramData
func (*CheckStatus) GetLastResponseTimeNanoseconds ¶
func (m *CheckStatus) GetLastResponseTimeNanoseconds() int64
func (*CheckStatus) GetRespStatusCode ¶
func (m *CheckStatus) GetRespStatusCode() int32
func (*CheckStatus) ProtoMessage ¶
func (*CheckStatus) ProtoMessage()
func (*CheckStatus) Reset ¶
func (m *CheckStatus) Reset()
func (*CheckStatus) String ¶
func (m *CheckStatus) String() string
type Check_State ¶
type Check_State int32
State is the finite state machine state.
const ( Check_INIT Check_State = 0 Check_UP Check_State = 1 Check_DOWN Check_State = 2 Check_ERROR Check_State = 3 )
func (Check_State) EnumDescriptor ¶
func (Check_State) EnumDescriptor() ([]byte, []int)
func (Check_State) String ¶
func (x Check_State) String() string
type Checks ¶
type Checks interface { // Create creates a new health check with the given options. Create(context.Context, *CreateOpts) (*Check, error) // Delete removes a check by ID and returns the data that was deleted. Delete(context.Context, *CheckID) (*Check, error) // Get returns information on a check by ID. Get(context.Context, *CheckID) (*Check, error) // List returns a page of checks based on a few options. List(context.Context, *ListOpts) (*ChecksPage, error) // Put updates a Check. Put(context.Context, *Check) (*Check, error) // Status returns the detailed histogram status of a check. Status(context.Context, *CheckID) (*CheckStatus, error) }
Checks manages and schedules web application health checks.
func NewChecksJSONClient ¶
func NewChecksJSONClient(addr string, client HTTPClient) Checks
NewChecksJSONClient creates a JSON client that implements the Checks interface. It communicates using JSON and can be configured with a custom HTTPClient.
func NewChecksProtobufClient ¶
func NewChecksProtobufClient(addr string, client HTTPClient) Checks
NewChecksProtobufClient creates a Protobuf client that implements the Checks interface. It communicates using Protobuf and can be configured with a custom HTTPClient.
type ChecksPage ¶
type ChecksPage struct {
Results []*ChecksPage_Result `protobuf:"bytes,1,rep,name=results" json:"results,omitempty"`
}
ChecksPage is a paginated Check list response.
func (*ChecksPage) Descriptor ¶
func (*ChecksPage) Descriptor() ([]byte, []int)
func (*ChecksPage) GetResults ¶
func (m *ChecksPage) GetResults() []*ChecksPage_Result
func (*ChecksPage) ProtoMessage ¶
func (*ChecksPage) ProtoMessage()
func (*ChecksPage) Reset ¶
func (m *ChecksPage) Reset()
func (*ChecksPage) String ¶
func (m *ChecksPage) String() string
type ChecksPage_Result ¶
type ChecksPage_Result struct { // check is the individual check being listed. Check *Check `protobuf:"bytes,1,opt,name=check" json:"check,omitempty"` // histogram_data is the detailed histogram data for this check, this is // nornally not set unless include_status is set in ListOpts. HistogramData *HistogramData `protobuf:"bytes,2,opt,name=histogram_data,json=histogramData" json:"histogram_data,omitempty"` }
Result is an individual List result.
func (*ChecksPage_Result) Descriptor ¶
func (*ChecksPage_Result) Descriptor() ([]byte, []int)
func (*ChecksPage_Result) GetCheck ¶
func (m *ChecksPage_Result) GetCheck() *Check
func (*ChecksPage_Result) GetHistogramData ¶
func (m *ChecksPage_Result) GetHistogramData() *HistogramData
func (*ChecksPage_Result) ProtoMessage ¶
func (*ChecksPage_Result) ProtoMessage()
func (*ChecksPage_Result) Reset ¶
func (m *ChecksPage_Result) Reset()
func (*ChecksPage_Result) String ¶
func (m *ChecksPage_Result) String() string
type CreateOpts ¶
type CreateOpts struct { // url is the HTTP/S url that will be monitored. Url string `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"` // webhook_url is the HTTP/S url that will be HTTPS POST-ed to with the body // containing a protobuf-encoded CheckStatus message. WebhookUrl string `protobuf:"bytes,2,opt,name=webhook_url,json=webhookUrl" json:"webhook_url,omitempty"` // health checks happen every number of seconds (minimum: 60, maximum: 600). Every int32 `protobuf:"varint,3,opt,name=every" json:"every,omitempty"` // playbook_url is the playbook URL that will be passed to status webhooks. PlaybookUrl string `protobuf:"bytes,4,opt,name=playbook_url,json=playbookUrl" json:"playbook_url,omitempty"` }
CreateOpts contains arguments used to construct a Check.
func (*CreateOpts) Descriptor ¶
func (*CreateOpts) Descriptor() ([]byte, []int)
func (*CreateOpts) GetEvery ¶
func (m *CreateOpts) GetEvery() int32
func (*CreateOpts) GetPlaybookUrl ¶
func (m *CreateOpts) GetPlaybookUrl() string
func (*CreateOpts) GetUrl ¶
func (m *CreateOpts) GetUrl() string
func (*CreateOpts) GetWebhookUrl ¶
func (m *CreateOpts) GetWebhookUrl() string
func (*CreateOpts) ProtoMessage ¶
func (*CreateOpts) ProtoMessage()
func (*CreateOpts) Reset ¶
func (m *CreateOpts) Reset()
func (*CreateOpts) String ¶
func (m *CreateOpts) String() string
type HTTPClient ¶
HTTPClient is the interface used by generated clients to send HTTP requests. It is fulfilled by *(net/http).Client, which is sufficient for most users. Users can provide their own implementation for special retry policies.
HTTPClient implementations should not follow redirects. Redirects are automatically disabled if *(net/http).Client is passed to client constructors. See the withoutRedirects function in this file for more details.
type HistogramData ¶
type HistogramData struct { // max_nanoseconds is the maximum http web response time in nanoseconds. MaxNanoseconds float64 `protobuf:"fixed64,1,opt,name=max_nanoseconds,json=maxNanoseconds" json:"max_nanoseconds,omitempty"` // min_nanoseconds is the minimum http web response time in nanoseconds. MinNanoseconds float64 `protobuf:"fixed64,2,opt,name=min_nanoseconds,json=minNanoseconds" json:"min_nanoseconds,omitempty"` // mean_nanoseconds is the mean http web response time in nanoseconds. MeanNanoseconds float64 `protobuf:"fixed64,3,opt,name=mean_nanoseconds,json=meanNanoseconds" json:"mean_nanoseconds,omitempty"` // stddev is the standard deviation from the mean. Stddev float64 `protobuf:"fixed64,4,opt,name=stddev" json:"stddev,omitempty"` // p50_nanoseconds is the 50th percentile of the http web response times in // nanoseconds. P50Nanoseconds float64 `protobuf:"fixed64,5,opt,name=p50_nanoseconds,json=p50Nanoseconds" json:"p50_nanoseconds,omitempty"` // p75_nanoseconds is the 75th percentile of the http web response times in // nanoseconds. P75Nanoseconds float64 `protobuf:"fixed64,6,opt,name=p75_nanoseconds,json=p75Nanoseconds" json:"p75_nanoseconds,omitempty"` // p95_nanoseconds is the 95th percentile of the http web response times in // nanoseconds. P95Nanoseconds float64 `protobuf:"fixed64,7,opt,name=p95_nanoseconds,json=p95Nanoseconds" json:"p95_nanoseconds,omitempty"` // p99_nanoseconds is the 95th percentile of the http web response times in // nanoseconds. P99Nanoseconds float64 `protobuf:"fixed64,8,opt,name=p99_nanoseconds,json=p99Nanoseconds" json:"p99_nanoseconds,omitempty"` }
HistogramData contains information from the HDR histogram maintained for each check.
func (*HistogramData) Descriptor ¶
func (*HistogramData) Descriptor() ([]byte, []int)
func (*HistogramData) GetMaxNanoseconds ¶
func (m *HistogramData) GetMaxNanoseconds() float64
func (*HistogramData) GetMeanNanoseconds ¶
func (m *HistogramData) GetMeanNanoseconds() float64
func (*HistogramData) GetMinNanoseconds ¶
func (m *HistogramData) GetMinNanoseconds() float64
func (*HistogramData) GetP50Nanoseconds ¶
func (m *HistogramData) GetP50Nanoseconds() float64
func (*HistogramData) GetP75Nanoseconds ¶
func (m *HistogramData) GetP75Nanoseconds() float64
func (*HistogramData) GetP95Nanoseconds ¶
func (m *HistogramData) GetP95Nanoseconds() float64
func (*HistogramData) GetP99Nanoseconds ¶
func (m *HistogramData) GetP99Nanoseconds() float64
func (*HistogramData) GetStddev ¶
func (m *HistogramData) GetStddev() float64
func (*HistogramData) ProtoMessage ¶
func (*HistogramData) ProtoMessage()
func (*HistogramData) Reset ¶
func (m *HistogramData) Reset()
func (*HistogramData) String ¶
func (m *HistogramData) String() string
type ListOpts ¶
type ListOpts struct { // count is the number of checks that will be returned. Count int32 `protobuf:"varint,1,opt,name=count" json:"count,omitempty"` // offset is the number of checks that will be offset Offset int32 `protobuf:"varint,2,opt,name=offset" json:"offset,omitempty"` // include_status includes the histogram data for each check result. // This is O(scary). Use this with care. IncludeStatus bool `protobuf:"varint,3,opt,name=include_status,json=includeStatus" json:"include_status,omitempty"` }
ListOpts contains options to the service Checks method List.
func (*ListOpts) Descriptor ¶
func (*ListOpts) GetIncludeStatus ¶
func (*ListOpts) ProtoMessage ¶
func (*ListOpts) ProtoMessage()
type Nil ¶
type Nil struct { }
func (*Nil) Descriptor ¶
func (*Nil) ProtoMessage ¶
func (*Nil) ProtoMessage()
type TwirpServer ¶
type TwirpServer interface { http.Handler // ServiceDescriptor returns gzipped bytes describing the .proto file that // this service was generated from. Once unzipped, the bytes can be // unmarshalled as a // github.com/golang/protobuf/protoc-gen-go/descriptor.FileDescriptorProto. // // The returned integer is the index of this particular service within that // FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a // low-level field, expected to be used for reflection. ServiceDescriptor() ([]byte, int) // ProtocGenTwirpVersion is the semantic version string of the version of // twirp used to generate this file. ProtocGenTwirpVersion() string }
TwirpServer is the interface generated server structs will support: they're HTTP handlers with additional methods for accessing metadata about the service. Those accessors are a low-level API for building reflection tools. Most people can think of TwirpServers as just http.Handlers.
func NewChecksServer ¶
func NewChecksServer(svc Checks, hooks *twirp.ServerHooks) TwirpServer
func NewWebhookServer ¶
func NewWebhookServer(svc Webhook, hooks *twirp.ServerHooks) TwirpServer
type Webhook ¶
type Webhook interface {
Handle(context.Context, *CheckStatus) (*Nil, error)
}
func NewWebhookJSONClient ¶
func NewWebhookJSONClient(addr string, client HTTPClient) Webhook
NewWebhookJSONClient creates a JSON client that implements the Webhook interface. It communicates using JSON and can be configured with a custom HTTPClient.
func NewWebhookProtobufClient ¶
func NewWebhookProtobufClient(addr string, client HTTPClient) Webhook
NewWebhookProtobufClient creates a Protobuf client that implements the Webhook interface. It communicates using Protobuf and can be configured with a custom HTTPClient.