service.proto 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. // Copyright 2021 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.monitoring.v3;
  16. import "google/api/resource.proto";
  17. import "google/protobuf/duration.proto";
  18. import "google/type/calendar_period.proto";
  19. option csharp_namespace = "Google.Cloud.Monitoring.V3";
  20. option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring";
  21. option java_multiple_files = true;
  22. option java_outer_classname = "ServiceMonitoringProto";
  23. option java_package = "com.google.monitoring.v3";
  24. option php_namespace = "Google\\Cloud\\Monitoring\\V3";
  25. option ruby_package = "Google::Cloud::Monitoring::V3";
  26. // A `Service` is a discrete, autonomous, and network-accessible unit, designed
  27. // to solve an individual concern
  28. // ([Wikipedia](https://en.wikipedia.org/wiki/Service-orientation)). In
  29. // Cloud Monitoring, a `Service` acts as the root resource under which
  30. // operational aspects of the service are accessible.
  31. message Service {
  32. option (google.api.resource) = {
  33. type: "monitoring.googleapis.com/Service"
  34. pattern: "projects/{project}/services/{service}"
  35. pattern: "organizations/{organization}/services/{service}"
  36. pattern: "folders/{folder}/services/{service}"
  37. pattern: "*"
  38. };
  39. // Custom view of service telemetry. Currently a place-holder pending final
  40. // design.
  41. message Custom {
  42. }
  43. // App Engine service. Learn more at https://cloud.google.com/appengine.
  44. message AppEngine {
  45. // The ID of the App Engine module underlying this service. Corresponds to
  46. // the `module_id` resource label in the `gae_app` monitored resource:
  47. // https://cloud.google.com/monitoring/api/resources#tag_gae_app
  48. string module_id = 1;
  49. }
  50. // Cloud Endpoints service. Learn more at https://cloud.google.com/endpoints.
  51. message CloudEndpoints {
  52. // The name of the Cloud Endpoints service underlying this service.
  53. // Corresponds to the `service` resource label in the `api` monitored
  54. // resource: https://cloud.google.com/monitoring/api/resources#tag_api
  55. string service = 1;
  56. }
  57. // Istio service scoped to a single Kubernetes cluster. Learn more at
  58. // https://istio.io. Clusters running OSS Istio will have their services
  59. // ingested as this type.
  60. message ClusterIstio {
  61. // The location of the Kubernetes cluster in which this Istio service is
  62. // defined. Corresponds to the `location` resource label in `k8s_cluster`
  63. // resources.
  64. string location = 1;
  65. // The name of the Kubernetes cluster in which this Istio service is
  66. // defined. Corresponds to the `cluster_name` resource label in
  67. // `k8s_cluster` resources.
  68. string cluster_name = 2;
  69. // The namespace of the Istio service underlying this service. Corresponds
  70. // to the `destination_service_namespace` metric label in Istio metrics.
  71. string service_namespace = 3;
  72. // The name of the Istio service underlying this service. Corresponds to the
  73. // `destination_service_name` metric label in Istio metrics.
  74. string service_name = 4;
  75. }
  76. // Istio service scoped to an Istio mesh. Anthos clusters running ASM < 1.6.8
  77. // will have their services ingested as this type.
  78. message MeshIstio {
  79. // Identifier for the mesh in which this Istio service is defined.
  80. // Corresponds to the `mesh_uid` metric label in Istio metrics.
  81. string mesh_uid = 1;
  82. // The namespace of the Istio service underlying this service. Corresponds
  83. // to the `destination_service_namespace` metric label in Istio metrics.
  84. string service_namespace = 3;
  85. // The name of the Istio service underlying this service. Corresponds to the
  86. // `destination_service_name` metric label in Istio metrics.
  87. string service_name = 4;
  88. }
  89. // Canonical service scoped to an Istio mesh. Anthos clusters running ASM >=
  90. // 1.6.8 will have their services ingested as this type.
  91. message IstioCanonicalService {
  92. // Identifier for the Istio mesh in which this canonical service is defined.
  93. // Corresponds to the `mesh_uid` metric label in
  94. // [Istio metrics](https://cloud.google.com/monitoring/api/metrics_istio).
  95. string mesh_uid = 1;
  96. // The namespace of the canonical service underlying this service.
  97. // Corresponds to the `destination_canonical_service_namespace` metric
  98. // label in [Istio
  99. // metrics](https://cloud.google.com/monitoring/api/metrics_istio).
  100. string canonical_service_namespace = 3;
  101. // The name of the canonical service underlying this service.
  102. // Corresponds to the `destination_canonical_service_name` metric label in
  103. // label in [Istio
  104. // metrics](https://cloud.google.com/monitoring/api/metrics_istio).
  105. string canonical_service = 4;
  106. }
  107. // Configuration for how to query telemetry on a Service.
  108. message Telemetry {
  109. // The full name of the resource that defines this service. Formatted as
  110. // described in https://cloud.google.com/apis/design/resource_names.
  111. string resource_name = 1;
  112. }
  113. // Resource name for this Service. The format is:
  114. //
  115. // projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
  116. string name = 1;
  117. // Name used for UI elements listing this Service.
  118. string display_name = 2;
  119. // REQUIRED. Service-identifying atoms specifying the underlying service.
  120. oneof identifier {
  121. // Custom service type.
  122. Custom custom = 6;
  123. // Type used for App Engine services.
  124. AppEngine app_engine = 7;
  125. // Type used for Cloud Endpoints services.
  126. CloudEndpoints cloud_endpoints = 8;
  127. // Type used for Istio services that live in a Kubernetes cluster.
  128. ClusterIstio cluster_istio = 9;
  129. // Type used for Istio services scoped to an Istio mesh.
  130. MeshIstio mesh_istio = 10;
  131. // Type used for canonical services scoped to an Istio mesh.
  132. // Metrics for Istio are
  133. // [documented here](https://istio.io/latest/docs/reference/config/metrics/)
  134. IstioCanonicalService istio_canonical_service = 11;
  135. }
  136. // Configuration for how to query telemetry on a Service.
  137. Telemetry telemetry = 13;
  138. // Labels which have been used to annotate the service. Label keys must start
  139. // with a letter. Label keys and values may contain lowercase letters,
  140. // numbers, underscores, and dashes. Label keys and values have a maximum
  141. // length of 63 characters, and must be less than 128 bytes in size. Up to 64
  142. // label entries may be stored. For labels which do not have a semantic value,
  143. // the empty string may be supplied for the label value.
  144. map<string, string> user_labels = 14;
  145. }
  146. // A Service-Level Objective (SLO) describes a level of desired good service. It
  147. // consists of a service-level indicator (SLI), a performance goal, and a period
  148. // over which the objective is to be evaluated against that goal. The SLO can
  149. // use SLIs defined in a number of different manners. Typical SLOs might include
  150. // "99% of requests in each rolling week have latency below 200 milliseconds" or
  151. // "99.5% of requests in each calendar month return successfully."
  152. message ServiceLevelObjective {
  153. option (google.api.resource) = {
  154. type: "monitoring.googleapis.com/ServiceLevelObjective"
  155. pattern: "projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}"
  156. pattern: "organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}"
  157. pattern: "folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}"
  158. pattern: "*"
  159. history: ORIGINALLY_SINGLE_PATTERN
  160. };
  161. // `ServiceLevelObjective.View` determines what form of
  162. // `ServiceLevelObjective` is returned from `GetServiceLevelObjective`,
  163. // `ListServiceLevelObjectives`, and `ListServiceLevelObjectiveVersions` RPCs.
  164. enum View {
  165. // Same as FULL.
  166. VIEW_UNSPECIFIED = 0;
  167. // Return the embedded `ServiceLevelIndicator` in the form in which it was
  168. // defined. If it was defined using a `BasicSli`, return that `BasicSli`.
  169. FULL = 2;
  170. // For `ServiceLevelIndicator`s using `BasicSli` articulation, instead
  171. // return the `ServiceLevelIndicator` with its mode of computation fully
  172. // spelled out as a `RequestBasedSli`. For `ServiceLevelIndicator`s using
  173. // `RequestBasedSli` or `WindowsBasedSli`, return the
  174. // `ServiceLevelIndicator` as it was provided.
  175. EXPLICIT = 1;
  176. }
  177. // Resource name for this `ServiceLevelObjective`. The format is:
  178. //
  179. // projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME]
  180. string name = 1;
  181. // Name used for UI elements listing this SLO.
  182. string display_name = 11;
  183. // The definition of good service, used to measure and calculate the quality
  184. // of the `Service`'s performance with respect to a single aspect of service
  185. // quality.
  186. ServiceLevelIndicator service_level_indicator = 3;
  187. // The fraction of service that must be good in order for this objective to be
  188. // met. `0 < goal <= 0.999`.
  189. double goal = 4;
  190. // The time period over which the objective will be evaluated.
  191. oneof period {
  192. // A rolling time period, semantically "in the past `<rolling_period>`".
  193. // Must be an integer multiple of 1 day no larger than 30 days.
  194. google.protobuf.Duration rolling_period = 5;
  195. // A calendar period, semantically "since the start of the current
  196. // `<calendar_period>`". At this time, only `DAY`, `WEEK`, `FORTNIGHT`, and
  197. // `MONTH` are supported.
  198. google.type.CalendarPeriod calendar_period = 6;
  199. }
  200. // Labels which have been used to annotate the service-level objective. Label
  201. // keys must start with a letter. Label keys and values may contain lowercase
  202. // letters, numbers, underscores, and dashes. Label keys and values have a
  203. // maximum length of 63 characters, and must be less than 128 bytes in size.
  204. // Up to 64 label entries may be stored. For labels which do not have a
  205. // semantic value, the empty string may be supplied for the label value.
  206. map<string, string> user_labels = 12;
  207. }
  208. // A Service-Level Indicator (SLI) describes the "performance" of a service. For
  209. // some services, the SLI is well-defined. In such cases, the SLI can be
  210. // described easily by referencing the well-known SLI and providing the needed
  211. // parameters. Alternatively, a "custom" SLI can be defined with a query to the
  212. // underlying metric store. An SLI is defined to be `good_service /
  213. // total_service` over any queried time interval. The value of performance
  214. // always falls into the range `0 <= performance <= 1`. A custom SLI describes
  215. // how to compute this ratio, whether this is by dividing values from a pair of
  216. // time series, cutting a `Distribution` into good and bad counts, or counting
  217. // time windows in which the service complies with a criterion. For separation
  218. // of concerns, a single Service-Level Indicator measures performance for only
  219. // one aspect of service quality, such as fraction of successful queries or
  220. // fast-enough queries.
  221. message ServiceLevelIndicator {
  222. // Service level indicators can be grouped by whether the "unit" of service
  223. // being measured is based on counts of good requests or on counts of good
  224. // time windows
  225. oneof type {
  226. // Basic SLI on a well-known service type.
  227. BasicSli basic_sli = 4;
  228. // Request-based SLIs
  229. RequestBasedSli request_based = 1;
  230. // Windows-based SLIs
  231. WindowsBasedSli windows_based = 2;
  232. }
  233. }
  234. // An SLI measuring performance on a well-known service type. Performance will
  235. // be computed on the basis of pre-defined metrics. The type of the
  236. // `service_resource` determines the metrics to use and the
  237. // `service_resource.labels` and `metric_labels` are used to construct a
  238. // monitoring filter to filter that metric down to just the data relevant to
  239. // this service.
  240. message BasicSli {
  241. // Future parameters for the availability SLI.
  242. message AvailabilityCriteria {
  243. }
  244. // Parameters for a latency threshold SLI.
  245. message LatencyCriteria {
  246. // Good service is defined to be the count of requests made to this service
  247. // that return in no more than `threshold`.
  248. google.protobuf.Duration threshold = 3;
  249. }
  250. // OPTIONAL: The set of RPCs to which this SLI is relevant. Telemetry from
  251. // other methods will not be used to calculate performance for this SLI. If
  252. // omitted, this SLI applies to all the Service's methods. For service types
  253. // that don't support breaking down by method, setting this field will result
  254. // in an error.
  255. repeated string method = 7;
  256. // OPTIONAL: The set of locations to which this SLI is relevant. Telemetry
  257. // from other locations will not be used to calculate performance for this
  258. // SLI. If omitted, this SLI applies to all locations in which the Service has
  259. // activity. For service types that don't support breaking down by location,
  260. // setting this field will result in an error.
  261. repeated string location = 8;
  262. // OPTIONAL: The set of API versions to which this SLI is relevant. Telemetry
  263. // from other API versions will not be used to calculate performance for this
  264. // SLI. If omitted, this SLI applies to all API versions. For service types
  265. // that don't support breaking down by version, setting this field will result
  266. // in an error.
  267. repeated string version = 9;
  268. // This SLI can be evaluated on the basis of availability or latency.
  269. oneof sli_criteria {
  270. // Good service is defined to be the count of requests made to this service
  271. // that return successfully.
  272. AvailabilityCriteria availability = 2;
  273. // Good service is defined to be the count of requests made to this service
  274. // that are fast enough with respect to `latency.threshold`.
  275. LatencyCriteria latency = 3;
  276. }
  277. }
  278. // Range of numerical values within `min` and `max`.
  279. message Range {
  280. // Range minimum.
  281. double min = 1;
  282. // Range maximum.
  283. double max = 2;
  284. }
  285. // Service Level Indicators for which atomic units of service are counted
  286. // directly.
  287. message RequestBasedSli {
  288. // The means to compute a ratio of `good_service` to `total_service`.
  289. oneof method {
  290. // `good_total_ratio` is used when the ratio of `good_service` to
  291. // `total_service` is computed from two `TimeSeries`.
  292. TimeSeriesRatio good_total_ratio = 1;
  293. // `distribution_cut` is used when `good_service` is a count of values
  294. // aggregated in a `Distribution` that fall into a good range. The
  295. // `total_service` is the total count of all values aggregated in the
  296. // `Distribution`.
  297. DistributionCut distribution_cut = 3;
  298. }
  299. }
  300. // A `TimeSeriesRatio` specifies two `TimeSeries` to use for computing the
  301. // `good_service / total_service` ratio. The specified `TimeSeries` must have
  302. // `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind =
  303. // DELTA` or `MetricKind = CUMULATIVE`. The `TimeSeriesRatio` must specify
  304. // exactly two of good, bad, and total, and the relationship `good_service +
  305. // bad_service = total_service` will be assumed.
  306. message TimeSeriesRatio {
  307. // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
  308. // specifying a `TimeSeries` quantifying good service provided. Must have
  309. // `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind =
  310. // DELTA` or `MetricKind = CUMULATIVE`.
  311. string good_service_filter = 4;
  312. // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
  313. // specifying a `TimeSeries` quantifying bad service, either demanded service
  314. // that was not provided or demanded service that was of inadequate quality.
  315. // Must have `ValueType = DOUBLE` or `ValueType = INT64` and must have
  316. // `MetricKind = DELTA` or `MetricKind = CUMULATIVE`.
  317. string bad_service_filter = 5;
  318. // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
  319. // specifying a `TimeSeries` quantifying total demanded service. Must have
  320. // `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind =
  321. // DELTA` or `MetricKind = CUMULATIVE`.
  322. string total_service_filter = 6;
  323. }
  324. // A `DistributionCut` defines a `TimeSeries` and thresholds used for measuring
  325. // good service and total service. The `TimeSeries` must have `ValueType =
  326. // DISTRIBUTION` and `MetricKind = DELTA` or `MetricKind = CUMULATIVE`. The
  327. // computed `good_service` will be the estimated count of values in the
  328. // `Distribution` that fall within the specified `min` and `max`.
  329. message DistributionCut {
  330. // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
  331. // specifying a `TimeSeries` aggregating values. Must have `ValueType =
  332. // DISTRIBUTION` and `MetricKind = DELTA` or `MetricKind = CUMULATIVE`.
  333. string distribution_filter = 4;
  334. // Range of values considered "good." For a one-sided range, set one bound to
  335. // an infinite value.
  336. Range range = 5;
  337. }
  338. // A `WindowsBasedSli` defines `good_service` as the count of time windows for
  339. // which the provided service was of good quality. Criteria for determining
  340. // if service was good are embedded in the `window_criterion`.
  341. message WindowsBasedSli {
  342. // A `PerformanceThreshold` is used when each window is good when that window
  343. // has a sufficiently high `performance`.
  344. message PerformanceThreshold {
  345. // The means, either a request-based SLI or a basic SLI, by which to compute
  346. // performance over a window.
  347. oneof type {
  348. // `RequestBasedSli` to evaluate to judge window quality.
  349. RequestBasedSli performance = 1;
  350. // `BasicSli` to evaluate to judge window quality.
  351. BasicSli basic_sli_performance = 3;
  352. }
  353. // If window `performance >= threshold`, the window is counted as good.
  354. double threshold = 2;
  355. }
  356. // A `MetricRange` is used when each window is good when the value x of a
  357. // single `TimeSeries` satisfies `range.min <= x <= range.max`. The provided
  358. // `TimeSeries` must have `ValueType = INT64` or `ValueType = DOUBLE` and
  359. // `MetricKind = GAUGE`.
  360. message MetricRange {
  361. // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
  362. // specifying the `TimeSeries` to use for evaluating window quality.
  363. string time_series = 1;
  364. // Range of values considered "good." For a one-sided range, set one bound
  365. // to an infinite value.
  366. Range range = 4;
  367. }
  368. // The criterion to use for evaluating window goodness.
  369. oneof window_criterion {
  370. // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
  371. // specifying a `TimeSeries` with `ValueType = BOOL`. The window is good if
  372. // any `true` values appear in the window.
  373. string good_bad_metric_filter = 5;
  374. // A window is good if its `performance` is high enough.
  375. PerformanceThreshold good_total_ratio_threshold = 2;
  376. // A window is good if the metric's value is in a good range, averaged
  377. // across returned streams.
  378. MetricRange metric_mean_in_range = 6;
  379. // A window is good if the metric's value is in a good range, summed across
  380. // returned streams.
  381. MetricRange metric_sum_in_range = 7;
  382. }
  383. // Duration over which window quality is evaluated. Must be an integer
  384. // fraction of a day and at least `60s`.
  385. google.protobuf.Duration window_period = 4;
  386. }