Class ErrorStatsServiceClient (0.34.0)

ErrorStatsServiceClient(
    transport=None,
    channel=None,
    credentials=None,
    client_config=None,
    client_info=None,
    client_options=None,
)

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

Methods

ErrorStatsServiceClient

ErrorStatsServiceClient(
    transport=None,
    channel=None,
    credentials=None,
    client_config=None,
    client_info=None,
    client_options=None,
)

Constructor.

Parameters
NameDescription
channel grpc.Channel

DEPRECATED. A Channel instance through which to make calls. This argument is mutually exclusive with credentials; providing both will raise an exception.

credentials google.auth.credentials.Credentials

The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. This argument is mutually exclusive with providing a transport instance to transport; doing so will raise an exception.

client_config dict

DEPRECATED. A dictionary of call options for each method. If not specified, the default configuration is used.

client_info google.api_core.gapic_v1.client_info.ClientInfo

The client info used to send a user-agent string along with API requests. If None, then default info will be used. Generally, you only need to set this if you're developing your own client library.

client_options Union[dict, google.api_core.client_options.ClientOptions]

Client options used to set user options on the client. API Endpoint should be set through client_options.

delete_events

delete_events(project_name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Deletes all error events of a given project.

.. rubric:: Example

from google.cloud import errorreporting_v1beta1

client = errorreporting_v1beta1.ErrorStatsServiceClient()

project_name = client.project_path('[PROJECT]')

response = client.delete_events(project_name)

Parameters
NameDescription
project_name str

[Required] The resource name of the Google Cloud Platform project. Written as projects/ plus the Google Cloud Platform project ID https://support.google.com/cloud/answer/6158840__. Example: projects/my-project-123.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

from_service_account_file

from_service_account_file(filename, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameter
NameDescription
filename str

The path to the service account private key json file.

Returns
TypeDescription
ErrorStatsServiceClientThe constructed client.

from_service_account_json

from_service_account_json(filename, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameter
NameDescription
filename str

The path to the service account private key json file.

Returns
TypeDescription
ErrorStatsServiceClientThe constructed client.

list_events

list_events(project_name, group_id, service_filter=None, time_range=None, page_size=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Lists the specified events.

.. rubric:: Example

from google.cloud import errorreporting_v1beta1

client = errorreporting_v1beta1.ErrorStatsServiceClient()

project_name = client.project_path('[PROJECT]')

TODO: Initialize group_id:

group_id = ''

Iterate over all results

for element in client.list_events(project_name, group_id): ... # process element ... pass

Alternatively:

Iterate over results one page at a time

for page in client.list_events(project_name, group_id).pages: ... for element in page: ... # process element ... pass

Parameters
NameDescription
project_name str

[Required] The resource name of the Google Cloud Platform project. Written as projects/ plus the Google Cloud Platform project ID https://support.google.com/cloud/answer/6158840__. Example: projects/my-project-123.

group_id str

[Required] The group for which events shall be returned.

service_filter Union[dict, ServiceContextFilter]

[Optional] List only ErrorGroups which belong to a service context that matches the filter. Data for all service contexts is returned if this field is not specified. If a dict is provided, it must be of the same form as the protobuf message ServiceContextFilter

time_range Union[dict, QueryTimeRange]

[Optional] List only data for the given time range. If not set a default time range is used. The field time_range_begin in the response will specify the beginning of this time range. If a dict is provided, it must be of the same form as the protobuf message QueryTimeRange

page_size int

The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

list_group_stats

list_group_stats(project_name, time_range, group_id=None, service_filter=None, timed_count_duration=None, alignment=None, alignment_time=None, order=None, page_size=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Lists the specified groups.

.. rubric:: Example

from google.cloud import errorreporting_v1beta1

client = errorreporting_v1beta1.ErrorStatsServiceClient()

project_name = client.project_path('[PROJECT]')

TODO: Initialize time_range:

time_range = {}

Iterate over all results

for element in client.list_group_stats(project_name, time_range): ... # process element ... pass

Alternatively:

Iterate over results one page at a time

for page in client.list_group_stats(project_name, time_range).pages: ... for element in page: ... # process element ... pass

Parameters
NameDescription
project_name str

[Required] The resource name of the Google Cloud Platform project. Written as projects/ plus the Google Cloud Platform project ID. Example: projects/my-project-123.

time_range Union[dict, QueryTimeRange]

[Optional] List data for the given time range. If not set a default time range is used. The field time_range_begin in the response will specify the beginning of this time range. Only ErrorGroupStats with a non-zero count in the given time range are returned, unless the request contains an explicit group_id list. If a group_id list is given, also ErrorGroupStats with zero occurrences are returned. If a dict is provided, it must be of the same form as the protobuf message QueryTimeRange

group_id list[str]

[Optional] List all ErrorGroupStats with these IDs.

service_filter Union[dict, ServiceContextFilter]

[Optional] List only ErrorGroupStats which belong to a service context that matches the filter. Data for all service contexts is returned if this field is not specified. If a dict is provided, it must be of the same form as the protobuf message ServiceContextFilter

timed_count_duration Union[dict, Duration]

[Optional] The preferred duration for a single returned TimedCount. If not set, no timed counts are returned. If a dict is provided, it must be of the same form as the protobuf message Duration

alignment TimedCountAlignment

[Optional] The alignment of the timed counts to be returned. Default is ALIGNMENT_EQUAL_AT_END.

alignment_time Union[dict, Timestamp]

[Optional] Time where the timed counts shall be aligned if rounded alignment is chosen. Default is 00:00 UTC. If a dict is provided, it must be of the same form as the protobuf message Timestamp

order ErrorGroupOrder

[Optional] The sort order in which the results are returned. Default is COUNT_DESC.

page_size int

The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

project_path

project_path(project)

Return a fully-qualified project string.