published on Friday, Jun 5, 2026 by Chronosphere
published on Friday, Jun 5, 2026 by Chronosphere
Evaluates a PromQL expression at a fixed interval and writes the result to a new time series. Useful for precomputing expensive queries or producing derived metrics.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Pulumi = Chronosphere.Pulumi;
return await Deployment.RunAsync(() =>
{
var upByNamespace = new Pulumi.RecordingRule("upByNamespace", new()
{
Expr = "sum by (kubernetes_namespace) (up)",
Interval = "60s",
Labels =
{
{ "owner", "platform" },
},
MetricName = "up:by_namespace",
Name = "up:by_namespace",
});
});
package main
import (
"github.com/chronosphereio/pulumi-chronosphere/sdk/go/chronosphere"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := chronosphere.NewRecordingRule(ctx, "upByNamespace", &chronosphere.RecordingRuleArgs{
Expr: pulumi.String("sum by (kubernetes_namespace) (up)"),
Interval: pulumi.String("60s"),
Labels: pulumi.StringMap{
"owner": pulumi.String("platform"),
},
MetricName: pulumi.String("up:by_namespace"),
Name: pulumi.String("up:by_namespace"),
})
if err != nil {
return err
}
return nil
})
}
Example coming soon!
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.chronosphere.RecordingRule;
import com.pulumi.chronosphere.RecordingRuleArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var upByNamespace = new RecordingRule("upByNamespace", RecordingRuleArgs.builder()
.expr("sum by (kubernetes_namespace) (up)")
.interval("60s")
.labels(Map.of("owner", "platform"))
.metricName("up:by_namespace")
.name("up:by_namespace")
.build());
}
}
import * as pulumi from "@pulumi/pulumi";
import * as chronosphere from "@pulumi-chronosphere/pulumi-chronosphere";
const upByNamespace = new chronosphere.RecordingRule("upByNamespace", {
expr: "sum by (kubernetes_namespace) (up)",
interval: "60s",
labels: {
owner: "platform",
},
metricName: "up:by_namespace",
name: "up:by_namespace",
});
import pulumi
import pulumi_chronosphere as chronosphere
up_by_namespace = chronosphere.RecordingRule("upByNamespace",
expr="sum by (kubernetes_namespace) (up)",
interval="60s",
labels={
"owner": "platform",
},
metric_name="up:by_namespace",
name="up:by_namespace")
resources:
upByNamespace:
type: chronosphere:RecordingRule
properties:
expr: sum by (kubernetes_namespace) (up)
interval: 60s
labels:
owner: platform
metricName: up:by_namespace
name: up:by_namespace
Create RecordingRule Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new RecordingRule(name: string, args: RecordingRuleArgs, opts?: CustomResourceOptions);@overload
def RecordingRule(resource_name: str,
args: RecordingRuleArgs,
opts: Optional[ResourceOptions] = None)
@overload
def RecordingRule(resource_name: str,
opts: Optional[ResourceOptions] = None,
expr: Optional[str] = None,
name: Optional[str] = None,
bucket_id: Optional[str] = None,
execution_group: Optional[str] = None,
execution_mode: Optional[str] = None,
interval: Optional[str] = None,
labels: Optional[Mapping[str, str]] = None,
metric_name: Optional[str] = None,
slug: Optional[str] = None)func NewRecordingRule(ctx *Context, name string, args RecordingRuleArgs, opts ...ResourceOption) (*RecordingRule, error)public RecordingRule(string name, RecordingRuleArgs args, CustomResourceOptions? opts = null)
public RecordingRule(String name, RecordingRuleArgs args)
public RecordingRule(String name, RecordingRuleArgs args, CustomResourceOptions options)
type: chronosphere:RecordingRule
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "chronosphere_recordingrule" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args RecordingRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args RecordingRuleArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args RecordingRuleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RecordingRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RecordingRuleArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var recordingRuleResource = new Pulumi.RecordingRule("recordingRuleResource", new()
{
Expr = "string",
Name = "string",
BucketId = "string",
ExecutionGroup = "string",
ExecutionMode = "string",
Interval = "string",
Labels =
{
{ "string", "string" },
},
MetricName = "string",
Slug = "string",
});
example, err := chronosphere.NewRecordingRule(ctx, "recordingRuleResource", &chronosphere.RecordingRuleArgs{
Expr: pulumi.String("string"),
Name: pulumi.String("string"),
BucketId: pulumi.String("string"),
ExecutionGroup: pulumi.String("string"),
ExecutionMode: pulumi.String("string"),
Interval: pulumi.String("string"),
Labels: pulumi.StringMap{
"string": pulumi.String("string"),
},
MetricName: pulumi.String("string"),
Slug: pulumi.String("string"),
})
resource "chronosphere_recordingrule" "recordingRuleResource" {
expr = "string"
name = "string"
bucket_id = "string"
execution_group = "string"
execution_mode = "string"
interval = "string"
labels = {
"string" = "string"
}
metric_name = "string"
slug = "string"
}
var recordingRuleResource = new RecordingRule("recordingRuleResource", RecordingRuleArgs.builder()
.expr("string")
.name("string")
.bucketId("string")
.executionGroup("string")
.executionMode("string")
.interval("string")
.labels(Map.of("string", "string"))
.metricName("string")
.slug("string")
.build());
recording_rule_resource = chronosphere.RecordingRule("recordingRuleResource",
expr="string",
name="string",
bucket_id="string",
execution_group="string",
execution_mode="string",
interval="string",
labels={
"string": "string",
},
metric_name="string",
slug="string")
const recordingRuleResource = new chronosphere.RecordingRule("recordingRuleResource", {
expr: "string",
name: "string",
bucketId: "string",
executionGroup: "string",
executionMode: "string",
interval: "string",
labels: {
string: "string",
},
metricName: "string",
slug: "string",
});
type: chronosphere:RecordingRule
properties:
bucketId: string
executionGroup: string
executionMode: string
expr: string
interval: string
labels:
string: string
metricName: string
name: string
slug: string
RecordingRule Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The RecordingRule resource accepts the following input properties:
- Expr string
- PromQL expression evaluated at each interval. The result is written to a new series named by
metric_name(ornameif unset). - Name string
- Display name of the recording rule. Can be changed after creation.
- Bucket
Id string - ID of the bucket the recording rule belongs to. At least one of
bucket_idorexecution_groupmust be set; if both are set their values must match. - Execution
Group string - Slug of the execution group in which the rule is evaluated. Rules in the same group run sequentially at the configured interval; all rules in a group must finish before the next iteration starts. At least one of
bucket_idorexecution_groupmust be set. - Execution
Mode string - Execution mode controlling whether the recording rule is active.
- Interval string
- Evaluation interval (e.g.
30s,1m). Defaults to60swhen unset. - Labels Dictionary<string, string>
- Key/value labels added to every series produced by this recording rule.
- Metric
Name string - Name of the output time series produced by
expr. Must be a valid metric name. Defaults tonameif omitted. - Slug string
- Stable identifier for the recording rule. Generated from
nameif omitted. Immutable after creation.
- Expr string
- PromQL expression evaluated at each interval. The result is written to a new series named by
metric_name(ornameif unset). - Name string
- Display name of the recording rule. Can be changed after creation.
- Bucket
Id string - ID of the bucket the recording rule belongs to. At least one of
bucket_idorexecution_groupmust be set; if both are set their values must match. - Execution
Group string - Slug of the execution group in which the rule is evaluated. Rules in the same group run sequentially at the configured interval; all rules in a group must finish before the next iteration starts. At least one of
bucket_idorexecution_groupmust be set. - Execution
Mode string - Execution mode controlling whether the recording rule is active.
- Interval string
- Evaluation interval (e.g.
30s,1m). Defaults to60swhen unset. - Labels map[string]string
- Key/value labels added to every series produced by this recording rule.
- Metric
Name string - Name of the output time series produced by
expr. Must be a valid metric name. Defaults tonameif omitted. - Slug string
- Stable identifier for the recording rule. Generated from
nameif omitted. Immutable after creation.
- expr string
- PromQL expression evaluated at each interval. The result is written to a new series named by
metric_name(ornameif unset). - name string
- Display name of the recording rule. Can be changed after creation.
- bucket_
id string - ID of the bucket the recording rule belongs to. At least one of
bucket_idorexecution_groupmust be set; if both are set their values must match. - execution_
group string - Slug of the execution group in which the rule is evaluated. Rules in the same group run sequentially at the configured interval; all rules in a group must finish before the next iteration starts. At least one of
bucket_idorexecution_groupmust be set. - execution_
mode string - Execution mode controlling whether the recording rule is active.
- interval string
- Evaluation interval (e.g.
30s,1m). Defaults to60swhen unset. - labels map(string)
- Key/value labels added to every series produced by this recording rule.
- metric_
name string - Name of the output time series produced by
expr. Must be a valid metric name. Defaults tonameif omitted. - slug string
- Stable identifier for the recording rule. Generated from
nameif omitted. Immutable after creation.
- expr String
- PromQL expression evaluated at each interval. The result is written to a new series named by
metric_name(ornameif unset). - name String
- Display name of the recording rule. Can be changed after creation.
- bucket
Id String - ID of the bucket the recording rule belongs to. At least one of
bucket_idorexecution_groupmust be set; if both are set their values must match. - execution
Group String - Slug of the execution group in which the rule is evaluated. Rules in the same group run sequentially at the configured interval; all rules in a group must finish before the next iteration starts. At least one of
bucket_idorexecution_groupmust be set. - execution
Mode String - Execution mode controlling whether the recording rule is active.
- interval String
- Evaluation interval (e.g.
30s,1m). Defaults to60swhen unset. - labels Map<String,String>
- Key/value labels added to every series produced by this recording rule.
- metric
Name String - Name of the output time series produced by
expr. Must be a valid metric name. Defaults tonameif omitted. - slug String
- Stable identifier for the recording rule. Generated from
nameif omitted. Immutable after creation.
- expr string
- PromQL expression evaluated at each interval. The result is written to a new series named by
metric_name(ornameif unset). - name string
- Display name of the recording rule. Can be changed after creation.
- bucket
Id string - ID of the bucket the recording rule belongs to. At least one of
bucket_idorexecution_groupmust be set; if both are set their values must match. - execution
Group string - Slug of the execution group in which the rule is evaluated. Rules in the same group run sequentially at the configured interval; all rules in a group must finish before the next iteration starts. At least one of
bucket_idorexecution_groupmust be set. - execution
Mode string - Execution mode controlling whether the recording rule is active.
- interval string
- Evaluation interval (e.g.
30s,1m). Defaults to60swhen unset. - labels {[key: string]: string}
- Key/value labels added to every series produced by this recording rule.
- metric
Name string - Name of the output time series produced by
expr. Must be a valid metric name. Defaults tonameif omitted. - slug string
- Stable identifier for the recording rule. Generated from
nameif omitted. Immutable after creation.
- expr str
- PromQL expression evaluated at each interval. The result is written to a new series named by
metric_name(ornameif unset). - name str
- Display name of the recording rule. Can be changed after creation.
- bucket_
id str - ID of the bucket the recording rule belongs to. At least one of
bucket_idorexecution_groupmust be set; if both are set their values must match. - execution_
group str - Slug of the execution group in which the rule is evaluated. Rules in the same group run sequentially at the configured interval; all rules in a group must finish before the next iteration starts. At least one of
bucket_idorexecution_groupmust be set. - execution_
mode str - Execution mode controlling whether the recording rule is active.
- interval str
- Evaluation interval (e.g.
30s,1m). Defaults to60swhen unset. - labels Mapping[str, str]
- Key/value labels added to every series produced by this recording rule.
- metric_
name str - Name of the output time series produced by
expr. Must be a valid metric name. Defaults tonameif omitted. - slug str
- Stable identifier for the recording rule. Generated from
nameif omitted. Immutable after creation.
- expr String
- PromQL expression evaluated at each interval. The result is written to a new series named by
metric_name(ornameif unset). - name String
- Display name of the recording rule. Can be changed after creation.
- bucket
Id String - ID of the bucket the recording rule belongs to. At least one of
bucket_idorexecution_groupmust be set; if both are set their values must match. - execution
Group String - Slug of the execution group in which the rule is evaluated. Rules in the same group run sequentially at the configured interval; all rules in a group must finish before the next iteration starts. At least one of
bucket_idorexecution_groupmust be set. - execution
Mode String - Execution mode controlling whether the recording rule is active.
- interval String
- Evaluation interval (e.g.
30s,1m). Defaults to60swhen unset. - labels Map<String>
- Key/value labels added to every series produced by this recording rule.
- metric
Name String - Name of the output time series produced by
expr. Must be a valid metric name. Defaults tonameif omitted. - slug String
- Stable identifier for the recording rule. Generated from
nameif omitted. Immutable after creation.
Outputs
All input properties are implicitly available as output properties. Additionally, the RecordingRule resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing RecordingRule Resource
Get an existing RecordingRule resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: RecordingRuleState, opts?: CustomResourceOptions): RecordingRule@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
bucket_id: Optional[str] = None,
execution_group: Optional[str] = None,
execution_mode: Optional[str] = None,
expr: Optional[str] = None,
interval: Optional[str] = None,
labels: Optional[Mapping[str, str]] = None,
metric_name: Optional[str] = None,
name: Optional[str] = None,
slug: Optional[str] = None) -> RecordingRulefunc GetRecordingRule(ctx *Context, name string, id IDInput, state *RecordingRuleState, opts ...ResourceOption) (*RecordingRule, error)public static RecordingRule Get(string name, Input<string> id, RecordingRuleState? state, CustomResourceOptions? opts = null)public static RecordingRule get(String name, Output<String> id, RecordingRuleState state, CustomResourceOptions options)resources: _: type: chronosphere:RecordingRule get: id: ${id}import {
to = chronosphere_recordingrule.example
id = "${id}"
}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Bucket
Id string - ID of the bucket the recording rule belongs to. At least one of
bucket_idorexecution_groupmust be set; if both are set their values must match. - Execution
Group string - Slug of the execution group in which the rule is evaluated. Rules in the same group run sequentially at the configured interval; all rules in a group must finish before the next iteration starts. At least one of
bucket_idorexecution_groupmust be set. - Execution
Mode string - Execution mode controlling whether the recording rule is active.
- Expr string
- PromQL expression evaluated at each interval. The result is written to a new series named by
metric_name(ornameif unset). - Interval string
- Evaluation interval (e.g.
30s,1m). Defaults to60swhen unset. - Labels Dictionary<string, string>
- Key/value labels added to every series produced by this recording rule.
- Metric
Name string - Name of the output time series produced by
expr. Must be a valid metric name. Defaults tonameif omitted. - Name string
- Display name of the recording rule. Can be changed after creation.
- Slug string
- Stable identifier for the recording rule. Generated from
nameif omitted. Immutable after creation.
- Bucket
Id string - ID of the bucket the recording rule belongs to. At least one of
bucket_idorexecution_groupmust be set; if both are set their values must match. - Execution
Group string - Slug of the execution group in which the rule is evaluated. Rules in the same group run sequentially at the configured interval; all rules in a group must finish before the next iteration starts. At least one of
bucket_idorexecution_groupmust be set. - Execution
Mode string - Execution mode controlling whether the recording rule is active.
- Expr string
- PromQL expression evaluated at each interval. The result is written to a new series named by
metric_name(ornameif unset). - Interval string
- Evaluation interval (e.g.
30s,1m). Defaults to60swhen unset. - Labels map[string]string
- Key/value labels added to every series produced by this recording rule.
- Metric
Name string - Name of the output time series produced by
expr. Must be a valid metric name. Defaults tonameif omitted. - Name string
- Display name of the recording rule. Can be changed after creation.
- Slug string
- Stable identifier for the recording rule. Generated from
nameif omitted. Immutable after creation.
- bucket_
id string - ID of the bucket the recording rule belongs to. At least one of
bucket_idorexecution_groupmust be set; if both are set their values must match. - execution_
group string - Slug of the execution group in which the rule is evaluated. Rules in the same group run sequentially at the configured interval; all rules in a group must finish before the next iteration starts. At least one of
bucket_idorexecution_groupmust be set. - execution_
mode string - Execution mode controlling whether the recording rule is active.
- expr string
- PromQL expression evaluated at each interval. The result is written to a new series named by
metric_name(ornameif unset). - interval string
- Evaluation interval (e.g.
30s,1m). Defaults to60swhen unset. - labels map(string)
- Key/value labels added to every series produced by this recording rule.
- metric_
name string - Name of the output time series produced by
expr. Must be a valid metric name. Defaults tonameif omitted. - name string
- Display name of the recording rule. Can be changed after creation.
- slug string
- Stable identifier for the recording rule. Generated from
nameif omitted. Immutable after creation.
- bucket
Id String - ID of the bucket the recording rule belongs to. At least one of
bucket_idorexecution_groupmust be set; if both are set their values must match. - execution
Group String - Slug of the execution group in which the rule is evaluated. Rules in the same group run sequentially at the configured interval; all rules in a group must finish before the next iteration starts. At least one of
bucket_idorexecution_groupmust be set. - execution
Mode String - Execution mode controlling whether the recording rule is active.
- expr String
- PromQL expression evaluated at each interval. The result is written to a new series named by
metric_name(ornameif unset). - interval String
- Evaluation interval (e.g.
30s,1m). Defaults to60swhen unset. - labels Map<String,String>
- Key/value labels added to every series produced by this recording rule.
- metric
Name String - Name of the output time series produced by
expr. Must be a valid metric name. Defaults tonameif omitted. - name String
- Display name of the recording rule. Can be changed after creation.
- slug String
- Stable identifier for the recording rule. Generated from
nameif omitted. Immutable after creation.
- bucket
Id string - ID of the bucket the recording rule belongs to. At least one of
bucket_idorexecution_groupmust be set; if both are set their values must match. - execution
Group string - Slug of the execution group in which the rule is evaluated. Rules in the same group run sequentially at the configured interval; all rules in a group must finish before the next iteration starts. At least one of
bucket_idorexecution_groupmust be set. - execution
Mode string - Execution mode controlling whether the recording rule is active.
- expr string
- PromQL expression evaluated at each interval. The result is written to a new series named by
metric_name(ornameif unset). - interval string
- Evaluation interval (e.g.
30s,1m). Defaults to60swhen unset. - labels {[key: string]: string}
- Key/value labels added to every series produced by this recording rule.
- metric
Name string - Name of the output time series produced by
expr. Must be a valid metric name. Defaults tonameif omitted. - name string
- Display name of the recording rule. Can be changed after creation.
- slug string
- Stable identifier for the recording rule. Generated from
nameif omitted. Immutable after creation.
- bucket_
id str - ID of the bucket the recording rule belongs to. At least one of
bucket_idorexecution_groupmust be set; if both are set their values must match. - execution_
group str - Slug of the execution group in which the rule is evaluated. Rules in the same group run sequentially at the configured interval; all rules in a group must finish before the next iteration starts. At least one of
bucket_idorexecution_groupmust be set. - execution_
mode str - Execution mode controlling whether the recording rule is active.
- expr str
- PromQL expression evaluated at each interval. The result is written to a new series named by
metric_name(ornameif unset). - interval str
- Evaluation interval (e.g.
30s,1m). Defaults to60swhen unset. - labels Mapping[str, str]
- Key/value labels added to every series produced by this recording rule.
- metric_
name str - Name of the output time series produced by
expr. Must be a valid metric name. Defaults tonameif omitted. - name str
- Display name of the recording rule. Can be changed after creation.
- slug str
- Stable identifier for the recording rule. Generated from
nameif omitted. Immutable after creation.
- bucket
Id String - ID of the bucket the recording rule belongs to. At least one of
bucket_idorexecution_groupmust be set; if both are set their values must match. - execution
Group String - Slug of the execution group in which the rule is evaluated. Rules in the same group run sequentially at the configured interval; all rules in a group must finish before the next iteration starts. At least one of
bucket_idorexecution_groupmust be set. - execution
Mode String - Execution mode controlling whether the recording rule is active.
- expr String
- PromQL expression evaluated at each interval. The result is written to a new series named by
metric_name(ornameif unset). - interval String
- Evaluation interval (e.g.
30s,1m). Defaults to60swhen unset. - labels Map<String>
- Key/value labels added to every series produced by this recording rule.
- metric
Name String - Name of the output time series produced by
expr. Must be a valid metric name. Defaults tonameif omitted. - name String
- Display name of the recording rule. Can be changed after creation.
- slug String
- Stable identifier for the recording rule. Generated from
nameif omitted. Immutable after creation.
Package Details
- Repository
- chronosphere chronosphereio/pulumi-chronosphere
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
chronosphereTerraform Provider.
published on Friday, Jun 5, 2026 by Chronosphere