UNPKG

@pulumiverse/grafana

Version:

A Pulumi package for creating and managing grafana.

146 lines 5.74 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.OutlierDetector = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * An outlier detector monitors the results of a query and reports when its values are outside normal bands. * * The normal band is configured by choice of algorithm, its sensitivity and other configuration. * * Visit https://grafana.com/docs/grafana-cloud/machine-learning/outlier-detection/ for more details. * * ## Example Usage * * ### DBSCAN Outlier Detector * * This outlier detector uses the DBSCAN algorithm to detect outliers. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as grafana from "@pulumiverse/grafana"; * * const myDbscanOutlierDetector = new grafana.machinelearning.OutlierDetector("my_dbscan_outlier_detector", { * name: "My DBSCAN outlier detector", * description: "My DBSCAN Outlier Detector", * metric: "tf_test_dbscan_job", * datasourceType: "prometheus", * datasourceUid: "AbCd12345", * queryParams: { * expr: "grafanacloud_grafana_instance_active_user_count", * }, * interval: 300, * algorithm: { * name: "dbscan", * sensitivity: 0.5, * config: { * epsilon: 1, * }, * }, * }); * ``` * * ### MAD Outlier Detector * * This outlier detector uses the Median Absolute Deviation (MAD) algorithm to detect outliers. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as grafana from "@pulumiverse/grafana"; * * const myMadOutlierDetector = new grafana.machinelearning.OutlierDetector("my_mad_outlier_detector", { * name: "My MAD outlier detector", * description: "My MAD Outlier Detector", * metric: "tf_test_mad_job", * datasourceType: "prometheus", * datasourceUid: "AbCd12345", * queryParams: { * expr: "grafanacloud_grafana_instance_active_user_count", * }, * interval: 300, * algorithm: { * name: "mad", * sensitivity: 0.7, * }, * }); * ``` * * ## Import * * ```sh * terraform import grafana_machine_learning_outlier_detector.name "{{ id }}" * ``` */ class OutlierDetector extends pulumi.CustomResource { /** * Get an existing OutlierDetector 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, id, state, opts) { return new OutlierDetector(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of OutlierDetector. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === OutlierDetector.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["algorithm"] = state?.algorithm; resourceInputs["datasourceType"] = state?.datasourceType; resourceInputs["datasourceUid"] = state?.datasourceUid; resourceInputs["description"] = state?.description; resourceInputs["interval"] = state?.interval; resourceInputs["metric"] = state?.metric; resourceInputs["name"] = state?.name; resourceInputs["queryParams"] = state?.queryParams; } else { const args = argsOrState; if (args?.algorithm === undefined && !opts.urn) { throw new Error("Missing required property 'algorithm'"); } if (args?.datasourceType === undefined && !opts.urn) { throw new Error("Missing required property 'datasourceType'"); } if (args?.datasourceUid === undefined && !opts.urn) { throw new Error("Missing required property 'datasourceUid'"); } if (args?.metric === undefined && !opts.urn) { throw new Error("Missing required property 'metric'"); } if (args?.queryParams === undefined && !opts.urn) { throw new Error("Missing required property 'queryParams'"); } resourceInputs["algorithm"] = args?.algorithm; resourceInputs["datasourceType"] = args?.datasourceType; resourceInputs["datasourceUid"] = args?.datasourceUid; resourceInputs["description"] = args?.description; resourceInputs["interval"] = args?.interval; resourceInputs["metric"] = args?.metric; resourceInputs["name"] = args?.name; resourceInputs["queryParams"] = args?.queryParams; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(OutlierDetector.__pulumiType, name, resourceInputs, opts); } } exports.OutlierDetector = OutlierDetector; /** @internal */ OutlierDetector.__pulumiType = 'grafana:machineLearning/outlierDetector:OutlierDetector'; //# sourceMappingURL=outlierDetector.js.map