import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * A Service-Level Objective (SLO) describes the level of desired good * service. It consists of a service-level indicator (SLI), a performance * goal, and a period over which the objective is to be evaluated against * that goal. The SLO can use SLIs defined in a number of different manners. * Typical SLOs might include "99% of requests in each rolling week have * latency below 200 milliseconds" or "99.5% of requests in each calendar * month return successfully." * * To get more information about Slo, see: * * * [API documentation](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services.serviceLevelObjectives) * * How-to Guides * * [Monitoring API Documentation](https://cloud.google.com/monitoring/api/v3/) * * [Service Monitoring](https://cloud.google.com/monitoring/service-monitoring) * * ## Example Usage * * ### Monitoring Slo Appengine * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = gcp.monitoring.getAppEngineService({ * moduleId: "default", * }); * const appengSlo = new gcp.monitoring.Slo("appeng_slo", { * service: _default.then(_default => _default.serviceId), * sloId: "ae-slo", * displayName: "Test SLO for App Engine", * goal: 0.9, * calendarPeriod: "DAY", * basicSli: { * latency: { * threshold: "1s", * }, * }, * userLabels: { * my_key: "my_value", * my_other_key: "my_other_value", * }, * }); * ``` * ### Monitoring Slo Request Based * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const customsrv = new gcp.monitoring.CustomService("customsrv", { * serviceId: "custom-srv-request-slos", * displayName: "My Custom Service", * }); * const requestBasedSlo = new gcp.monitoring.Slo("request_based_slo", { * service: customsrv.serviceId, * sloId: "consumed-api-slo", * displayName: "Test SLO with request based SLI (good total ratio)", * goal: 0.9, * rollingPeriodDays: 30, * requestBasedSli: { * distributionCut: { * distributionFilter: "metric.type=\"serviceruntime.googleapis.com/api/request_latencies\" resource.type=\"api\" ", * range: { * max: 0.5, * }, * }, * }, * }); * ``` * ### Monitoring Slo Windows Based Good Bad Metric Filter * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * import * as std from "@pulumi/std"; * * const customsrv = new gcp.monitoring.CustomService("customsrv", { * serviceId: "custom-srv-windows-slos", * displayName: "My Custom Service", * }); * const windowsBased = new gcp.monitoring.Slo("windows_based", { * service: customsrv.serviceId, * displayName: "Test SLO with window based SLI", * goal: 0.95, * calendarPeriod: "FORTNIGHT", * windowsBasedSli: { * windowPeriod: "400s", * goodBadMetricFilter: std.join({ * separator: " AND ", * input: [ * "metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\"", * "resource.type=\"uptime_url\"", * ], * }).then(invoke => invoke.result), * }, * }); * ``` * ### Monitoring Slo Windows Based Metric Mean * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * import * as std from "@pulumi/std"; * * const customsrv = new gcp.monitoring.CustomService("customsrv", { * serviceId: "custom-srv-windows-slos", * displayName: "My Custom Service", * }); * const windowsBased = new gcp.monitoring.Slo("windows_based", { * service: customsrv.serviceId, * displayName: "Test SLO with window based SLI", * goal: 0.9, * rollingPeriodDays: 20, * windowsBasedSli: { * windowPeriod: "600s", * metricMeanInRange: { * timeSeries: std.join({ * separator: " AND ", * input: [ * "metric.type=\"agent.googleapis.com/cassandra/client_request/latency/95p\"", * "resource.type=\"gce_instance\"", * ], * }).then(invoke => invoke.result), * range: { * max: 5, * }, * }, * }, * }); * ``` * ### Monitoring Slo Windows Based Metric Sum * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * import * as std from "@pulumi/std"; * * const customsrv = new gcp.monitoring.CustomService("customsrv", { * serviceId: "custom-srv-windows-slos", * displayName: "My Custom Service", * }); * const windowsBased = new gcp.monitoring.Slo("windows_based", { * service: customsrv.serviceId, * displayName: "Test SLO with window based SLI", * goal: 0.9, * rollingPeriodDays: 20, * windowsBasedSli: { * windowPeriod: "400s", * metricSumInRange: { * timeSeries: std.join({ * separator: " AND ", * input: [ * "metric.type=\"monitoring.googleapis.com/uptime_check/request_latency\"", * "resource.type=\"uptime_url\"", * ], * }).then(invoke => invoke.result), * range: { * max: 5000, * }, * }, * }, * }); * ``` * ### Monitoring Slo Windows Based Ratio Threshold * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * import * as std from "@pulumi/std"; * * const customsrv = new gcp.monitoring.CustomService("customsrv", { * serviceId: "custom-srv-windows-slos", * displayName: "My Custom Service", * }); * const windowsBased = new gcp.monitoring.Slo("windows_based", { * service: customsrv.serviceId, * displayName: "Test SLO with window based SLI", * goal: 0.9, * rollingPeriodDays: 20, * windowsBasedSli: { * windowPeriod: "100s", * goodTotalRatioThreshold: { * threshold: 0.1, * performance: { * distributionCut: { * distributionFilter: std.join({ * separator: " AND ", * input: [ * "metric.type=\"serviceruntime.googleapis.com/api/request_latencies\"", * "resource.type=\"consumed_api\"", * ], * }).then(invoke => invoke.result), * range: { * min: 1, * max: 9, * }, * }, * }, * }, * }, * }); * ``` * * ## Import * * Slo can be imported using any of these accepted formats: * * * `{{project}}/{{name}}` * * * `{{project}} {{name}}` * * * `{{name}}` * * When using the `pulumi import` command, Slo can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:monitoring/slo:Slo default {{project}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:monitoring/slo:Slo default "{{project}} {{name}}" * ``` * * ```sh * $ pulumi import gcp:monitoring/slo:Slo default {{name}} * ``` */ export declare class Slo extends pulumi.CustomResource { /** * Get an existing Slo resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input, state?: SloState, opts?: pulumi.CustomResourceOptions): Slo; /** * Returns true if the given object is an instance of Slo. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Slo; /** * Basic Service-Level Indicator (SLI) on a well-known service type. * Performance will be computed on the basis of pre-defined metrics. * SLIs are used to measure and calculate the quality of the Service's * performance with respect to a single aspect of service quality. * Exactly one of the following must be set: * `basicSli`, `requestBasedSli`, `windowsBasedSli` * Structure is documented below. */ readonly basicSli: pulumi.Output; /** * A calendar period, semantically "since the start of the current * ". * Possible values are: `DAY`, `WEEK`, `FORTNIGHT`, `MONTH`. */ readonly calendarPeriod: pulumi.Output; /** * Name used for UI elements listing this SLO. */ readonly displayName: pulumi.Output; /** * The fraction of service that must be good in order for this objective * to be met. 0 < goal <= 0.999 */ readonly goal: pulumi.Output; /** * The full resource name for this service. The syntax is: * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] */ readonly name: pulumi.Output; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output; /** * A request-based SLI defines a SLI for which atomic units of * service are counted directly. * A SLI describes a good service. * It is used to measure and calculate the quality of the Service's * performance with respect to a single aspect of service quality. * Exactly one of the following must be set: * `basicSli`, `requestBasedSli`, `windowsBasedSli` * Structure is documented below. */ readonly requestBasedSli: pulumi.Output; /** * A rolling time period, semantically "in the past X days". * Must be between 1 to 30 days, inclusive. */ readonly rollingPeriodDays: pulumi.Output; /** * ID of the service to which this SLO belongs. */ readonly service: pulumi.Output; /** * The id to use for this ServiceLevelObjective. If omitted, an id will be generated instead. */ readonly sloId: pulumi.Output; /** * This field is intended to be used for organizing and identifying the AlertPolicy * objects.The field can contain up to 64 entries. Each key and value is limited * to 63 Unicode characters or 128 bytes, whichever is smaller. Labels and values * can contain only lowercase letters, numerals, underscores, and dashes. Keys * must begin with a letter. */ readonly userLabels: pulumi.Output<{ [key: string]: string; } | undefined>; /** * A windows-based SLI defines the criteria for time windows. * goodService is defined based off the count of these time windows * for which the provided service was of good quality. * A SLI describes a good service. It is used to measure and calculate * the quality of the Service's performance with respect to a single * aspect of service quality. * Exactly one of the following must be set: * `basicSli`, `requestBasedSli`, `windowsBasedSli` * Structure is documented below. */ readonly windowsBasedSli: pulumi.Output; /** * Create a Slo resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: SloArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Slo resources. */ export interface SloState { /** * Basic Service-Level Indicator (SLI) on a well-known service type. * Performance will be computed on the basis of pre-defined metrics. * SLIs are used to measure and calculate the quality of the Service's * performance with respect to a single aspect of service quality. * Exactly one of the following must be set: * `basicSli`, `requestBasedSli`, `windowsBasedSli` * Structure is documented below. */ basicSli?: pulumi.Input; /** * A calendar period, semantically "since the start of the current * ". * Possible values are: `DAY`, `WEEK`, `FORTNIGHT`, `MONTH`. */ calendarPeriod?: pulumi.Input; /** * Name used for UI elements listing this SLO. */ displayName?: pulumi.Input; /** * The fraction of service that must be good in order for this objective * to be met. 0 < goal <= 0.999 */ goal?: pulumi.Input; /** * The full resource name for this service. The syntax is: * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] */ name?: pulumi.Input; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * A request-based SLI defines a SLI for which atomic units of * service are counted directly. * A SLI describes a good service. * It is used to measure and calculate the quality of the Service's * performance with respect to a single aspect of service quality. * Exactly one of the following must be set: * `basicSli`, `requestBasedSli`, `windowsBasedSli` * Structure is documented below. */ requestBasedSli?: pulumi.Input; /** * A rolling time period, semantically "in the past X days". * Must be between 1 to 30 days, inclusive. */ rollingPeriodDays?: pulumi.Input; /** * ID of the service to which this SLO belongs. */ service?: pulumi.Input; /** * The id to use for this ServiceLevelObjective. If omitted, an id will be generated instead. */ sloId?: pulumi.Input; /** * This field is intended to be used for organizing and identifying the AlertPolicy * objects.The field can contain up to 64 entries. Each key and value is limited * to 63 Unicode characters or 128 bytes, whichever is smaller. Labels and values * can contain only lowercase letters, numerals, underscores, and dashes. Keys * must begin with a letter. */ userLabels?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * A windows-based SLI defines the criteria for time windows. * goodService is defined based off the count of these time windows * for which the provided service was of good quality. * A SLI describes a good service. It is used to measure and calculate * the quality of the Service's performance with respect to a single * aspect of service quality. * Exactly one of the following must be set: * `basicSli`, `requestBasedSli`, `windowsBasedSli` * Structure is documented below. */ windowsBasedSli?: pulumi.Input; } /** * The set of arguments for constructing a Slo resource. */ export interface SloArgs { /** * Basic Service-Level Indicator (SLI) on a well-known service type. * Performance will be computed on the basis of pre-defined metrics. * SLIs are used to measure and calculate the quality of the Service's * performance with respect to a single aspect of service quality. * Exactly one of the following must be set: * `basicSli`, `requestBasedSli`, `windowsBasedSli` * Structure is documented below. */ basicSli?: pulumi.Input; /** * A calendar period, semantically "since the start of the current * ". * Possible values are: `DAY`, `WEEK`, `FORTNIGHT`, `MONTH`. */ calendarPeriod?: pulumi.Input; /** * Name used for UI elements listing this SLO. */ displayName?: pulumi.Input; /** * The fraction of service that must be good in order for this objective * to be met. 0 < goal <= 0.999 */ goal: pulumi.Input; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * A request-based SLI defines a SLI for which atomic units of * service are counted directly. * A SLI describes a good service. * It is used to measure and calculate the quality of the Service's * performance with respect to a single aspect of service quality. * Exactly one of the following must be set: * `basicSli`, `requestBasedSli`, `windowsBasedSli` * Structure is documented below. */ requestBasedSli?: pulumi.Input; /** * A rolling time period, semantically "in the past X days". * Must be between 1 to 30 days, inclusive. */ rollingPeriodDays?: pulumi.Input; /** * ID of the service to which this SLO belongs. */ service: pulumi.Input; /** * The id to use for this ServiceLevelObjective. If omitted, an id will be generated instead. */ sloId?: pulumi.Input; /** * This field is intended to be used for organizing and identifying the AlertPolicy * objects.The field can contain up to 64 entries. Each key and value is limited * to 63 Unicode characters or 128 bytes, whichever is smaller. Labels and values * can contain only lowercase letters, numerals, underscores, and dashes. Keys * must begin with a letter. */ userLabels?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * A windows-based SLI defines the criteria for time windows. * goodService is defined based off the count of these time windows * for which the provided service was of good quality. * A SLI describes a good service. It is used to measure and calculate * the quality of the Service's performance with respect to a single * aspect of service quality. * Exactly one of the following must be set: * `basicSli`, `requestBasedSli`, `windowsBasedSli` * Structure is documented below. */ windowsBasedSli?: pulumi.Input; }