metric

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2019 License: Apache-2.0 Imports: 13 Imported by: 3

README

gcputil/metric

In addition to all the built in metrics, the GPC Stackdriver also supports custom metrics which enable developers to create time series based on application metrics defined by users.

This utility simplifies the entire process related to creating creating and configuring custom metrics to two simple operations.

Import

import "github.com/mchmarny/gcputil/metric"

Usage

To create a metric client and then submit 1 metrics

ctx := context.Background()
c, err := metric.NewClient(ctx)
labels := map[string]string{"label1": value1, "label2": value2}
err := c.Publish(ctx, "temperature", float64(36.1), labels)

View

Chart

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client represents metric client

func MakeClient added in v0.3.1

func MakeClient(ctx context.Context) *Client

MakeClient creates new metrics client or fails

func NewClient

func NewClient(ctx context.Context) (client *Client, err error)

NewClient instantiates client

func (*Client) Publish

func (c *Client) Publish(ctx context.Context, metricType string, metricValue interface{}, labels map[string]string) error

Publish publishes time series based on metric and value to Stackdriver

Jump to

Keyboard shortcuts

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