metrics

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Begin

func Begin(ctx context.Context)

func End

func End(ctx context.Context)

func EndWithCause

func EndWithCause(ctx context.Context, cause error)

func New added in v1.2.0

func New(reporter Reporter) services.Service

Types

type Metric

type Metric struct {
	Endpoint  string `json:"endpoint" avro:"endpoint"`
	Fn        string `json:"fn" avro:"fn"`
	Latency   int64  `json:"latency" avro:"latency"`
	Succeed   bool   `json:"succeed" avro:"succeed"`
	ErrorCode int    `json:"errorCode" avro:"errorCode"`
	ErrorName string `json:"errorName" avro:"errorName"`
	DeviceId  string `json:"deviceId" avro:"deviceId"`
	DeviceIp  string `json:"deviceIp" avro:"deviceIp"`
	// contains filtered or unexported fields
}

Metric use @metric to enable in fn

type ReportTask added in v1.3.0

type ReportTask struct {
	// contains filtered or unexported fields
}

func (*ReportTask) Execute added in v1.3.0

func (task *ReportTask) Execute(_ sc.Context)

func (*ReportTask) Name added in v1.3.0

func (task *ReportTask) Name() (name string)

type Reporter

type Reporter interface {
	Construct(options services.Options) (err error)
	Shutdown(ctx context.Context)
	Report(ctx context.Context, metric Metric)
}

type ReporterComponent added in v1.3.0

type ReporterComponent struct {
	// contains filtered or unexported fields
}

func (*ReporterComponent) Construct added in v1.3.0

func (c *ReporterComponent) Construct(options services.Options) (err error)

func (*ReporterComponent) Name added in v1.3.0

func (c *ReporterComponent) Name() (name string)

func (*ReporterComponent) Report added in v1.3.0

func (c *ReporterComponent) Report(ctx context.Context, metric Metric)

func (*ReporterComponent) Shutdown added in v1.3.0

func (c *ReporterComponent) Shutdown(ctx context.Context)

Jump to

Keyboard shortcuts

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