Reference documentation and code samples for the Error Reporting API class Google::Cloud::ErrorReporting::ErrorEvent.
ErrorEvent
An individual error event to report to Error Reporting
service.
Google::Cloud::ErrorReporting::ErrorEvent is able to be transformed
into the Google::Cloud::ErrorReporting::V1beta1::ReportedErrorEvent
gRPC structure. Once an error event is reported, the GCP
Error Reporting service is able to parse the message and
backtrace, then group the error events by content.
Inherits
Object
Example
require"google/cloud/error_reporting"error_reporting=Google::Cloud::ErrorReporting.newerror_event=error_reporting.error_event"Error with Backtrace",event_time:Time.now,service_name:"my_app_name",service_version:"v8"error_reporting.reporterror_event
Methods
.from_exception
defself.from_exception(exception)->ErrorEvent
Construct an ErrorEvent object based on a given exception.
Parameter
exception (Exception) — A Ruby exception.
Returns
(ErrorEvent) — An ErrorEvent object containing information
from the given exception.
.from_grpc
defself.from_grpc(grpc)->ErrorEvent
Build a new ErrorEvent from a
Google::Cloud::ErrorReporting::V1beta1::ReportedErrorEvent object.
Parameter
grpc (Google::Cloud::ErrorReporting::V1beta1::ReportedErrorEvent) — A Google::Cloud::ErrorReporting::V1beta1::ReportedErrorEvent
object
Returns
(ErrorEvent) — A new ErrorEvent instance derived from given grpc
object
#event_time
defevent_time()
Time when the event occurred. If not provided, the time when the event
was received by the Error Reporting system will be used.
#event_time=
defevent_time=(value)
Time when the event occurred. If not provided, the time when the event
was received by the Error Reporting system will be used.
#file_path
deffile_path()
The source code filename, which can include a truncated relative path,
or a full path from a production machine.
#file_path=
deffile_path=(value)
The source code filename, which can include a truncated relative path,
or a full path from a production machine.
#function_name
deffunction_name()
Human-readable name of a function or method. The value can include
optional context like the class or package name. For example,
my.package.MyClass.method in case of Java.
#function_name=
deffunction_name=(value)
Human-readable name of a function or method. The value can include
optional context like the class or package name. For example,
my.package.MyClass.method in case of Java.
#http_method
defhttp_method()
The type of HTTP request, such as GET, POST, etc.
#http_method=
defhttp_method=(value)
The type of HTTP request, such as GET, POST, etc.
#http_referrer
defhttp_referrer()
The referrer information that is provided with the request.
#http_referrer=
defhttp_referrer=(value)
The referrer information that is provided with the request.
#http_remote_ip
defhttp_remote_ip()
The IP address from which the request originated. This can be IPv4,
IPv6, or a token which is derived from the IP address, depending on
the data that has been provided in the error report.
#http_remote_ip=
defhttp_remote_ip=(value)
The IP address from which the request originated. This can be IPv4,
IPv6, or a token which is derived from the IP address, depending on
the data that has been provided in the error report.
#http_status
defhttp_status()
The HTTP response status code for the request.
#http_status=
defhttp_status=(value)
The HTTP response status code for the request.
#http_url
defhttp_url()
The URL of the request.
#http_url=
defhttp_url=(value)
The URL of the request.
#http_user_agent
defhttp_user_agent()
The user agent information that is provided with the request.
#http_user_agent=
defhttp_user_agent=(value)
The user agent information that is provided with the request.
#line_number
defline_number()
1-based. 0 indicates that the line number is unknown.
#line_number=
defline_number=(value)
1-based. 0 indicates that the line number is unknown.
#message
defmessage()
A message describing the error. The message can contain an exception
stack in one of the supported programming languages and formats. In
that case, the message is parsed and detailed exception information is
returned when retrieving the error event again.
#message=
defmessage=(value)
A message describing the error. The message can contain an exception
stack in one of the supported programming languages and formats. In
that case, the message is parsed and detailed exception information is
returned when retrieving the error event again.
#service_name
defservice_name()
An identifier of the service, such as the name of the executable, job,
or Google App Engine service name. This field is expected to have a
low number of values that are relatively stable over time, as opposed
to version, which can be changed whenever new code is deployed.
#service_name=
defservice_name=(value)
An identifier of the service, such as the name of the executable, job,
or Google App Engine service name. This field is expected to have a
low number of values that are relatively stable over time, as opposed
to version, which can be changed whenever new code is deployed.
#service_version
defservice_version()
Represents the source code version that the developer provided, which
could represent a version label or a Git SHA-1 hash, for example.
#service_version=
defservice_version=(value)
Represents the source code version that the developer provided, which
could represent a version label or a Git SHA-1 hash, for example.
(Google::Cloud::ErrorReporting::V1beta1::ReportedErrorEvent) — gRPC struct that represent an ErrorEvent.
#user
defuser()
The user who caused or was affected by the crash. This can be a user
ID, an email address, or an arbitrary token that uniquely identifies
the user. When sending an error report, leave this field empty if the
user was not logged in. In this case the Error Reporting system will
use other data, such as remote IP address, to distinguish affected
users. See affectedUsersCount in ErrorGroupStats.
#user=
defuser=(value)
The user who caused or was affected by the crash. This can be a user
ID, an email address, or an arbitrary token that uniquely identifies
the user. When sending an error report, leave this field empty if the
user was not logged in. In this case the Error Reporting system will
use other data, such as remote IP address, to distinguish affected
users. See affectedUsersCount in ErrorGroupStats.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Error Reporting API - Class Google::Cloud::ErrorReporting::ErrorEvent (v0.44.0)\n\nVersion latestkeyboard_arrow_down\n\n- [0.44.0 (latest)](/ruby/docs/reference/google-cloud-error_reporting/latest/Google-Cloud-ErrorReporting-ErrorEvent)\n- [0.43.0](/ruby/docs/reference/google-cloud-error_reporting/0.43.0/Google-Cloud-ErrorReporting-ErrorEvent)\n- [0.42.3](/ruby/docs/reference/google-cloud-error_reporting/0.42.3/Google-Cloud-ErrorReporting-ErrorEvent) \nReference documentation and code samples for the Error Reporting API class Google::Cloud::ErrorReporting::ErrorEvent.\n\nErrorEvent\n----------\n\nAn individual error event to report to Error Reporting\nservice.\n\nGoogle::Cloud::ErrorReporting::ErrorEvent is able to be transformed\ninto the `Google::Cloud::ErrorReporting::V1beta1::ReportedErrorEvent`\ngRPC structure. Once an error event is reported, the GCP\nError Reporting service is able to parse the message and\nbacktrace, then group the error events by content. \n\nInherits\n--------\n\n- Object\n\nExample\n-------\n\n```ruby\nrequire \"google/cloud/error_reporting\"\n\nerror_reporting = Google::Cloud::ErrorReporting.new\n\nerror_event = error_reporting.error_event \"Error with Backtrace\",\n event_time: Time.now,\n service_name: \"my_app_name\",\n service_version: \"v8\"\nerror_reporting.report error_event\n```\n\nMethods\n-------\n\n### .from_exception\n\n def self.from_exception(exception) -\u003e ErrorEvent\n\nConstruct an ErrorEvent object based on a given exception. \n**Parameter**\n\n- **exception** (Exception) --- A Ruby exception. \n**Returns**\n\n- ([ErrorEvent](./Google-Cloud-ErrorReporting-ErrorEvent)) --- An ErrorEvent object containing information from the given exception.\n\n### .from_grpc\n\n def self.from_grpc(grpc) -\u003e ErrorEvent\n\nBuild a new ErrorEvent from a\n`Google::Cloud::ErrorReporting::V1beta1::ReportedErrorEvent` object. \n**Parameter**\n\n- **grpc** (Google::Cloud::ErrorReporting::V1beta1::ReportedErrorEvent) --- A `Google::Cloud::ErrorReporting::V1beta1::ReportedErrorEvent` object \n**Returns**\n\n- ([ErrorEvent](./Google-Cloud-ErrorReporting-ErrorEvent)) --- A new ErrorEvent instance derived from given grpc object\n\n### #event_time\n\n def event_time()\n\nTime when the event occurred. If not provided, the time when the event\nwas received by the Error Reporting system will be used.\n\n### #event_time=\n\n def event_time=(value)\n\nTime when the event occurred. If not provided, the time when the event\nwas received by the Error Reporting system will be used.\n\n### #file_path\n\n def file_path()\n\nThe source code filename, which can include a truncated relative path,\nor a full path from a production machine.\n\n### #file_path=\n\n def file_path=(value)\n\nThe source code filename, which can include a truncated relative path,\nor a full path from a production machine.\n\n### #function_name\n\n def function_name()\n\nHuman-readable name of a function or method. The value can include\noptional context like the class or package name. For example,\nmy.package.MyClass.method in case of Java.\n\n### #function_name=\n\n def function_name=(value)\n\nHuman-readable name of a function or method. The value can include\noptional context like the class or package name. For example,\nmy.package.MyClass.method in case of Java.\n\n### #http_method\n\n def http_method()\n\nThe type of HTTP request, such as GET, POST, etc.\n\n### #http_method=\n\n def http_method=(value)\n\nThe type of HTTP request, such as GET, POST, etc.\n\n### #http_referrer\n\n def http_referrer()\n\nThe referrer information that is provided with the request.\n\n### #http_referrer=\n\n def http_referrer=(value)\n\nThe referrer information that is provided with the request.\n\n### #http_remote_ip\n\n def http_remote_ip()\n\nThe IP address from which the request originated. This can be IPv4,\nIPv6, or a token which is derived from the IP address, depending on\nthe data that has been provided in the error report.\n\n### #http_remote_ip=\n\n def http_remote_ip=(value)\n\nThe IP address from which the request originated. This can be IPv4,\nIPv6, or a token which is derived from the IP address, depending on\nthe data that has been provided in the error report.\n\n### #http_status\n\n def http_status()\n\nThe HTTP response status code for the request.\n\n### #http_status=\n\n def http_status=(value)\n\nThe HTTP response status code for the request.\n\n### #http_url\n\n def http_url()\n\nThe URL of the request.\n\n### #http_url=\n\n def http_url=(value)\n\nThe URL of the request.\n\n### #http_user_agent\n\n def http_user_agent()\n\nThe user agent information that is provided with the request.\n\n### #http_user_agent=\n\n def http_user_agent=(value)\n\nThe user agent information that is provided with the request.\n\n### #line_number\n\n def line_number()\n\n1-based. 0 indicates that the line number is unknown.\n\n### #line_number=\n\n def line_number=(value)\n\n1-based. 0 indicates that the line number is unknown.\n\n### #message\n\n def message()\n\nA message describing the error. The message can contain an exception\nstack in one of the supported programming languages and formats. In\nthat case, the message is parsed and detailed exception information is\nreturned when retrieving the error event again.\n\n### #message=\n\n def message=(value)\n\nA message describing the error. The message can contain an exception\nstack in one of the supported programming languages and formats. In\nthat case, the message is parsed and detailed exception information is\nreturned when retrieving the error event again.\n\n### #service_name\n\n def service_name()\n\nAn identifier of the service, such as the name of the executable, job,\nor Google App Engine service name. This field is expected to have a\nlow number of values that are relatively stable over time, as opposed\nto version, which can be changed whenever new code is deployed.\n\n### #service_name=\n\n def service_name=(value)\n\nAn identifier of the service, such as the name of the executable, job,\nor Google App Engine service name. This field is expected to have a\nlow number of values that are relatively stable over time, as opposed\nto version, which can be changed whenever new code is deployed.\n\n### #service_version\n\n def service_version()\n\nRepresents the source code version that the developer provided, which\ncould represent a version label or a Git SHA-1 hash, for example.\n\n### #service_version=\n\n def service_version=(value)\n\nRepresents the source code version that the developer provided, which\ncould represent a version label or a Git SHA-1 hash, for example.\n\n### #to_grpc\n\n def to_grpc() -\u003e Google::Cloud::ErrorReporting::V1beta1::ReportedErrorEvent\n\nConvert ErrorEvent object to gRPC struct. \n**Returns**\n\n- (Google::Cloud::ErrorReporting::V1beta1::ReportedErrorEvent) --- gRPC struct that represent an ErrorEvent.\n\n### #user\n\n def user()\n\nThe user who caused or was affected by the crash. This can be a user\nID, an email address, or an arbitrary token that uniquely identifies\nthe user. When sending an error report, leave this field empty if the\nuser was not logged in. In this case the Error Reporting system will\nuse other data, such as remote IP address, to distinguish affected\nusers. See affectedUsersCount in ErrorGroupStats.\n\n### #user=\n\n def user=(value)\n\nThe user who caused or was affected by the crash. This can be a user\nID, an email address, or an arbitrary token that uniquely identifies\nthe user. When sending an error report, leave this field empty if the\nuser was not logged in. In this case the Error Reporting system will\nuse other data, such as remote IP address, to distinguish affected\nusers. See affectedUsersCount in ErrorGroupStats."]]