billing

package
v0.15.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Enrich added in v0.12.0

func Enrich[E Event](hostname string, event E) E

Enrich sets the event's Type and IdempotencyKey fields, so that users of this API don't need to manually set them

func Send added in v0.12.0

func Send[E Event](ctx context.Context, client Client, traceID TraceID, events []E) error

Send attempts to push the events to the remote endpoint.

On failure, the error is guaranteed to be one of: JSONError, RequestError, or UnexpectedStatusCodeError.

Types

type AbsoluteEvent

type AbsoluteEvent struct {
	IdempotencyKey string    `json:"idempotency_key"`
	MetricName     string    `json:"metric"`
	Type           string    `json:"type"`
	TenantID       string    `json:"tenant_id"`
	TimelineID     string    `json:"timeline_id"`
	Time           time.Time `json:"time"`
	Value          int       `json:"value"`
}

type Client

type Client struct {
	BaseURL string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(url string, c *http.Client) Client

func (Client) GenerateTraceID added in v0.12.0

func (c Client) GenerateTraceID() TraceID

func (Client) Hostname added in v0.12.0

func (c Client) Hostname() string

type Event added in v0.12.0

type Event interface {
	*AbsoluteEvent | *IncrementalEvent
	// contains filtered or unexported methods
}

type IncrementalEvent

type IncrementalEvent struct {
	IdempotencyKey string    `json:"idempotency_key"`
	MetricName     string    `json:"metric"`
	Type           string    `json:"type"`
	EndpointID     string    `json:"endpoint_id"`
	StartTime      time.Time `json:"start_time"`
	StopTime       time.Time `json:"stop_time"`
	Value          int       `json:"value"`
}

type TraceID added in v0.12.0

type TraceID string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL