package monitoring

import "cloud.google.com/go/monitoring/apiv3"

Package monitoring is an experimental, auto-generated package for the monitoring API.

Manages your Stackdriver Monitoring data and configurations. Most projects must be associated with a Stackdriver account, with a few exceptions as noted on the individual method pages.

Index

Examples

Functions

func GroupGroupPath

func GroupGroupPath(project, group string) string

GroupGroupPath returns the path for the group resource.

func GroupProjectPath

func GroupProjectPath(project string) string

GroupProjectPath returns the path for the project resource.

func MetricMetricDescriptorPath

func MetricMetricDescriptorPath(project, metricDescriptor string) string

MetricMetricDescriptorPath returns the path for the metric descriptor resource.

func MetricMonitoredResourceDescriptorPath

func MetricMonitoredResourceDescriptorPath(project, monitoredResourceDescriptor string) string

MetricMonitoredResourceDescriptorPath returns the path for the monitored resource descriptor resource.

func MetricProjectPath

func MetricProjectPath(project string) string

MetricProjectPath returns the path for the project resource.

Types

type GroupCallOptions

type GroupCallOptions struct {
	ListGroups       []gax.CallOption
	GetGroup         []gax.CallOption
	CreateGroup      []gax.CallOption
	UpdateGroup      []gax.CallOption
	DeleteGroup      []gax.CallOption
	ListGroupMembers []gax.CallOption
}

GroupCallOptions contains the retry settings for each method of GroupClient.

type GroupClient

type GroupClient struct {

	// The call options for this service.
	CallOptions *GroupCallOptions
	// contains filtered or unexported fields
}

GroupClient is a client for interacting with Stackdriver Monitoring API.

func NewGroupClient

func NewGroupClient(ctx context.Context, opts ...option.ClientOption) (*GroupClient, error)

NewGroupClient creates a new group service client.

The Group API lets you inspect and manage your [groups](google.monitoring.v3.Group).

A group is a named filter that is used to identify a collection of monitored resources. Groups are typically used to mirror the physical and/or logical topology of the environment. Because group membership is computed dynamically, monitored resources that are started in the future are automatically placed in matching groups. By using a group to name monitored resources in, for example, an alert policy, the target of that alert policy is updated automatically as monitored resources are added and removed from the infrastructure.

Example

Code:

{
	ctx := context.Background()
	c, err := monitoring.NewGroupClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use client.
	_ = c
}

func (*GroupClient) Close

func (c *GroupClient) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*GroupClient) Connection

func (c *GroupClient) Connection() *grpc.ClientConn

Connection returns the client's connection to the API service.

func (*GroupClient) CreateGroup

CreateGroup creates a new group.

Example

Code:

{
	ctx := context.Background()
	c, err := monitoring.NewGroupClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.CreateGroupRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.CreateGroup(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*GroupClient) DeleteGroup

func (c *GroupClient) DeleteGroup(ctx context.Context, req *monitoringpb.DeleteGroupRequest) error

DeleteGroup deletes an existing group.

Example

Code:

{
	ctx := context.Background()
	c, err := monitoring.NewGroupClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.DeleteGroupRequest{
		// TODO: Fill request struct fields.
	}
	err = c.DeleteGroup(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}

func (*GroupClient) GetGroup

GetGroup gets a single group.

Example

Code:

{
	ctx := context.Background()
	c, err := monitoring.NewGroupClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.GetGroupRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.GetGroup(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*GroupClient) ListGroupMembers

ListGroupMembers lists the monitored resources that are members of a group.

Example

Code:

{
	ctx := context.Background()
	c, err := monitoring.NewGroupClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.ListGroupMembersRequest{
		// TODO: Fill request struct fields.
	}
	it := c.ListGroupMembers(ctx, req)
	for {
		resp, err := it.Next()
		if err != nil {
			// TODO: Handle error.
			break
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*GroupClient) ListGroups

ListGroups lists the existing groups.

Example

Code:

{
	ctx := context.Background()
	c, err := monitoring.NewGroupClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.ListGroupsRequest{
		// TODO: Fill request struct fields.
	}
	it := c.ListGroups(ctx, req)
	for {
		resp, err := it.Next()
		if err != nil {
			// TODO: Handle error.
			break
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*GroupClient) SetGoogleClientInfo

func (c *GroupClient) SetGoogleClientInfo(name, version string)

SetGoogleClientInfo sets the name and version of the application in the `x-goog-api-client` header passed on each request. Intended for use by Google-written clients.

func (*GroupClient) UpdateGroup

UpdateGroup updates an existing group. You can change any group attributes except `name`.

Example

Code:

{
	ctx := context.Background()
	c, err := monitoring.NewGroupClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.UpdateGroupRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.UpdateGroup(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

type GroupIterator

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

GroupIterator manages a stream of *monitoringpb.Group.

func (*GroupIterator) Next

func (it *GroupIterator) Next() (*monitoringpb.Group, error)

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*GroupIterator) PageInfo

func (it *GroupIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

type MetricCallOptions

type MetricCallOptions struct {
	ListMonitoredResourceDescriptors []gax.CallOption
	GetMonitoredResourceDescriptor   []gax.CallOption
	ListMetricDescriptors            []gax.CallOption
	GetMetricDescriptor              []gax.CallOption
	CreateMetricDescriptor           []gax.CallOption
	DeleteMetricDescriptor           []gax.CallOption
	ListTimeSeries                   []gax.CallOption
	CreateTimeSeries                 []gax.CallOption
}

MetricCallOptions contains the retry settings for each method of MetricClient.

type MetricClient

type MetricClient struct {

	// The call options for this service.
	CallOptions *MetricCallOptions
	// contains filtered or unexported fields
}

MetricClient is a client for interacting with Stackdriver Monitoring API.

func NewMetricClient

func NewMetricClient(ctx context.Context, opts ...option.ClientOption) (*MetricClient, error)

NewMetricClient creates a new metric service client.

Manages metric descriptors, monitored resource descriptors, and time series data.

Example

Code:

{
	ctx := context.Background()
	c, err := monitoring.NewMetricClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use client.
	_ = c
}

func (*MetricClient) Close

func (c *MetricClient) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*MetricClient) Connection

func (c *MetricClient) Connection() *grpc.ClientConn

Connection returns the client's connection to the API service.

func (*MetricClient) CreateMetricDescriptor

CreateMetricDescriptor creates a new metric descriptor. User-created metric descriptors define [custom metrics](/monitoring/custom-metrics).

Example

Code:

{
	ctx := context.Background()
	c, err := monitoring.NewMetricClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.CreateMetricDescriptorRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.CreateMetricDescriptor(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*MetricClient) CreateTimeSeries

func (c *MetricClient) CreateTimeSeries(ctx context.Context, req *monitoringpb.CreateTimeSeriesRequest) error

CreateTimeSeries creates or adds data to one or more time series. The response is empty if all time series in the request were written. If any time series could not be written, a corresponding failure message is included in the error response.

Example

Code:

{
	ctx := context.Background()
	c, err := monitoring.NewMetricClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.CreateTimeSeriesRequest{
		// TODO: Fill request struct fields.
	}
	err = c.CreateTimeSeries(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}

func (*MetricClient) DeleteMetricDescriptor

func (c *MetricClient) DeleteMetricDescriptor(ctx context.Context, req *monitoringpb.DeleteMetricDescriptorRequest) error

DeleteMetricDescriptor deletes a metric descriptor. Only user-created [custom metrics](/monitoring/custom-metrics) can be deleted.

Example

Code:

{
	ctx := context.Background()
	c, err := monitoring.NewMetricClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.DeleteMetricDescriptorRequest{
		// TODO: Fill request struct fields.
	}
	err = c.DeleteMetricDescriptor(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}

func (*MetricClient) GetMetricDescriptor

GetMetricDescriptor gets a single metric descriptor. This method does not require a Stackdriver account.

Example

Code:

{
	ctx := context.Background()
	c, err := monitoring.NewMetricClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.GetMetricDescriptorRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.GetMetricDescriptor(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*MetricClient) GetMonitoredResourceDescriptor

GetMonitoredResourceDescriptor gets a single monitored resource descriptor. This method does not require a Stackdriver account.

Example

Code:

{
	ctx := context.Background()
	c, err := monitoring.NewMetricClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.GetMonitoredResourceDescriptorRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.GetMonitoredResourceDescriptor(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*MetricClient) ListMetricDescriptors

ListMetricDescriptors lists metric descriptors that match a filter. This method does not require a Stackdriver account.

Example

Code:

{
	ctx := context.Background()
	c, err := monitoring.NewMetricClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.ListMetricDescriptorsRequest{
		// TODO: Fill request struct fields.
	}
	it := c.ListMetricDescriptors(ctx, req)
	for {
		resp, err := it.Next()
		if err != nil {
			// TODO: Handle error.
			break
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*MetricClient) ListMonitoredResourceDescriptors

ListMonitoredResourceDescriptors lists monitored resource descriptors that match a filter. This method does not require a Stackdriver account.

Example

Code:

{
	ctx := context.Background()
	c, err := monitoring.NewMetricClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.ListMonitoredResourceDescriptorsRequest{
		// TODO: Fill request struct fields.
	}
	it := c.ListMonitoredResourceDescriptors(ctx, req)
	for {
		resp, err := it.Next()
		if err != nil {
			// TODO: Handle error.
			break
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*MetricClient) ListTimeSeries

ListTimeSeries lists time series that match a filter. This method does not require a Stackdriver account.

Example

Code:

{
	ctx := context.Background()
	c, err := monitoring.NewMetricClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &monitoringpb.ListTimeSeriesRequest{
		// TODO: Fill request struct fields.
	}
	it := c.ListTimeSeries(ctx, req)
	for {
		resp, err := it.Next()
		if err != nil {
			// TODO: Handle error.
			break
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*MetricClient) SetGoogleClientInfo

func (c *MetricClient) SetGoogleClientInfo(name, version string)

SetGoogleClientInfo sets the name and version of the application in the `x-goog-api-client` header passed on each request. Intended for use by Google-written clients.

type MetricDescriptorIterator

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

MetricDescriptorIterator manages a stream of *metricpb.MetricDescriptor.

func (*MetricDescriptorIterator) Next

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*MetricDescriptorIterator) PageInfo

func (it *MetricDescriptorIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

type MonitoredResourceDescriptorIterator

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

MonitoredResourceDescriptorIterator manages a stream of *monitoredrespb.MonitoredResourceDescriptor.

func (*MonitoredResourceDescriptorIterator) Next

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*MonitoredResourceDescriptorIterator) PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

type MonitoredResourceIterator

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

MonitoredResourceIterator manages a stream of *monitoredrespb.MonitoredResource.

func (*MonitoredResourceIterator) Next

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*MonitoredResourceIterator) PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

type TimeSeriesIterator

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

TimeSeriesIterator manages a stream of *monitoringpb.TimeSeries.

func (*TimeSeriesIterator) Next

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*TimeSeriesIterator) PageInfo

func (it *TimeSeriesIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

Source Files

doc.go group_client.go metric_client.go

Version
v0.4.0
Published
Nov 1, 2016
Platform
windows/amd64
Imports
15 packages
Last checked
39 minutes ago

Tools for package owners.