Client for Stackdriver Error Reporting API#

class google.cloud.errorreporting_v1beta1.ErrorGroupServiceClient(transport=None, channel=None, credentials=None, client_config=None, client_info=None, client_options=None)[source]#

Service for retrieving and updating individual error groups.

Constructor.

Parameters
  • (Union[ErrorGroupServiceGrpcTransport, (transport) – Callable[[~.Credentials, type], ~.ErrorGroupServiceGrpcTransport]): A transport instance, responsible for actually making the API calls. The default transport uses the gRPC protocol. This argument may also be a callable which returns a transport instance. Callables will be sent the credentials as the first argument and the default transport class as the second argument.

  • 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.

enums = <module 'google.cloud.errorreporting_v1beta1.gapic.enums' from '/usr/local/lib/python3.7/site-packages/google/cloud/errorreporting_v1beta1/gapic/enums.py'>#
classmethod from_service_account_file(filename, *args, **kwargs)[source]#

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

Parameters
  • filename (str) – The path to the service account private key json file.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

ErrorGroupServiceClient

classmethod from_service_account_json(filename, *args, **kwargs)#

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

Parameters
  • filename (str) – The path to the service account private key json file.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

ErrorGroupServiceClient

get_group(group_name, retry=<object object>, timeout=<object object>, metadata=None)[source]#

Get the specified group.

Example

>>> from google.cloud import errorreporting_v1beta1
>>>
>>> client = errorreporting_v1beta1.ErrorGroupServiceClient()
>>>
>>> group_name = client.group_path('[PROJECT]', '[GROUP]')
>>>
>>> response = client.get_group(group_name)
Parameters
  • group_name (str) –

    [Required] The group resource name. Written as projects/projectID/groups/group_name. Call groupStats.list to return a list of groups belonging to this project.

    Example: projects/my-project-123/groups/my-group

  • 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.

Returns

A ErrorGroup instance.

Raises
classmethod group_path(project, group)[source]#

Return a fully-qualified group string.

update_group(group, retry=<object object>, timeout=<object object>, metadata=None)[source]#

Replace the data for the specified group. Fails if the group does not exist.

Example

>>> from google.cloud import errorreporting_v1beta1
>>>
>>> client = errorreporting_v1beta1.ErrorGroupServiceClient()
>>>
>>> # TODO: Initialize `group`:
>>> group = {}
>>>
>>> response = client.update_group(group)
Parameters
  • group (Union[dict, ErrorGroup]) –

    [Required] The group which replaces the resource on the server.

    If a dict is provided, it must be of the same form as the protobuf message ErrorGroup

  • 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.

Returns

A ErrorGroup instance.

Raises
class google.cloud.errorreporting_v1beta1.ErrorStatsServiceClient(transport=None, channel=None, credentials=None, client_config=None, client_info=None, client_options=None)[source]#

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

Constructor.

Parameters
  • (Union[ErrorStatsServiceGrpcTransport, (transport) – Callable[[~.Credentials, type], ~.ErrorStatsServiceGrpcTransport]): A transport instance, responsible for actually making the API calls. The default transport uses the gRPC protocol. This argument may also be a callable which returns a transport instance. Callables will be sent the credentials as the first argument and the default transport class as the second argument.

  • 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(project_name, retry=<object object>, timeout=<object object>, metadata=None)[source]#

Deletes all error events of a given project.

Example

>>> from google.cloud import errorreporting_v1beta1
>>>
>>> client = errorreporting_v1beta1.ErrorStatsServiceClient()
>>>
>>> project_name = client.project_path('[PROJECT]')
>>>
>>> response = client.delete_events(project_name)
Parameters
  • 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.

  • 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.

Returns

A DeleteEventsResponse instance.

Raises
enums = <module 'google.cloud.errorreporting_v1beta1.gapic.enums' from '/usr/local/lib/python3.7/site-packages/google/cloud/errorreporting_v1beta1/gapic/enums.py'>#
classmethod from_service_account_file(filename, *args, **kwargs)[source]#

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

Parameters
  • filename (str) – The path to the service account private key json file.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

ErrorStatsServiceClient

classmethod from_service_account_json(filename, *args, **kwargs)#

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

Parameters
  • filename (str) – The path to the service account private key json file.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

ErrorStatsServiceClient

list_events(project_name, group_id, service_filter=None, time_range=None, page_size=None, retry=<object object>, timeout=<object object>, metadata=None)[source]#

Lists the specified events.

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
  • 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.

  • 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.

Returns

A PageIterator instance. An iterable of ErrorEvent instances. You can also iterate over the pages of the response using its pages property.

Raises
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=<object object>, timeout=<object object>, metadata=None)[source]#

Lists the specified groups.

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
  • 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.

Returns

A PageIterator instance. An iterable of ErrorGroupStats instances. You can also iterate over the pages of the response using its pages property.

Raises
classmethod project_path(project)[source]#

Return a fully-qualified project string.

class google.cloud.errorreporting_v1beta1.ReportErrorsServiceClient(transport=None, channel=None, credentials=None, client_config=None, client_info=None, client_options=None)[source]#

An API for reporting error events.

Constructor.

Parameters
  • (Union[ReportErrorsServiceGrpcTransport, (transport) – Callable[[~.Credentials, type], ~.ReportErrorsServiceGrpcTransport]): A transport instance, responsible for actually making the API calls. The default transport uses the gRPC protocol. This argument may also be a callable which returns a transport instance. Callables will be sent the credentials as the first argument and the default transport class as the second argument.

  • 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.

enums = <module 'google.cloud.errorreporting_v1beta1.gapic.enums' from '/usr/local/lib/python3.7/site-packages/google/cloud/errorreporting_v1beta1/gapic/enums.py'>#
classmethod from_service_account_file(filename, *args, **kwargs)[source]#

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

Parameters
  • filename (str) – The path to the service account private key json file.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

ReportErrorsServiceClient

classmethod from_service_account_json(filename, *args, **kwargs)#

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

Parameters
  • filename (str) – The path to the service account private key json file.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

ReportErrorsServiceClient

classmethod project_path(project)[source]#

Return a fully-qualified project string.

report_error_event(project_name, event, retry=<object object>, timeout=<object object>, metadata=None)[source]#

Report an individual error event.

Example

>>> from google.cloud import errorreporting_v1beta1
>>>
>>> client = errorreporting_v1beta1.ReportErrorsServiceClient()
>>>
>>> project_name = client.project_path('[PROJECT]')
>>>
>>> # TODO: Initialize `event`:
>>> event = {}
>>>
>>> response = client.report_error_event(project_name, event)
Parameters
  • 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.

  • event (Union[dict, ReportedErrorEvent]) –

    [Required] The error event to be reported.

    If a dict is provided, it must be of the same form as the protobuf message ReportedErrorEvent

  • 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.

Returns

A ReportErrorEventResponse instance.

Raises