errorreporting

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: Apache-2.0 Imports: 27 Imported by: 55

Documentation

Overview

Package errorreporting is an auto-generated package for the Error Reporting API.

Groups and counts similar errors from cloud services and applications, reports new errors, and provides access to error groups and their associated errors.

NOTE: This package is in beta. It is not stable, and may be subject to changes.

Example usage

To get started with this package, create a client.

ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := errorreporting.NewErrorGroupClient(ctx)
if err != nil {
	// TODO: Handle error.
}
defer c.Close()

The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.

Using the Client

The following is an example of making an API call with the newly created client.

ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := errorreporting.NewErrorGroupClient(ctx)
if err != nil {
	// TODO: Handle error.
}
defer c.Close()

req := &clouderrorreportingpb.GetGroupRequest{
	// TODO: Fill request struct fields.
	// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1#GetGroupRequest.
}
resp, err := c.GetGroup(ctx, req)
if err != nil {
	// TODO: Handle error.
}
// TODO: Use resp.
_ = resp

Use of Context

The ctx passed to NewErrorGroupClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.

To close the open connection, use the Close() method.

For information about setting deadlines, reusing contexts, and more please visit https://pkg.go.dev/cloud.google.com/go.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultAuthScopes

func DefaultAuthScopes() []string

DefaultAuthScopes reports the default set of authentication scopes to use with this package.

func ErrorStatsProjectPath deprecated

func ErrorStatsProjectPath(project string) string

ErrorStatsProjectPath returns the path for the project resource.

Deprecated: Use

fmt.Sprintf("projects/%s", project)

instead.

func ReportErrorsProjectPath deprecated

func ReportErrorsProjectPath(project string) string

ReportErrorsProjectPath returns the path for the project resource.

Deprecated: Use

fmt.Sprintf("projects/%s", project)

instead.

func ResultPath deprecated

func ResultPath(result string) string

ResultPath returns the path for the result resource.

Deprecated: Use

fmt.Sprintf("inspect/results/%s", result)

instead.

Types

type ErrorEventIterator

type ErrorEventIterator struct {

	// Response is the raw response for the current page.
	// It must be cast to the RPC response type.
	// Calling Next() or InternalFetch() updates this value.
	Response interface{}

	// InternalFetch is for use by the Google Cloud Libraries only.
	// It is not part of the stable interface of this package.
	//
	// InternalFetch returns results from a single call to the underlying RPC.
	// The number of results is no greater than pageSize.
	// If there are no more results, nextPageToken is empty and err is nil.
	InternalFetch func(pageSize int, pageToken string) (results []*clouderrorreportingpb.ErrorEvent, nextPageToken string, err error)
	// contains filtered or unexported fields
}

ErrorEventIterator manages a stream of *clouderrorreportingpb.ErrorEvent.

func (*ErrorEventIterator) 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 (*ErrorEventIterator) PageInfo

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

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

type ErrorGroupCallOptions

type ErrorGroupCallOptions struct {
	GetGroup    []gax.CallOption
	UpdateGroup []gax.CallOption
}

ErrorGroupCallOptions contains the retry settings for each method of ErrorGroupClient.

type ErrorGroupClient

type ErrorGroupClient struct {

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

ErrorGroupClient is a client for interacting with Error Reporting API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Service for retrieving and updating individual error groups.

func NewErrorGroupClient

func NewErrorGroupClient(ctx context.Context, opts ...option.ClientOption) (*ErrorGroupClient, error)

NewErrorGroupClient creates a new error group service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Service for retrieving and updating individual error groups.

Example
package main

import (
	"context"

	errorreporting "cloud.google.com/go/errorreporting/apiv1beta1"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := errorreporting.NewErrorGroupClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}
Output:

func NewErrorGroupRESTClient added in v0.3.0

func NewErrorGroupRESTClient(ctx context.Context, opts ...option.ClientOption) (*ErrorGroupClient, error)

NewErrorGroupRESTClient creates a new error group service rest client.

Service for retrieving and updating individual error groups.

Example
package main

import (
	"context"

	errorreporting "cloud.google.com/go/errorreporting/apiv1beta1"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := errorreporting.NewErrorGroupRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}
Output:

func (*ErrorGroupClient) Close

func (c *ErrorGroupClient) Close() error

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

func (*ErrorGroupClient) Connection deprecated

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

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*ErrorGroupClient) GetGroup

GetGroup get the specified group.

Example
package main

import (
	"context"

	errorreporting "cloud.google.com/go/errorreporting/apiv1beta1"
	clouderrorreportingpb "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := errorreporting.NewErrorGroupClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &clouderrorreportingpb.GetGroupRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1#GetGroupRequest.
	}
	resp, err := c.GetGroup(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*ErrorGroupClient) SetGoogleClientInfo

func (egc *ErrorGroupClient) SetGoogleClientInfo(keyval ...string)

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

Internal use only.

func (*ErrorGroupClient) UpdateGroup

UpdateGroup replace the data for the specified group. Fails if the group does not exist.

Example
package main

import (
	"context"

	errorreporting "cloud.google.com/go/errorreporting/apiv1beta1"
	clouderrorreportingpb "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := errorreporting.NewErrorGroupClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &clouderrorreportingpb.UpdateGroupRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1#UpdateGroupRequest.
	}
	resp, err := c.UpdateGroup(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

type ErrorGroupStatsIterator

type ErrorGroupStatsIterator struct {

	// Response is the raw response for the current page.
	// It must be cast to the RPC response type.
	// Calling Next() or InternalFetch() updates this value.
	Response interface{}

	// InternalFetch is for use by the Google Cloud Libraries only.
	// It is not part of the stable interface of this package.
	//
	// InternalFetch returns results from a single call to the underlying RPC.
	// The number of results is no greater than pageSize.
	// If there are no more results, nextPageToken is empty and err is nil.
	InternalFetch func(pageSize int, pageToken string) (results []*clouderrorreportingpb.ErrorGroupStats, nextPageToken string, err error)
	// contains filtered or unexported fields
}

ErrorGroupStatsIterator manages a stream of *clouderrorreportingpb.ErrorGroupStats.

func (*ErrorGroupStatsIterator) 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 (*ErrorGroupStatsIterator) PageInfo

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

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

type ErrorStatsCallOptions

type ErrorStatsCallOptions struct {
	ListGroupStats []gax.CallOption
	ListEvents     []gax.CallOption
	DeleteEvents   []gax.CallOption
}

ErrorStatsCallOptions contains the retry settings for each method of ErrorStatsClient.

type ErrorStatsClient

type ErrorStatsClient struct {

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

ErrorStatsClient is a client for interacting with Error Reporting API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

An API for retrieving and managing error statistics as well as data for individual events.

func NewErrorStatsClient

func NewErrorStatsClient(ctx context.Context, opts ...option.ClientOption) (*ErrorStatsClient, error)

NewErrorStatsClient creates a new error stats service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

An API for retrieving and managing error statistics as well as data for individual events.

Example
package main

import (
	"context"

	errorreporting "cloud.google.com/go/errorreporting/apiv1beta1"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := errorreporting.NewErrorStatsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}
Output:

func NewErrorStatsRESTClient added in v0.3.0

func NewErrorStatsRESTClient(ctx context.Context, opts ...option.ClientOption) (*ErrorStatsClient, error)

NewErrorStatsRESTClient creates a new error stats service rest client.

An API for retrieving and managing error statistics as well as data for individual events.

Example
package main

import (
	"context"

	errorreporting "cloud.google.com/go/errorreporting/apiv1beta1"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := errorreporting.NewErrorStatsRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}
Output:

func (*ErrorStatsClient) Close

func (c *ErrorStatsClient) Close() error

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

func (*ErrorStatsClient) Connection deprecated

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

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*ErrorStatsClient) DeleteEvents

DeleteEvents deletes all error events of a given project.

Example
package main

import (
	"context"

	errorreporting "cloud.google.com/go/errorreporting/apiv1beta1"

	clouderrorreportingpb "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := errorreporting.NewErrorStatsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &clouderrorreportingpb.DeleteEventsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1#DeleteEventsRequest.
	}
	resp, err := c.DeleteEvents(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*ErrorStatsClient) ListEvents

ListEvents lists the specified events.

Example
package main

import (
	"context"

	errorreporting "cloud.google.com/go/errorreporting/apiv1beta1"
	"google.golang.org/api/iterator"

	clouderrorreportingpb "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := errorreporting.NewErrorStatsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &clouderrorreportingpb.ListEventsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1#ListEventsRequest.
	}
	it := c.ListEvents(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}
Output:

func (*ErrorStatsClient) ListGroupStats

ListGroupStats lists the specified groups.

Example
package main

import (
	"context"

	errorreporting "cloud.google.com/go/errorreporting/apiv1beta1"
	"google.golang.org/api/iterator"

	clouderrorreportingpb "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := errorreporting.NewErrorStatsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &clouderrorreportingpb.ListGroupStatsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1#ListGroupStatsRequest.
	}
	it := c.ListGroupStats(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}
Output:

func (*ErrorStatsClient) SetGoogleClientInfo

func (esc *ErrorStatsClient) SetGoogleClientInfo(keyval ...string)

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

Internal use only.

type ReportErrorsCallOptions

type ReportErrorsCallOptions struct {
	ReportErrorEvent []gax.CallOption
}

ReportErrorsCallOptions contains the retry settings for each method of ReportErrorsClient.

type ReportErrorsClient

type ReportErrorsClient struct {

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

ReportErrorsClient is a client for interacting with Error Reporting API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

An API for reporting error events.

func NewReportErrorsClient

func NewReportErrorsClient(ctx context.Context, opts ...option.ClientOption) (*ReportErrorsClient, error)

NewReportErrorsClient creates a new report errors service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

An API for reporting error events.

Example
package main

import (
	"context"

	errorreporting "cloud.google.com/go/errorreporting/apiv1beta1"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := errorreporting.NewReportErrorsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}
Output:

func NewReportErrorsRESTClient added in v0.3.0

func NewReportErrorsRESTClient(ctx context.Context, opts ...option.ClientOption) (*ReportErrorsClient, error)

NewReportErrorsRESTClient creates a new report errors service rest client.

An API for reporting error events.

Example
package main

import (
	"context"

	errorreporting "cloud.google.com/go/errorreporting/apiv1beta1"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := errorreporting.NewReportErrorsRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}
Output:

func (*ReportErrorsClient) Close

func (c *ReportErrorsClient) Close() error

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

func (*ReportErrorsClient) Connection deprecated

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

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*ReportErrorsClient) ReportErrorEvent

ReportErrorEvent report an individual error event and record the event to a log.

This endpoint accepts either an OAuth token, or an API key (at https://support.google.com/cloud/answer/6158862) for authentication. To use an API key, append it to the URL as the value of a key parameter. For example:

POST https://clouderrorreporting.googleapis.com/v1beta1/{projectName}/events:report?key=123ABC456

Note: Error Reporting (at /error-reporting) is a global service built on Cloud Logging and doesn’t analyze logs stored in regional log buckets or logs routed to other Google Cloud projects.

For more information, see Using Error Reporting with regionalized logs (at /error-reporting/docs/regionalization).

Example
package main

import (
	"context"

	errorreporting "cloud.google.com/go/errorreporting/apiv1beta1"
	clouderrorreportingpb "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := errorreporting.NewReportErrorsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &clouderrorreportingpb.ReportErrorEventRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1#ReportErrorEventRequest.
	}
	resp, err := c.ReportErrorEvent(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*ReportErrorsClient) SetGoogleClientInfo

func (rec *ReportErrorsClient) SetGoogleClientInfo(keyval ...string)

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

Internal use only.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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