Add protos for Cloud Error Reporting API.

pull/60/head
Ethan Bao 9 years ago
parent 1e645debc6
commit e739951ef4
  1. 1
      google/devtools/clouderrorreporting/README.md
  2. 154
      google/devtools/clouderrorreporting/v1beta1/common.proto
  3. 58
      google/devtools/clouderrorreporting/v1beta1/error_group_service.proto
  4. 323
      google/devtools/clouderrorreporting/v1beta1/error_stats_service.proto
  5. 79
      google/devtools/clouderrorreporting/v1beta1/report_errors_service.proto

@ -0,0 +1 @@
Read more about the Stackdriver Error Reporting API [here](https://cloud.google.com/error-reporting/reference/)

@ -0,0 +1,154 @@
// Copyright 2016 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.devtools.clouderrorreporting.v1beta1;
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
option java_multiple_files = true;
option java_outer_classname = "CommonProto";
option java_package = "com.google.devtools.clouderrorreporting.v1beta1";
// Description of a group of similar error events.
message ErrorGroup {
// The group resource name.
// Example: <code>projects/my-project-123/groups/my-groupid</code>
string name = 1;
// Group IDs are unique for a given project. If the same kind of error
// occurs in different service contexts, it will receive the same group ID.
string group_id = 2;
// Associated tracking issues.
repeated TrackingIssue tracking_issues = 3;
}
// Information related to tracking the progress on resolving the error.
message TrackingIssue {
// A URL pointing to a related entry in an issue tracking system.
// Example: https://github.com/user/project/issues/4
string url = 1;
}
// An error event which is returned by the Error Reporting system.
message ErrorEvent {
// Time when the event occurred as provided in the error report.
// If the report did not contain a timestamp, the time the error was received
// by the Error Reporting system is used.
google.protobuf.Timestamp event_time = 1;
// The `ServiceContext` for which this error was reported.
ServiceContext service_context = 2;
// The stack trace that was reported or logged by the service.
string message = 3;
// Data about the context in which the error occurred.
ErrorContext context = 5;
}
// Describes a running service that sends errors.
// Its version changes over time and multiple versions can run in parallel.
message ServiceContext {
// 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.
//
// Contains the service name for error reports extracted from Google
// App Engine logs or `default` if the App Engine default service is used.
string service = 2;
// Represents the source code version that the developer provided,
// which could represent a version label or a Git SHA-1 hash, for example.
string version = 3;
}
// A description of the context in which an error occurred.
// This data should be provided by the application when reporting an error,
// unless the
// error report has been generated automatically from Google App Engine logs.
message ErrorContext {
// The HTTP request which was processed when the error was
// triggered.
HttpRequestContext http_request = 1;
// 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 `affected_users_count` in
// `ErrorGroupStats`.
string user = 2;
// The location in the source code where the decision was made to
// report the error, usually the place where it was logged.
// For a logged exception this would be the source line where the
// exception is logged, usually close to the place where it was
// caught. This value is in contrast to `Exception.cause_location`,
// which describes the source line where the exception was thrown.
SourceLocation report_location = 3;
}
// HTTP request data that is related to a reported error.
// This data should be provided by the application when reporting an error,
// unless the
// error report has been generated automatically from Google App Engine logs.
message HttpRequestContext {
// The type of HTTP request, such as `GET`, `POST`, etc.
string method = 1;
// The URL of the request.
string url = 2;
// The user agent information that is provided with the request.
string user_agent = 3;
// The referrer information that is provided with the request.
string referrer = 4;
// The HTTP response status code for the request.
int32 response_status_code = 5;
// 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.
string remote_ip = 6;
}
// Indicates a location in the source code of the service for which
// errors are reported.
// This data should be provided by the application when reporting an error,
// unless the error report has been generated automatically from Google App
// Engine logs. All fields are optional.
message SourceLocation {
// The source code filename, which can include a truncated relative
// path, or a full path from a production machine.
string file_path = 1;
// 1-based. 0 indicates that the line number is unknown.
int32 line_number = 2;
// 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.
string function_name = 4;
}

@ -0,0 +1,58 @@
// Copyright 2016 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.devtools.clouderrorreporting.v1beta1;
import "google/api/annotations.proto";
import "google/devtools/clouderrorreporting/v1beta1/common.proto";
option java_multiple_files = true;
option java_outer_classname = "ErrorGroupServiceProto";
option java_package = "com.google.devtools.clouderrorreporting.v1beta1";
// Service for retrieving and updating individual error groups.
service ErrorGroupService {
// Get the specified group.
rpc GetGroup(GetGroupRequest) returns (ErrorGroup) {
option (google.api.http) = { get: "/v1beta1/{group_name=projects/*/groups/*}" };
}
// Replace the data for the specified group.
// Fails if the group does not exist.
rpc UpdateGroup(UpdateGroupRequest) returns (ErrorGroup) {
option (google.api.http) = { put: "/v1beta1/{group.name=projects/*/groups/*}" body: "group" };
}
}
// A request to return an individual group.
message GetGroupRequest {
// [Required] The group resource name. Written as
// <code>projects/<var>projectID</var>/groups/<var>group_name</var></code>.
// Call
// <a href="/error-reporting/reference/rest/v1beta1/projects.groupStats/list">
// <code>groupStats.list</code></a> to return a list of groups belonging to
// this project.
//
// Example: <code>projects/my-project-123/groups/my-group</code>
string group_name = 1;
}
// A request to replace the existing data for the given group.
message UpdateGroupRequest {
// [Required] The group which replaces the resource on the server.
ErrorGroup group = 1;
}

@ -0,0 +1,323 @@
// Copyright 2016 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.devtools.clouderrorreporting.v1beta1;
import "google/api/annotations.proto";
import "google/devtools/clouderrorreporting/v1beta1/common.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
option java_multiple_files = true;
option java_outer_classname = "ErrorStatsServiceProto";
option java_package = "com.google.devtools.clouderrorreporting.v1beta1";
// An API for retrieving and managing error statistics as well as data for
// individual events.
service ErrorStatsService {
// Lists the specified groups.
rpc ListGroupStats(ListGroupStatsRequest) returns (ListGroupStatsResponse) {
option (google.api.http) = { get: "/v1beta1/{project_name=projects/*}/groupStats" };
}
// Lists the specified events.
rpc ListEvents(ListEventsRequest) returns (ListEventsResponse) {
option (google.api.http) = { get: "/v1beta1/{project_name=projects/*}/events" };
}
// Deletes all error events of a given project.
rpc DeleteEvents(DeleteEventsRequest) returns (DeleteEventsResponse) {
option (google.api.http) = { delete: "/v1beta1/{project_name=projects/*}/events" };
}
}
// Specifies a set of `ErrorGroupStats` to return.
message ListGroupStatsRequest {
// [Required] The resource name of the Google Cloud Platform project. Written
// as <code>projects/</code> plus the
// <a href="https://support.google.com/cloud/answer/6158840">Google Cloud
// Platform project ID</a>.
//
// Example: <code>projects/my-project-123</code>.
string project_name = 1;
// [Optional] List all <code>ErrorGroupStats</code> with these IDs.
// If not specified, all error group stats with a non-zero error count
// for the given selection criteria are returned.
repeated string group_id = 2;
// [Optional] List only <code>ErrorGroupStats</code> which belong to a service
// context that matches the filter.
// Data for all service contexts is returned if this field is not specified.
ServiceContextFilter service_filter = 3;
// [Required] List data for the given time range.
// The service is tuned for retrieving data up to (approximately) 'now'.
// Retrieving data for arbitrary time periods in the past can result in
// higher response times or in returning incomplete results.
QueryTimeRange time_range = 5;
// [Optional] The preferred duration for a single returned `TimedCount`.
// If not set, no timed counts are returned.
google.protobuf.Duration timed_count_duration = 6;
// [Optional] The alignment of the timed counts to be returned.
// Default is `ALIGNMENT_EQUAL_AT_END`.
TimedCountAlignment alignment = 7;
// [Optional] Time where the timed counts shall be aligned if rounded
// alignment is chosen. Default is 00:00 UTC.
google.protobuf.Timestamp alignment_time = 8;
// [Optional] The sort order in which the results are returned.
// Default is `COUNT_DESC`.
ErrorGroupOrder order = 9;
// [Optional] The maximum number of results to return per response.
// Default is 20.
int32 page_size = 11;
// [Optional] A `next_page_token` provided by a previous response. To view
// additional results, pass this token along with the identical query
// parameters as the first request.
string page_token = 12;
}
// Contains a set of requested error group stats.
message ListGroupStatsResponse {
// The error group stats which match the given request.
repeated ErrorGroupStats error_group_stats = 1;
// If non-empty, more results are available.
// Pass this token, along with the same query parameters as the first
// request, to view the next page of results.
string next_page_token = 2;
}
// Data extracted for a specific group based on certain selection criteria,
// such as a given time period and/or service filter.
message ErrorGroupStats {
// Group data that is independent of the selection criteria.
ErrorGroup group = 1;
// Approximate total number of events in the given group that match
// the selection criteria.
int64 count = 2;
// Approximate number of affected users in the given group that
// match the selection criteria.
// Users are distinguished by data in the `ErrorContext` of the
// individual error events, such as their login name or their remote
// IP address in case of HTTP requests.
// The number of affected users can be zero even if the number of
// errors is non-zero if no data was provided from which the
// affected user could be deduced.
// Users are counted based on data in the request
// context that was provided in the error report. If more users are
// implicitly affected, such as due to a crash of the whole service,
// this is not reflected here.
int64 affected_users_count = 3;
// Approximate number of occurrences over time.
// Timed counts returned by ListGroups are guaranteed to be:
//
// - Inside the requested time interval
// - Non-overlapping, and
// - Ordered by ascending time.
repeated TimedCount timed_counts = 4;
// Approximate first occurrence that was seen for this group and
// which matches the given selection criteria.
google.protobuf.Timestamp first_seen_time = 5;
// Approximate last occurrence that was seen for this group
// and which matches the given selection criteria.
google.protobuf.Timestamp last_seen_time = 6;
// Service contexts with a non-zero error count for the given selection
// criteria. This list can be truncated if multiple services are affected.
// Refer to `num_affected_services` for the total count.
repeated ServiceContext affected_services = 7;
// The total number of services with a non-zero error count for the given
// selection criteria.
int32 num_affected_services = 8;
// An arbitrary event that is chosen as representative for the whole group.
// The representative event is intended to be used as a quick preview for
// the whole group. Events in the group are usually sufficiently similar
// to each other such that showing an arbitrary representative provides
// insight into the characteristics of the group as a whole.
ErrorEvent representative = 9;
}
// The number of errors in a given time period.
// All numbers are approximate since the error events are sampled
// before counting them.
message TimedCount {
// Approximate number of occurrences in the given time period.
int64 count = 1;
// Start of the time period to which `count` refers (included).
google.protobuf.Timestamp start_time = 2;
// End of the time period to which `count` refers (excluded).
google.protobuf.Timestamp end_time = 3;
}
// Specifies a set of error events to return.
message ListEventsRequest {
// [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`.
string project_name = 1;
// [Required] The group for which events shall be returned.
string group_id = 2;
// [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.
ServiceContextFilter service_filter = 3;
// [Optional] List only data for the given time range.
// The service is tuned for retrieving data up to (approximately) 'now'.
// Retrieving data for arbitrary time periods in the past can result in
// higher response times or in returning incomplete results.
// Data for the last hour until now is returned if not specified.
QueryTimeRange time_range = 4;
// [Optional] The maximum number of results to return per response.
int32 page_size = 6;
// [Optional] A `next_page_token` provided by a previous response.
string page_token = 7;
}
// Contains a set of requested error events.
message ListEventsResponse {
// The error events which match the given request.
repeated ErrorEvent error_events = 1;
// If non-empty, more results are available.
// Pass this token, along with the same query parameters as the first
// request, to view the next page of results.
string next_page_token = 2;
}
// Requests might be rejected or the resulting timed count durations might be
// adjusted for lower durations.
message QueryTimeRange {
// The supported time ranges.
enum Period {
// Do not use.
PERIOD_UNSPECIFIED = 0;
// Retrieve data for the last hour.
// Recommended minimum timed count duration: 1 min.
PERIOD_1_HOUR = 1;
// Retrieve data for the last 6 hours.
// Recommended minimum timed count duration: 10 min.
PERIOD_6_HOURS = 2;
// Retrieve data for the last day.
// Recommended minimum timed count duration: 1 hour.
PERIOD_1_DAY = 3;
// Retrieve data for the last week.
// Recommended minimum timed count duration: 6 hours.
PERIOD_1_WEEK = 4;
// Retrieve data for the last 30 days.
// Recommended minimum timed count duration: 1 day.
PERIOD_30_DAYS = 5;
}
// Restricts the query to the specified time range.
Period period = 1;
}
// Specifies criteria for filtering a subset of service contexts.
// The fields in the filter correspond to the fields in `ServiceContext`.
// Only exact, case-sensitive matches are supported.
// If a field is unset or empty, it matches arbitrary values.
message ServiceContextFilter {
// [Optional] The exact value to match against
// [`ServiceContext.service`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.service).
string service = 2;
// [Optional] The exact value to match against
// [`ServiceContext.version`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.version).
string version = 3;
}
// Deletes all events in the project.
message DeleteEventsRequest {
// [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`.
string project_name = 1;
}
// Response message for deleting error events.
message DeleteEventsResponse {
}
// Specifies how the time periods of error group counts are aligned.
enum TimedCountAlignment {
// No alignment specified.
ERROR_COUNT_ALIGNMENT_UNSPECIFIED = 0;
// The time periods shall be consecutive, have width equal to the
// requested duration, and be aligned at the `alignment_time` provided in
// the request.
// The `alignment_time` does not have to be inside the query period but
// even if it is outside, only time periods are returned which overlap
// with the query period.
// A rounded alignment will typically result in a
// different size of the first or the last time period.
ALIGNMENT_EQUAL_ROUNDED = 1;
// The time periods shall be consecutive, have width equal to the
// requested duration, and be aligned at the end of the requested time
// period. This can result in a different size of the
// first time period.
ALIGNMENT_EQUAL_AT_END = 2;
}
// A sorting order of error groups.
enum ErrorGroupOrder {
// No group order specified.
GROUP_ORDER_UNSPECIFIED = 0;
// Total count of errors in the given time window in descending order.
COUNT_DESC = 1;
// Timestamp when the group was last seen in the given time window
// in descending order.
LAST_SEEN_DESC = 2;
// Timestamp when the group was created in descending order.
CREATED_DESC = 3;
// Number of affected users in the given time window in descending order.
AFFECTED_USERS_DESC = 4;
}

@ -0,0 +1,79 @@
// Copyright 2016 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.devtools.clouderrorreporting.v1beta1;
import "google/api/annotations.proto";
import "google/devtools/clouderrorreporting/v1beta1/common.proto";
import "google/protobuf/timestamp.proto";
option java_multiple_files = true;
option java_outer_classname = "ReportErrorsServiceProto";
option java_package = "com.google.devtools.clouderrorreporting.v1beta1";
// An API for reporting error events.
service ReportErrorsService {
// Report an individual error event.
//
// This endpoint accepts <strong>either</strong> an OAuth token,
// <strong>or</strong> an
// <a href="https://support.google.com/cloud/answer/6158862">API key</a>
// for authentication. To use an API key, append it to the URL as the value of
// a `key` parameter. For example:
// <pre>POST https://clouderrorreporting.googleapis.com/v1beta1/projects/example-project/events:report?key=123ABC456</pre>
rpc ReportErrorEvent(ReportErrorEventRequest) returns (ReportErrorEventResponse) {
option (google.api.http) = { post: "/v1beta1/{project_name=projects/*}/events:report" body: "event" };
}
}
// A request for reporting an individual error event.
message ReportErrorEventRequest {
// [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`.
string project_name = 1;
// [Required] The error event to be reported.
ReportedErrorEvent event = 2;
}
// Response for reporting an individual error event.
// Data may be added to this message in the future.
message ReportErrorEventResponse {
}
// An error event which is reported to the Error Reporting system.
message ReportedErrorEvent {
// [Optional] Time when the event occurred.
// If not provided, the time when the event was received by the
// Error Reporting system will be used.
google.protobuf.Timestamp event_time = 1;
// [Required] The service context in which this error has occurred.
ServiceContext service_context = 2;
// [Required] 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.
string message = 3;
// [Optional] A description of the context in which the error occurred.
ErrorContext context = 4;
}
Loading…
Cancel
Save