Documentation ¶
Overview ¶
Package client provides a client to interact with the Honeycomb API.
Documentation of the API can be found here: https://docs.honeycomb.io/api/
Index ¶
- Constants
- func DatasetDefinitionDefaults() map[string][]string
- func DatasetDefinitionFields() []string
- func Equivalent[T any](a, b []T) bool
- func IsZero[T comparable](v T) bool
- func MatchesTriggerSubset(query *QuerySpec) error
- func PtrValueOrDefault[T any](v *T, d T) T
- func ToPtr[T any](v T) *T
- func ValueOrDefault[T comparable](v, d T) T
- type Auth
- type AuthMetadata
- type Board
- type BoardColumnStyle
- type BoardGraphSettings
- type BoardLinks
- type BoardQuery
- type BoardQueryStyle
- type BoardStyle
- type Boards
- type BurnAlert
- type BurnAlertAlertType
- type BurnAlerts
- type CalculationOp
- type CalculationSpec
- type Client
- type Column
- type ColumnType
- type Columns
- type Config
- type Dataset
- type DatasetDefinition
- type DatasetDefinitions
- type Datasets
- type DefinitionColumn
- type DerivedColumn
- type DerivedColumns
- type DetailedError
- type ErrorTypeDetail
- type FilterCombination
- type FilterOp
- type FilterSpec
- type HavingOp
- type HavingSpec
- type Marker
- type MarkerSetting
- type MarkerSettings
- type Markers
- type NotificationRecipient
- type NotificationRecipientDetails
- type OrderSpec
- type PagerDutySeverity
- type Queries
- type QueryAnnotation
- type QueryAnnotations
- type QueryResult
- type QueryResultData
- type QueryResultLinks
- type QueryResultRequest
- type QueryResults
- type QuerySpec
- type Recipient
- type RecipientDetails
- type RecipientType
- type Recipients
- type SLIRef
- type SLO
- type SLORef
- type SLOs
- type SortOrder
- type Trigger
- type TriggerAlertType
- type TriggerEvaluationSchedule
- type TriggerEvaluationScheduleType
- type TriggerEvaluationWindow
- type TriggerThreshold
- type TriggerThresholdOp
- type Triggers
Constants ¶
const ( DefaultAPIHost = "https://api.honeycomb.io" DefaultAPIEndpointEnv = "HONEYCOMB_API_ENDPOINT" DefaultAPIKeyEnv = "HONEYCOMB_API_KEY" // Deprecated: use DefaultAPIKeyEnv instead. To be removed in v1.0 LegacyAPIKeyEnv = "HONEYCOMBIO_APIKEY" )
const ( DefaultQueryTimeRange = 2 * 60 * 60 DefaultQueryLimit = 1000 )
const ( // Trigger threshold ops TriggerThresholdOpGreaterThan TriggerThresholdOp = ">" TriggerThresholdOpGreaterThanOrEqual TriggerThresholdOp = ">=" TriggerThresholdOpLessThan TriggerThresholdOp = "<" TriggerThresholdOpLessThanOrEqual TriggerThresholdOp = "<=" // Trigger alert types TriggerAlertTypeOnChange TriggerAlertType = "on_change" TriggerAlertTypeOnTrue TriggerAlertType = "on_true" // Trigger evaluation schedule types TriggerEvaluationScheduleFrequency TriggerEvaluationScheduleType = "frequency" TriggerEvaluationScheduleWindow TriggerEvaluationScheduleType = "window" )
const QueryResultPollInterval time.Duration = 200 * time.Millisecond
Variables ¶
This section is empty.
Functions ¶
func DatasetDefinitionDefaults ¶ added in v0.12.0
A mapping of Dataset Definition names to their possible default values (excluding 'nil')
func DatasetDefinitionFields ¶ added in v0.12.0
func DatasetDefinitionFields() []string
The names of all possible Dataset Definitions which can be set
func Equivalent ¶ added in v0.11.2
Determines if two slices of the same type are equivalent as opposed to equal
For example: []string{"bob", "alice"} is equivalent but not equal to []string{"alice", "bob"}
func IsZero ¶ added in v0.13.1
func IsZero[T comparable](v T) bool
func MatchesTriggerSubset ¶
MatchesTriggerSubset checks that the given QuerySpec matches the strict subset required to be used in a trigger.
The following properties must be valid:
- the query must contain exactly one calculation
- the HEATMAP calculation may not be used
- only the following fields may be set: calculations, breakdown, filters, filter_combination and time_range
For more information, refer to https://docs.honeycomb.io/api/triggers/#fields-on-a-trigger
func PtrValueOrDefault ¶ added in v0.13.1
func PtrValueOrDefault[T any](v *T, d T) T
func ValueOrDefault ¶ added in v0.13.1
func ValueOrDefault[T comparable](v, d T) T
Types ¶
type Auth ¶ added in v0.16.0
type Auth interface { // List all authorizations for this API key in this team and environment. List(ctx context.Context) (AuthMetadata, error) }
The Auth endpoint lists authorizations that have been granted for an API key within a team and environment.
API docs: https://docs.honeycomb.io/api/auth/
type AuthMetadata ¶ added in v0.16.0
type AuthMetadata struct { // Authorizations granted to this API key. APIKeyAccess struct { Boards bool `json:"boards"` Columns bool `json:"columns"` CreateDatasets bool `json:"create_datasets"` Events bool `json:"events"` Markers bool `json:"markers"` Queries bool `json:"queries"` Recipients bool `json:"recipients"` SLOs bool `json:"slos"` Triggers bool `json:"triggers"` } `json:"api_key_access"` Environment struct { // Name is empty for Classic environments. Name string `json:"name"` // Slug is empty for Classic environments. Slug string `json:"slug"` } `json:"environment"` Team struct { Name string `json:"name"` Slug string `json:"slug"` } `json:"team"` }
type Board ¶
type Board struct { ID string `json:"id,omitempty"` // Name of the board, this is displayed in the Honeycomb UI. This field is // required. Name string `json:"name"` // Description of the board. Description string `json:"description,omitempty"` // The number of columns to be laid out when displaying the board. // Defaults to "multi". // // n.b. 'list' style boards cannot specify a column layout ColumnLayout BoardColumnStyle `json:"column_layout,omitempty"` // How the board should be displayed in the UI, defaults to "visual". // Deprecated: All Boards are visual now. This field is ignored. Style BoardStyle `json:"style,omitempty"` // Links returned by the board API for the Board Links BoardLinks `json:"links,omitempty"` // A list of queries displayed on the board, in order of appearance. Queries []BoardQuery `json:"queries"` }
Board represents a Honeycomb board.
API docs: https://docs.honeycomb.io/api/boards-api/#fields-on-a-board
type BoardColumnStyle ¶ added in v0.10.0
type BoardColumnStyle string
const ( BoardColumnStyleMulti BoardColumnStyle = "multi" BoardColumnStyleSingle BoardColumnStyle = "single" )
type BoardGraphSettings ¶ added in v0.10.0
type BoardGraphSettings struct { OmitMissingValues bool `json:"omit_missing_values"` UseStackedGraphs bool `json:"stacked_graphs"` UseLogScale bool `json:"log_scale"` UseUTCXAxis bool `json:"utc_xaxis"` HideMarkers bool `json:"hide_markers"` PreferOverlaidCharts bool `json:"overlaid_charts"` }
BoardGraphSettings represents the display settings for an individual graph in a board.
type BoardLinks ¶ added in v0.12.0
type BoardLinks struct { // URL For accessing the board BoardURL string `json:"board_url,omitempty"` }
BoardLinks represents links returned by the board API.
type BoardQuery ¶
type BoardQuery struct { Caption string `json:"caption,omitempty"` // Defaults to graph. QueryStyle BoardQueryStyle `json:"query_style,omitempty"` // Dataset is no longer required Dataset string `json:"dataset,omitempty"` // QueryID is required QueryID string `json:"query_id,omitempty"` // Optional QueryAnnotationID string `json:"query_annotation_id,omitempty"` // Optional GraphSettings BoardGraphSettings `json:"graph_settings"` }
BoardQuery represents a query that is part of a board.
type BoardQueryStyle ¶
type BoardQueryStyle string
BoardQueryStyle determines how a query should be displayed on the board.
const ( BoardQueryStyleGraph BoardQueryStyle = "graph" BoardQueryStyleTable BoardQueryStyle = "table" BoardQueryStyleCombo BoardQueryStyle = "combo" )
Declaration of board query styles.
func BoardQueryStyles ¶
func BoardQueryStyles() []BoardQueryStyle
BoardQueryStyles returns an exhaustive list of board query styles.
type BoardStyle ¶
type BoardStyle string
BoardStyle determines how a Board should be displayed within the Honeycomb UI.
const ( BoardStyleList BoardStyle = "list" BoardStyleVisual BoardStyle = "visual" )
Declaration of board styles.
func BoardStyles ¶
func BoardStyles() []BoardStyle
BoardStyles returns an exhaustive list of board styles.
type Boards ¶
type Boards interface { // List all boards. List(ctx context.Context) ([]Board, error) // Get a board by its ID. Get(ctx context.Context, id string) (*Board, error) // Create a new board. When creating a new board ID may not be set. Create(ctx context.Context, b *Board) (*Board, error) // Update an existing board. Update(ctx context.Context, b *Board) (*Board, error) // Delete a board. Delete(ctx context.Context, id string) error }
Boards describes all the board-related methods that the Honeycomb API supports.
type BurnAlert ¶ added in v0.7.0
type BurnAlert struct { ID string `json:"id,omitempty"` AlertType BurnAlertAlertType `json:"alert_type"` ExhaustionMinutes *int `json:"exhaustion_minutes,omitempty"` BudgetRateWindowMinutes *int `json:"budget_rate_window_minutes,omitempty"` BudgetRateDecreaseThresholdPerMillion *int `json:"budget_rate_decrease_threshold_per_million,omitempty"` SLO SLORef `json:"slo"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` Recipients []NotificationRecipient `json:"recipients,omitempty"` }
type BurnAlertAlertType ¶ added in v0.20.0
type BurnAlertAlertType string
BurnAlertAlertType represents a burn alert alert type
const ( BurnAlertAlertTypeExhaustionTime BurnAlertAlertType = "exhaustion_time" BurnAlertAlertTypeBudgetRate BurnAlertAlertType = "budget_rate" )
func BurnAlertAlertTypes ¶ added in v0.20.0
func BurnAlertAlertTypes() []BurnAlertAlertType
BurnAlertAlertTypes returns a list of valid burn alert alert types
type BurnAlerts ¶ added in v0.7.0
type BurnAlerts interface { // List all BurnAlerts associated with a SLO. ListForSLO(ctx context.Context, dataset string, sloId string) ([]BurnAlert, error) // Get a BurnAlert by its ID. Get(ctx context.Context, dataset string, id string) (*BurnAlert, error) // Create a new BurnAlert on a SLO. When creating a BurnAlert ID may not // be set. Create(ctx context.Context, dataset string, s *BurnAlert) (*BurnAlert, error) // Update an existing BurnAlert. Update(ctx context.Context, dataset string, s *BurnAlert) (*BurnAlert, error) // Delete a BurnAlert from a dataset. Delete(ctx context.Context, dataset string, id string) error }
BurnAlerts describe all the BurnAlert-related methods that the Honeycomb API supports.
type CalculationOp ¶
type CalculationOp string
CalculationOp represents the operator of a calculation.
const ( CalculationOpCount CalculationOp = "COUNT" CalculationOpConcurrency CalculationOp = "CONCURRENCY" CalculationOpSum CalculationOp = "SUM" CalculationOpAvg CalculationOp = "AVG" CalculationOpCountDistinct CalculationOp = "COUNT_DISTINCT" CalculationOpMax CalculationOp = "MAX" CalculationOpMin CalculationOp = "MIN" CalculationOpP001 CalculationOp = "P001" CalculationOpP01 CalculationOp = "P01" CalculationOpP05 CalculationOp = "P05" CalculationOpP10 CalculationOp = "P10" CalculationOpP25 CalculationOp = "P25" CalculationOpP50 CalculationOp = "P50" CalculationOpP75 CalculationOp = "P75" CalculationOpP90 CalculationOp = "P90" CalculationOpP95 CalculationOp = "P95" CalculationOpP99 CalculationOp = "P99" CalculationOpP999 CalculationOp = "P999" CalculationOpHeatmap CalculationOp = "HEATMAP" CalculationOpRateAvg CalculationOp = "RATE_AVG" CalculationOpRateSum CalculationOp = "RATE_SUM" CalculationOpRateMax CalculationOp = "RATE_MAX" )
func CalculationOps ¶
func CalculationOps() []CalculationOp
CalculationOps returns an exhaustive list of Calculation Operators.
func HavingCalculationOps ¶ added in v0.19.0
func HavingCalculationOps() []CalculationOp
HavingCalculationOps returns an exhaustive list of calculation operators supported by Havings. Havings does not support Heatmap.
func (CalculationOp) IsUnaryOp ¶ added in v0.3.0
func (c CalculationOp) IsUnaryOp() bool
type CalculationSpec ¶
type CalculationSpec struct { Op CalculationOp `json:"op"` // Column to perform the operation on. Not needed with COUNT or CONCURRENCY Column *string `json:"column,omitempty"` }
CalculationSpec represents a calculation within a query.
type Client ¶
type Client struct { Auth Auth Boards Boards Columns Columns Datasets Datasets DatasetDefinitions DatasetDefinitions DerivedColumns DerivedColumns Markers Markers MarkerSettings MarkerSettings Queries Queries QueryAnnotations QueryAnnotations QueryResults QueryResults Triggers Triggers SLOs SLOs BurnAlerts BurnAlerts Recipients Recipients // contains filtered or unexported fields }
Client to interact with Honeycomb.
func NewClientWithConfig ¶ added in v0.21.0
NewClientWithConfig creates a new Honeycomb API client using the provided Config.
func (*Client) Do ¶ added in v0.21.0
func (c *Client) Do(ctx context.Context, method, path string, requestBody, responseBody interface{}) error
Do makes a request to the configured Honeycomb API endpoint and, if requestBody is not nil, sends along the JSON.
The response is parsed in responseBody, if responseBody is not nil.
Attempts to return a DetailedError if the response status code is not 2xx, but can return a generic error.
func (*Client) EndpointURL ¶ added in v0.21.0
EndpointURL returns the Client's configured API endpoint URL
type Column ¶
type Column struct { ID string `json:"id,omitempty"` // Name of the column, this field is required. KeyName string `json:"key_name"` // Deprecated, optional. Alias string `json:"alias,omitempty"` // Optional, defaults to false. Hidden *bool `json:"hidden,omitempty"` // Optional. Description string `json:"description,omitempty"` // Optional, defaults to string. Type *ColumnType `json:"type,omitempty"` // Read only LastWrittenAt time.Time `json:"last_written,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
Column represents a Honeycomb column in a dataset.
API docs: https://docs.honeycomb.io/api/columns/#fields-on-a-column
type ColumnType ¶
type ColumnType string
ColumnType determines the type of column.
const ( ColumnTypeString ColumnType = "string" ColumnTypeFloat ColumnType = "float" ColumnTypeInteger ColumnType = "integer" ColumnTypeBoolean ColumnType = "boolean" )
Declaration of column types.
func ColumnTypes ¶
func ColumnTypes() []ColumnType
ColumnTypes returns an exhaustive list of column types.
type Columns ¶
type Columns interface { // List all columns in this dataset. List(ctx context.Context, dataset string) ([]Column, error) // Get a column by its ID. Get(ctx context.Context, dataset string, id string) (*Column, error) // GetByKeyName searches a column by its key name. GetByKeyName(ctx context.Context, dataset string, keyName string) (*Column, error) // Create a new column in this dataset. When creating a new column ID may // not be set. The KeyName must be unique for this dataset. Create(ctx context.Context, dataset string, c *Column) (*Column, error) // Update an existing column. Update(ctx context.Context, dataset string, c *Column) (*Column, error) // Delete a column. Delete(ctx context.Context, dataset string, id string) error }
Columns describe all the columns-related methods that the Honeycomb API supports.
API docs: https://docs.honeycomb.io/api/columns/
type Config ¶
type Config struct { // Required - the API key to use when sending request to Honeycomb. APIKey string // URL of the Honeycomb API, defaults to "https://api.honeycomb.io". APIUrl string // With debug enabled the client will log all requests and responses. Debug bool // Optionally override the HTTP client with a custom client. HTTPClient *http.Client // Optionally set the user agent to send with all requests, defaults to "go-honeycombio". UserAgent string }
Config holds all configuration options for the client.
func DefaultConfig ¶ added in v0.18.0
func DefaultConfig() *Config
DefaultConfig returns a Config initilized with default values.
type Dataset ¶
type Dataset struct { Name string `json:"name"` Description string `json:"description,omitempty"` Slug string `json:"slug,omitempty"` ExpandJSONDepth int `json:"expand_json_depth,omitempty"` // Read only LastWrittenAt time.Time `json:"last_written_at,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` }
Dataset represents a Honeycomb dataset.
API docs: https://docs.honeycomb.io/api/dataset
type DatasetDefinition ¶ added in v0.12.0
type DatasetDefinition struct { DurationMs *DefinitionColumn `json:"duration_ms,omitempty"` Error *DefinitionColumn `json:"error,omitempty"` Name *DefinitionColumn `json:"name,omitempty"` ParentID *DefinitionColumn `json:"parent_id,omitempty"` Route *DefinitionColumn `json:"route,omitempty"` ServiceName *DefinitionColumn `json:"service_name,omitempty"` SpanID *DefinitionColumn `json:"span_id,omitempty"` SpanKind *DefinitionColumn `json:"span_kind,omitempty"` AnnotationType *DefinitionColumn `json:"annotation_type,omitempty"` LinkTraceID *DefinitionColumn `json:"link_trace_id,omitempty"` LinkSpanID *DefinitionColumn `json:"link_span_id,omitempty"` Status *DefinitionColumn `json:"status,omitempty"` TraceID *DefinitionColumn `json:"trace_id,omitempty"` User *DefinitionColumn `json:"user,omitempty"` }
DatasetDefinition represents a Honeycomb dataset metadata. API docs: https://docs.honeycomb.io/api/dataset-definitions/
type DatasetDefinitions ¶ added in v0.12.0
type DatasetDefinitions interface { // Get the Dataset Definitions for a Dataset Get(ctx context.Context, dataset string) (*DatasetDefinition, error) // Resets the Dataset Definitions for a Dataset to the default state ResetAll(ctx context.Context, dataset string) error // Update the Dataset Definitions in a Dataset Update(ctx context.Context, dataset string, d *DatasetDefinition) (*DatasetDefinition, error) }
Dataset Definitions define the fields in your Dataset that have special meaning.
API docs: https://docs.honeycomb.io/api/dataset-definitions/
type Datasets ¶
type Datasets interface { // List all datasets. List(ctx context.Context) ([]Dataset, error) // Get a dataset by its slug. Get(ctx context.Context, slug string) (*Dataset, error) // Create a new dataset. Only name should be set when creating a dataset, // all other fields are ignored. Create(ctx context.Context, dataset *Dataset) (*Dataset, error) // Update an existing dataset. Missing (optional) fields will set to their // respective defaults and not the currently existing values. Update(ctx context.Context, dataset *Dataset) (*Dataset, error) }
Datasets describes all the dataset-related methods that the Honeycomb API supports.
API docs: https://docs.honeycomb.io/api/datasets/
type DefinitionColumn ¶ added in v0.12.0
type DefinitionColumn struct { Name string `json:"name"` ColumnType string `json:"column_type,omitempty"` }
DatasetDefinition represents a Honeycomb dataset metadata.
func EmptyDatasetDefinition ¶ added in v0.12.0
func EmptyDatasetDefinition() *DefinitionColumn
Resetting or Unsetting a Dataset Definition is done by setting the Name to the empty string.
type DerivedColumn ¶
type DerivedColumn struct { ID string `json:"id,omitempty"` // Alias of the derived column, this field is required and can not be // updated. Alias string `json:"alias"` // Expression of the derived column, this field is required. // This should be an expression following the Derived Column syntax, as // described on https://docs.honeycomb.io/working-with-your-data/customizing-your-query/derived-columns/#derived-column-syntax Expression string `json:"expression"` // Optional. Description string `json:"description,omitempty"` }
Column represents a Honeycomb derived column in a dataset.
API docs: https://docs.honeycomb.io/api/derived_columns/#fields-on-a-derivedcolumn
type DerivedColumns ¶
type DerivedColumns interface { // List all derived columns in this dataset. List(ctx context.Context, dataset string) ([]DerivedColumn, error) // Get a derived column by its ID. Get(ctx context.Context, dataset string, id string) (*DerivedColumn, error) // GetByAlias searches a derived column by its alias. GetByAlias(ctx context.Context, dataset string, alias string) (*DerivedColumn, error) // Create a new derived column in this dataset. When creating a new derived // column ID may not be set. The Alias must be unique for this dataset. Create(ctx context.Context, dataset string, d *DerivedColumn) (*DerivedColumn, error) // Update an existing derived column. Update(ctx context.Context, dataset string, d *DerivedColumn) (*DerivedColumn, error) // Delete a derived column. Delete(ctx context.Context, dataset string, id string) error }
DerivedColumns describe all the derived columns-related methods that the Honeycomb API supports.
type DetailedError ¶ added in v0.18.0
type DetailedError struct { // The HTTP status code of the error. Status int `json:"status,omitempty"` // The error message Message string `json:"error,omitempty"` // Type is a URI used to uniquely identify the type of error. Type string `json:"type,omitempty"` // Title is a human-readable summary that explains the type of the problem. Title string `json:"title,omitempty"` // Details is an array of structured objects that give details about the error. Details []ErrorTypeDetail `json:"type_detail,omitempty"` }
DetailedError is an RFC7807 'Problem Detail' formatted error message.
func (DetailedError) Error ¶ added in v0.18.0
func (e DetailedError) Error() string
Error returns a pretty-printed representation of the error
func (*DetailedError) IsNotFound ¶ added in v0.18.0
func (e *DetailedError) IsNotFound() bool
IsNotFound returns true if the error is an HTTP 404
type ErrorTypeDetail ¶ added in v0.20.0
type ErrorTypeDetail struct { Code string `json:"code"` Description string `json:"description"` Field string `json:"field"` }
func (ErrorTypeDetail) String ¶ added in v0.20.0
func (td ErrorTypeDetail) String() string
type FilterCombination ¶
type FilterCombination string
FilterCombination describes how the filters of a query should be combined.
const ( FilterCombinationOr FilterCombination = "OR" FilterCombinationAnd FilterCombination = "AND" DefaultFilterCombination = FilterCombinationAnd )
Declaration of filter combinations.
func FilterCombinations ¶
func FilterCombinations() []FilterCombination
FilterCombinations returns an exhaustive list of filter combinations.
type FilterOp ¶
type FilterOp string
FilterOp represents the operator of a filter.
const ( FilterOpEquals FilterOp = "=" FilterOpNotEquals FilterOp = "!=" FilterOpGreaterThan FilterOp = ">" FilterOpGreaterThanOrEqual FilterOp = ">=" FilterOpSmallerThan FilterOp = "<" FilterOpSmallerThanOrEqual FilterOp = "<=" FilterOpStartsWith FilterOp = "starts-with" FilterOpDoesNotStartWith FilterOp = "does-not-start-with" FilterOpExists FilterOp = "exists" FilterOpDoesNotExist FilterOp = "does-not-exist" FilterOpContains FilterOp = "contains" FilterOpDoesNotContain FilterOp = "does-not-contain" FilterOpIn FilterOp = "in" FilterOpNotIn FilterOp = "not-in" )
Declaration of filter operators.
type FilterSpec ¶
type FilterSpec struct { Column string `json:"column"` Op FilterOp `json:"op"` // Value to use with the filter operation. The type of the filter value // depends on the operator: // - 'exists' and 'does-not-exist': value should be nil // - 'in' and 'not-in': value should be a []string // - all other ops: value could be a string, int, bool or float Value interface{} `json:"value,omitempty"` }
FilterSpec represents a filter within a query.
type HavingOp ¶ added in v0.3.0
type HavingOp string
HavingOp represents the operator of a having clause
type HavingSpec ¶ added in v0.3.0
type HavingSpec struct { CalculateOp *CalculationOp `json:"calculate_op,omitempty"` Column *string `json:"column,omitempty"` Op *HavingOp `json:"op,omitempty"` Value interface{} `json:"value,omitempty"` }
HavingSpec describes filters in which to restrict returned groups.
type Marker ¶
type Marker struct { ID string `json:"id,omitempty"` // The time the marker should be placed at, in Unix Time (= seconds since // epoch). If not set this will be set to when the request was received by // the API. StartTime int64 `json:"start_time,omitempty"` // The end time of the marker, in Unix Time (= seconds since epoch). This // can be used to indicate a time range. This field is optional. EndTime int64 `json:"end_time,omitempty"` // Message appears above the marker and can be used to desribe the marker. // This field is optional. Message string `json:"message,omitempty"` // Type is an optional marker identifier, eg 'deploy' or 'chef-run'. This // field is optional. Type string `json:"type,omitempty"` // URL is an optional url associated with the marker. This field is optional. URL string `json:"url,omitempty"` // Time the marker was created. This field is set by the API. CreatedAt *time.Time `json:"created_at,omitempty"` // Time the marker was last modified. This field is set by the API. UpdatedAt *time.Time `json:"updated_at,omitempty"` // Color of the marker. Colors are configured per dataset and can be set // per type of marker. This field is set by the API. Color string `json:"color,omitempty"` }
Marker represents a Honeycomb marker.
API docs: https://docs.honeycomb.io/api/markers/#fields-on-a-marker
type MarkerSetting ¶ added in v0.11.0
type MarkerSetting struct { // Unique identifier of a marker setting. This field is set by the API. ID string `json:"id,omitempty"` // Type is a required marker setting identifier, eg 'deploy'. Type string `json:"type,omitempty"` // Color of the marker setting. Colors are configured per dataset and can be set per type of marker. Color string `json:"color,omitempty"` // Time the marker setting was created. This field is set by the API. CreatedAt *time.Time `json:"created_at,omitempty"` // Time the marker setting was last modified. This field is set by the API. UpdatedAt *time.Time `json:"updated_at,omitempty"` }
MarkerSettings represents settings on a Honeycomb marker.
type MarkerSettings ¶ added in v0.11.0
type MarkerSettings interface { // List all marker settings present in this dataset. List(ctx context.Context, dataset string) ([]MarkerSetting, error) // Get a marker setting by its ID. // // This method calls List internally since there is no API available to // directly get a single marker setting. Get(ctx context.Context, dataset string, id string) (*MarkerSetting, error) // Create a new marker setting in this dataset. Create(ctx context.Context, dataset string, m *MarkerSetting) (*MarkerSetting, error) // Update an existing marker setting. Update(ctx context.Context, dataset string, m *MarkerSetting) (*MarkerSetting, error) // Delete a marker setting from the dataset. Delete(ctx context.Context, dataset string, id string) error }
MarkerSettings describes all the markerType-related methods that the Honeycomb API supports.
type Markers ¶
type Markers interface { // List all markers present in this dataset. List(ctx context.Context, dataset string) ([]Marker, error) // Get a marker by its ID. // // This method calls List internally since there is no API available to // directly get a single marker. Get(ctx context.Context, dataset string, id string) (*Marker, error) // Create a new marker in this dataset. When creating a marker ID may not // be set. Create(ctx context.Context, dataset string, m *Marker) (*Marker, error) // Update an existing marker. Update(ctx context.Context, dataset string, m *Marker) (*Marker, error) // Delete a marker from the dataset. Delete(ctx context.Context, dataset string, id string) error }
Markers describes all the marker-related methods that the Honeycomb API supports.
API docs: https://docs.honeycomb.io/api/markers/
type NotificationRecipient ¶ added in v0.8.0
type NotificationRecipient struct { ID string `json:"id,omitempty"` Type RecipientType `json:"type"` Details *NotificationRecipientDetails `json:"details,omitempty"` Target string `json:"target,omitempty"` }
NotificationRecipient represents a recipient embedded in a Trigger or Burn Alert
type NotificationRecipientDetails ¶ added in v0.8.0
type NotificationRecipientDetails struct {
PDSeverity PagerDutySeverity `json:"pagerduty_severity,omitempty"`
}
type OrderSpec ¶
type OrderSpec struct { Op *CalculationOp `json:"op,omitempty"` Column *string `json:"column,omitempty"` Order *SortOrder `json:"order,omitempty"` }
OrderSpec describes how to order the results of a query.
type PagerDutySeverity ¶ added in v0.8.0
type PagerDutySeverity string
PagerDutySeverity holds all the possible PD Severity types
const ( PDSeverityCRITICAL PagerDutySeverity = "critical" PDSeverityERROR PagerDutySeverity = "error" PDSeverityWARNING PagerDutySeverity = "warning" PDSeverityINFO PagerDutySeverity = "info" PDDefaultSeverity = PDSeverityCRITICAL )
type Queries ¶
type Queries interface { // Get a query by its ID. Get(ctx context.Context, dataset string, id string) (*QuerySpec, error) // Create a new query in this dataset. When creating a new query ID may // not be set. Create(ctx context.Context, dataset string, c *QuerySpec) (*QuerySpec, error) }
Queries describe all the query-related methods that the Honeycomb API supports.
API docs: https://docs.honeycomb.io/api/queries/
type QueryAnnotation ¶
type QueryAnnotation struct { ID string `json:"id,omitempty"` Name string `json:"name"` Description string `json:"description"` QueryID string `json:"query_id"` CreatedAt *time.Time `json:"created-at,omitempty"` UpdatedAt *time.Time `json:"updated-at,omitempty"` }
QueryAnnotation represents a Honeycomb query annotation.
API docs: https://docs.honeycomb.io/api/query-annotations/#fields-on-a-query-annotation
type QueryAnnotations ¶
type QueryAnnotations interface { // List all query annotations. List(ctx context.Context, dataset string) ([]QueryAnnotation, error) // Get a query annotation by its ID. Get(ctx context.Context, dataset string, id string) (*QueryAnnotation, error) // Create a new query annotation. When creating a new query annotation ID // may not be set. Create(ctx context.Context, dataset string, b *QueryAnnotation) (*QueryAnnotation, error) // Update an existing query annotation. Update(ctx context.Context, dataset string, b *QueryAnnotation) (*QueryAnnotation, error) // Delete a query annotation. Delete(ctx context.Context, dataset string, id string) error }
QueryAnnotations describes all the query annotation-related methods that the Honeycomb API supports.
type QueryResult ¶ added in v0.6.0
type QueryResult struct { // ID of a query result is only set when the query is returned from the // Query Result API. This value should not be set when creating queries results. ID string `json:"id"` // True once the query has completed and the results are populated. Complete bool `json:"complete"` // The resulting data of the query Data QueryResultData `json:"data,omitempty"` // Permalinks to the query results Links QueryResultLinks `json:"links,omitempty"` }
QueryResult represents a Honeycomb query result.
API docs: https://docs.honeycomb.io/api/query-results/#get-example-response
type QueryResultData ¶ added in v0.6.0
type QueryResultLinks ¶ added in v0.6.0
type QueryResultRequest ¶ added in v0.6.0
type QueryResultRequest struct {
ID string `json:"query_id"`
}
type QueryResults ¶ added in v0.6.0
type QueryResults interface { // Get the query results by ID. Get(ctx context.Context, dataset string, q *QueryResult) error // Create a new query result with a given query specification. Create(ctx context.Context, dataset string, data *QueryResultRequest) (*QueryResult, error) }
QueryResults describes all the query result-related methods that the Honeycomb API supports.
type QuerySpec ¶
type QuerySpec struct { // ID of a query is only set when QuerySpec is returned from the Queries // API. This value should not be set when creating or updating queries. ID *string `json:"id,omitempty"` // The calculations to return as a time series and summary table. If no // calculations are provided, COUNT is applied. Calculations []CalculationSpec `json:"calculations,omitempty"` // The filters with which to restrict the considered events. Filters []FilterSpec `json:"filters,omitempty"` // If multiple filters are specified, filter_combination determines how // they are applied. Defaults to AND. // // From experience it seems the API will never answer with AND, instead // always omitting the filter combination field entirely. FilterCombination FilterCombination `json:"filter_combination,omitempty"` // A list of strings describing the columns by which to break events down // into groups. Breakdowns []string `json:"breakdowns,omitempty"` // A list of objects describing the terms on which to order the query // results. Each term must appear in either the breakdowns field or the // calculations field. Orders []OrderSpec `json:"orders,omitempty"` // A list of objects describing filters with which to restrict returned // groups. Each column/calculate_op pair must appear in the calculations // field. There can be multiple havings for the same column/calculate_op // pair. Havings []HavingSpec `json:"havings,omitempty"` // The maximum number of query results, must be between 1 and 1000. Limit *int `json:"limit,omitempty"` // The time range of query in seconds. Defaults to two hours. If combined // with start time or end time, this time range is added after start time // or before end time. Cannot be combined with both start time and end time. // // For more details, check https://docs.honeycomb.io/api/query-specification/#a-caveat-on-time TimeRange *int `json:"time_range,omitempty"` // The absolute start time of the query, in Unix Time (= seconds since epoch). StartTime *int64 `json:"start_time,omitempty"` // The absolute end time of the query, in Unix Time (= seconds since epoch). EndTime *int64 `json:"end_time,omitempty"` // The time resolution of the query’s graph, in seconds. Valid values are // the query’s time range /10 at maximum, and /1000 at minimum. Granularity *int `json:"granularity,omitempty"` }
QuerySpec represents a Honeycomb query.
API docs: https://docs.honeycomb.io/api/query-specification/
func (*QuerySpec) Encode ¶ added in v0.23.0
Encode returns the JSON string representation of the QuerySpec.
func (*QuerySpec) EquivalentTo ¶ added in v0.11.2
Determines if two QuerySpecs are equivalent
type Recipient ¶ added in v0.7.0
type Recipient struct { ID string `json:"id,omitempty"` Type RecipientType `json:"type"` Details RecipientDetails `json:"details"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
Recipient represents a Honeycomb Recipient
type RecipientDetails ¶ added in v0.8.0
type RecipientDetails struct { // email EmailAddress string `json:"email_address,omitempty"` // marker MarkerID string `json:"marker_id,omitempty"` // pagerduty PDIntegrationKey string `json:"pagerduty_integration_key,omitempty"` PDIntegrationName string `json:"pagerduty_integration_name,omitempty"` // slack SlackChannel string `json:"slack_channel,omitempty"` // webhook or msteams WebhookName string `json:"webhook_name,omitempty"` WebhookURL string `json:"webhook_url,omitempty"` // webhook only WebhookSecret string `json:"webhook_secret,omitempty"` }
type RecipientType ¶ added in v0.7.0
type RecipientType string
RecipientType holds all the possible recipient types.
const ( RecipientTypeEmail RecipientType = "email" RecipientTypePagerDuty RecipientType = "pagerduty" RecipientTypeSlack RecipientType = "slack" RecipientTypeWebhook RecipientType = "webhook" RecipientTypeMarker RecipientType = "marker" RecipientTypeMSTeams RecipientType = "msteams" )
Declaration of recipient types
func RecipientTypes ¶ added in v0.19.0
func RecipientTypes() []RecipientType
RecipientTypes returns all supported Recipient types
func TriggerRecipientTypes ¶
func TriggerRecipientTypes() []RecipientType
TriggerRecipientTypes returns a list of recipient types compatible with Triggers. Triggers are a special case as 'Marker' recipients are supported in addition to usual types.
type Recipients ¶ added in v0.8.0
type Recipients interface { // List all Recipients List(ctx context.Context) ([]Recipient, error) // Get a Recipient by its ID. Get(ctx context.Context, id string) (*Recipient, error) // Create a new Recipient. When creating a new Recipient ID must not be set. Create(ctx context.Context, r *Recipient) (*Recipient, error) // Update an existing Recipient. Update(ctx context.Context, r *Recipient) (*Recipient, error) // Delete a Recipient Delete(ctx context.Context, id string) error }
Recipients describe all the Recipient-related methods that the Honeycomb API supports.
type SLO ¶ added in v0.7.0
type SLO struct { ID string `json:"id,omitempty"` Name string `json:"name"` Description string `json:"description,omitempty"` TimePeriodDays int `json:"time_period_days"` TargetPerMillion int `json:"target_per_million"` SLI SLIRef `json:"sli"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
type SLOs ¶ added in v0.7.0
type SLOs interface { // List all SLOs present in this dataset. List(ctx context.Context, dataset string) ([]SLO, error) // Get a SLO by its ID. Get(ctx context.Context, dataset string, id string) (*SLO, error) // Create a new SLO in this dataset. When creating a SLO ID may not // be set. Create(ctx context.Context, dataset string, s *SLO) (*SLO, error) // Update an existing SLO. Update(ctx context.Context, dataset string, s *SLO) (*SLO, error) // Delete a SLO from the dataset. Delete(ctx context.Context, dataset string, id string) error }
SLOs describe all the SLO-related methods that the Honeycomb API supports.
API docs: https://docs.honeycomb.io/api/slos/
type SortOrder ¶
type SortOrder string
SortOrder describes in which order the results should be sorted.
Declaration of sort orders.
func SortOrders ¶
func SortOrders() []SortOrder
SortOrders returns an exhaustive list of all sort orders.
type Trigger ¶
type Trigger struct { ID string `json:"id,omitempty"` // Name of the trigger. This field is required. Name string `json:"name"` // Description is displayed on the triggers page. Description string `json:"description,omitempty"` // State of the trigger, if disabled is true the trigger will not run. Disabled bool `json:"disabled"` // Query of the trigger. This field is required. The query must respect the // properties described with and validated by MatchesTriggerSubset. // Additionally, time_range of the query can be at most 1 day and may not // be greater than 4 times the frequency. Query *QuerySpec `json:"query,omitempty"` QueryID string `json:"query_id,omitempty"` // Alert Type. Describes scheduling behavior for triggers. // Defaults to "on_change" AlertType TriggerAlertType `json:"alert_type,omitempty"` // Threshold. This fild is required. Threshold *TriggerThreshold `json:"threshold"` // Evaluation Schedule used by the trigger. // Defaults to "frequency", where the trigger runs at the specified frequency. // The "window" type means that the trigger will run at the specified frequency, // but only in the time window specified by the evaluation schedule. EvaluationScheduleType TriggerEvaluationScheduleType `json:"evaluation_schedule_type,omitempty"` EvaluationSchedule *TriggerEvaluationSchedule `json:"evaluation_schedule,omitempty"` // Frequency describes how often the trigger should run. Frequency is an // interval in seconds, defaulting to 900 (15 minutes). Its value must be // divisible by 60 and between 60 and 86400 (between 1 minute and 1 day). Frequency int `json:"frequency,omitempty"` // Recipients are notified when the trigger fires. Recipients []NotificationRecipient `json:"recipients,omitempty"` }
Trigger represents a Honeycomb trigger.
API docs: https://docs.honeycomb.io/api/triggers/#fields-on-a-trigger
func (*Trigger) MarshalJSON ¶
type TriggerAlertType ¶ added in v0.15.0
type TriggerAlertType string
TriggerAlertType determines the alert type of a trigger. Valid values are 'on_change' or 'on_true'
type TriggerEvaluationSchedule ¶ added in v0.15.0
type TriggerEvaluationSchedule struct {
Window TriggerEvaluationWindow `json:"window"`
}
type TriggerEvaluationScheduleType ¶ added in v0.15.0
type TriggerEvaluationScheduleType string
TriggerEvaluationScheduleType determines the evaluation schedule type of a trigger. Valid values are 'frequency' or 'window'
type TriggerEvaluationWindow ¶ added in v0.15.0
type TriggerEvaluationWindow struct { // A slice of the days of the week to evaluate the trigger on. (e.g. ["monday", "tuesday", "wednesday"]) DaysOfWeek []string `json:"days_of_week"` // UTC time in HH:mm format (e.g. 13:00) StartTime string `json:"start_time"` // UTC time in HH:mm format (e.g. 13:00) EndTime string `json:"end_time"` }
type TriggerThreshold ¶
type TriggerThreshold struct { Op TriggerThresholdOp `json:"op"` Value float64 `json:"value"` ExceededLimit int `json:"exceeded_limit,omitempty"` }
TriggerThreshold represents the threshold of a trigger.
type TriggerThresholdOp ¶
type TriggerThresholdOp string
TriggerThresholdOp the operator of the trigger threshold.
func TriggerThresholdOps ¶
func TriggerThresholdOps() []TriggerThresholdOp
TriggerThresholdOps returns an exhaustive list of trigger threshold ops.
type Triggers ¶
type Triggers interface { // List all triggers present in this dataset. List(ctx context.Context, dataset string) ([]Trigger, error) // Get a trigger by its ID. Get(ctx context.Context, dataset string, id string) (*Trigger, error) // Create a new trigger in this dataset. When creating a new trigger ID // may not be set. Create(ctx context.Context, dataset string, t *Trigger) (*Trigger, error) // Update an existing trigger. Missing (optional) fields will set to their // respective defaults and not the currently existing values. Except for // the disabled flag, which will retain its existing value when omitted. Update(ctx context.Context, dataset string, t *Trigger) (*Trigger, error) // Delete a trigger from the dataset. Delete(ctx context.Context, dataset string, id string) error }
Triggers describes all the trigger-related methods that the Honeycomb API supports.
API docs: https://docs.honeycomb.io/api/triggers/