published on Friday, Jun 5, 2026 by Chronosphere
published on Friday, Jun 5, 2026 by Chronosphere
Selects metrics by label filter and either drops them or applies an aggregation policy controlling their storage interval and aggregation function. Use chronosphere.DropRule for drop-only rules and chronosphere.RollupRule for label-reducing aggregations.
Example Usage
Example coming soon!
Example coming soon!
Example coming soon!
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.chronosphere.Bucket;
import com.pulumi.chronosphere.BucketArgs;
import com.pulumi.chronosphere.MappingRule;
import com.pulumi.chronosphere.MappingRuleArgs;
import com.pulumi.chronosphere.inputs.MappingRuleStoragePolicyArgs;
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 bucket = new Bucket("bucket", BucketArgs.builder()
.name("Platform")
.build());
var httpRequestDuration = new MappingRule("httpRequestDuration", MappingRuleArgs.builder()
.name("http request duration")
.bucketId(bucket.id())
.filter("__name__:http_request_duration k8s_pod:*")
.aggregations("LAST")
.storagePolicy(MappingRuleStoragePolicyArgs.builder()
.resolution("30s")
.retention("120h")
.build())
.mode("PREVIEW")
.build());
}
}
Example coming soon!
Example coming soon!
resources:
bucket:
type: chronosphere:Bucket
properties:
name: Platform
httpRequestDuration:
type: chronosphere:MappingRule
properties:
name: http request duration
bucketId: ${bucket.id}
filter: __name__:http_request_duration k8s_pod:*
# See https://docs.chronosphere.io/control/shaping/shape-metrics/rules/rollup
# # for supported aggregation operations.
aggregations:
- LAST
storagePolicy:
resolution: 30s
retention: 120h
mode: PREVIEW
Create MappingRule Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new MappingRule(name: string, args: MappingRuleArgs, opts?: CustomResourceOptions);@overload
def MappingRule(resource_name: str,
args: MappingRuleArgs,
opts: Optional[ResourceOptions] = None)
@overload
def MappingRule(resource_name: str,
opts: Optional[ResourceOptions] = None,
filter: Optional[str] = None,
name: Optional[str] = None,
aggregations: Optional[str] = None,
bucket_id: Optional[str] = None,
drop: Optional[bool] = None,
drop_timestamp: Optional[bool] = None,
interval: Optional[str] = None,
mode: Optional[str] = None,
slug: Optional[str] = None,
storage_policy: Optional[MappingRuleStoragePolicyArgs] = None)func NewMappingRule(ctx *Context, name string, args MappingRuleArgs, opts ...ResourceOption) (*MappingRule, error)public MappingRule(string name, MappingRuleArgs args, CustomResourceOptions? opts = null)
public MappingRule(String name, MappingRuleArgs args)
public MappingRule(String name, MappingRuleArgs args, CustomResourceOptions options)
type: chronosphere:MappingRule
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "chronosphere_mappingrule" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args MappingRuleArgs
- 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 MappingRuleArgs
- 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 MappingRuleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args MappingRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args MappingRuleArgs
- 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 mappingRuleResource = new Pulumi.MappingRule("mappingRuleResource", new()
{
Filter = "string",
Name = "string",
Aggregations = "string",
BucketId = "string",
Drop = false,
Interval = "string",
Mode = "string",
Slug = "string",
});
example, err := chronosphere.NewMappingRule(ctx, "mappingRuleResource", &chronosphere.MappingRuleArgs{
Filter: pulumi.String("string"),
Name: pulumi.String("string"),
Aggregations: pulumi.String("string"),
BucketId: pulumi.String("string"),
Drop: pulumi.Bool(false),
Interval: pulumi.String("string"),
Mode: pulumi.String("string"),
Slug: pulumi.String("string"),
})
resource "chronosphere_mappingrule" "mappingRuleResource" {
filter = "string"
name = "string"
aggregations = "string"
bucket_id = "string"
drop = false
interval = "string"
mode = "string"
slug = "string"
}
var mappingRuleResource = new MappingRule("mappingRuleResource", MappingRuleArgs.builder()
.filter("string")
.name("string")
.aggregations("string")
.bucketId("string")
.drop(false)
.interval("string")
.mode("string")
.slug("string")
.build());
mapping_rule_resource = chronosphere.MappingRule("mappingRuleResource",
filter="string",
name="string",
aggregations="string",
bucket_id="string",
drop=False,
interval="string",
mode="string",
slug="string")
const mappingRuleResource = new chronosphere.MappingRule("mappingRuleResource", {
filter: "string",
name: "string",
aggregations: "string",
bucketId: "string",
drop: false,
interval: "string",
mode: "string",
slug: "string",
});
type: chronosphere:MappingRule
properties:
aggregations: string
bucketId: string
drop: false
filter: string
interval: string
mode: string
name: string
slug: string
MappingRule 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 MappingRule resource accepts the following input properties:
- Filter string
- Space-delimited list of
label=value_globmatchers that select the metrics this rule applies to. A metric must match every filter to be considered. - Name string
- Display name of the mapping rule. Can be changed after creation.
- Aggregations string
- Aggregation type applied to matching metrics. Cannot be set if
dropistrue. - Bucket
Id string - ID of the bucket the mapping rule belongs to.
- Drop bool
- If
true, drops the matching metrics instead of aggregating them. Cannot be set together withaggregations. Defaults tofalse. - Drop
Timestamp bool - Deprecated: no longer supported.
- Interval string
- Interval between aggregated data points produced by this mapping rule. Defaults to a server-side value when unset. Conflicts with
storage_policy. - Mode string
- Mapping rule mode controlling whether it is active or in a preview state.
- Slug string
- Stable identifier for the mapping rule. Generated from
nameif omitted. Immutable after creation. - Storage
Policy Chronosphere.Pulumi. Inputs. Mapping Rule Storage Policy - Storage policy controlling resolution and retention of mapped metrics. Deprecated: use
intervalinstead.
- Filter string
- Space-delimited list of
label=value_globmatchers that select the metrics this rule applies to. A metric must match every filter to be considered. - Name string
- Display name of the mapping rule. Can be changed after creation.
- Aggregations string
- Aggregation type applied to matching metrics. Cannot be set if
dropistrue. - Bucket
Id string - ID of the bucket the mapping rule belongs to.
- Drop bool
- If
true, drops the matching metrics instead of aggregating them. Cannot be set together withaggregations. Defaults tofalse. - Drop
Timestamp bool - Deprecated: no longer supported.
- Interval string
- Interval between aggregated data points produced by this mapping rule. Defaults to a server-side value when unset. Conflicts with
storage_policy. - Mode string
- Mapping rule mode controlling whether it is active or in a preview state.
- Slug string
- Stable identifier for the mapping rule. Generated from
nameif omitted. Immutable after creation. - Storage
Policy MappingRule Storage Policy Args - Storage policy controlling resolution and retention of mapped metrics. Deprecated: use
intervalinstead.
- filter string
- Space-delimited list of
label=value_globmatchers that select the metrics this rule applies to. A metric must match every filter to be considered. - name string
- Display name of the mapping rule. Can be changed after creation.
- aggregations string
- Aggregation type applied to matching metrics. Cannot be set if
dropistrue. - bucket_
id string - ID of the bucket the mapping rule belongs to.
- drop bool
- If
true, drops the matching metrics instead of aggregating them. Cannot be set together withaggregations. Defaults tofalse. - drop_
timestamp bool - Deprecated: no longer supported.
- interval string
- Interval between aggregated data points produced by this mapping rule. Defaults to a server-side value when unset. Conflicts with
storage_policy. - mode string
- Mapping rule mode controlling whether it is active or in a preview state.
- slug string
- Stable identifier for the mapping rule. Generated from
nameif omitted. Immutable after creation. - storage_
policy object - Storage policy controlling resolution and retention of mapped metrics. Deprecated: use
intervalinstead.
- filter String
- Space-delimited list of
label=value_globmatchers that select the metrics this rule applies to. A metric must match every filter to be considered. - name String
- Display name of the mapping rule. Can be changed after creation.
- aggregations String
- Aggregation type applied to matching metrics. Cannot be set if
dropistrue. - bucket
Id String - ID of the bucket the mapping rule belongs to.
- drop Boolean
- If
true, drops the matching metrics instead of aggregating them. Cannot be set together withaggregations. Defaults tofalse. - drop
Timestamp Boolean - Deprecated: no longer supported.
- interval String
- Interval between aggregated data points produced by this mapping rule. Defaults to a server-side value when unset. Conflicts with
storage_policy. - mode String
- Mapping rule mode controlling whether it is active or in a preview state.
- slug String
- Stable identifier for the mapping rule. Generated from
nameif omitted. Immutable after creation. - storage
Policy MappingRule Storage Policy - Storage policy controlling resolution and retention of mapped metrics. Deprecated: use
intervalinstead.
- filter string
- Space-delimited list of
label=value_globmatchers that select the metrics this rule applies to. A metric must match every filter to be considered. - name string
- Display name of the mapping rule. Can be changed after creation.
- aggregations string
- Aggregation type applied to matching metrics. Cannot be set if
dropistrue. - bucket
Id string - ID of the bucket the mapping rule belongs to.
- drop boolean
- If
true, drops the matching metrics instead of aggregating them. Cannot be set together withaggregations. Defaults tofalse. - drop
Timestamp boolean - Deprecated: no longer supported.
- interval string
- Interval between aggregated data points produced by this mapping rule. Defaults to a server-side value when unset. Conflicts with
storage_policy. - mode string
- Mapping rule mode controlling whether it is active or in a preview state.
- slug string
- Stable identifier for the mapping rule. Generated from
nameif omitted. Immutable after creation. - storage
Policy MappingRule Storage Policy - Storage policy controlling resolution and retention of mapped metrics. Deprecated: use
intervalinstead.
- filter str
- Space-delimited list of
label=value_globmatchers that select the metrics this rule applies to. A metric must match every filter to be considered. - name str
- Display name of the mapping rule. Can be changed after creation.
- aggregations str
- Aggregation type applied to matching metrics. Cannot be set if
dropistrue. - bucket_
id str - ID of the bucket the mapping rule belongs to.
- drop bool
- If
true, drops the matching metrics instead of aggregating them. Cannot be set together withaggregations. Defaults tofalse. - drop_
timestamp bool - Deprecated: no longer supported.
- interval str
- Interval between aggregated data points produced by this mapping rule. Defaults to a server-side value when unset. Conflicts with
storage_policy. - mode str
- Mapping rule mode controlling whether it is active or in a preview state.
- slug str
- Stable identifier for the mapping rule. Generated from
nameif omitted. Immutable after creation. - storage_
policy MappingRule Storage Policy Args - Storage policy controlling resolution and retention of mapped metrics. Deprecated: use
intervalinstead.
- filter String
- Space-delimited list of
label=value_globmatchers that select the metrics this rule applies to. A metric must match every filter to be considered. - name String
- Display name of the mapping rule. Can be changed after creation.
- aggregations String
- Aggregation type applied to matching metrics. Cannot be set if
dropistrue. - bucket
Id String - ID of the bucket the mapping rule belongs to.
- drop Boolean
- If
true, drops the matching metrics instead of aggregating them. Cannot be set together withaggregations. Defaults tofalse. - drop
Timestamp Boolean - Deprecated: no longer supported.
- interval String
- Interval between aggregated data points produced by this mapping rule. Defaults to a server-side value when unset. Conflicts with
storage_policy. - mode String
- Mapping rule mode controlling whether it is active or in a preview state.
- slug String
- Stable identifier for the mapping rule. Generated from
nameif omitted. Immutable after creation. - storage
Policy Property Map - Storage policy controlling resolution and retention of mapped metrics. Deprecated: use
intervalinstead.
Outputs
All input properties are implicitly available as output properties. Additionally, the MappingRule 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 MappingRule Resource
Get an existing MappingRule 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?: MappingRuleState, opts?: CustomResourceOptions): MappingRule@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
aggregations: Optional[str] = None,
bucket_id: Optional[str] = None,
drop: Optional[bool] = None,
drop_timestamp: Optional[bool] = None,
filter: Optional[str] = None,
interval: Optional[str] = None,
mode: Optional[str] = None,
name: Optional[str] = None,
slug: Optional[str] = None,
storage_policy: Optional[MappingRuleStoragePolicyArgs] = None) -> MappingRulefunc GetMappingRule(ctx *Context, name string, id IDInput, state *MappingRuleState, opts ...ResourceOption) (*MappingRule, error)public static MappingRule Get(string name, Input<string> id, MappingRuleState? state, CustomResourceOptions? opts = null)public static MappingRule get(String name, Output<String> id, MappingRuleState state, CustomResourceOptions options)resources: _: type: chronosphere:MappingRule get: id: ${id}import {
to = chronosphere_mappingrule.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.
- Aggregations string
- Aggregation type applied to matching metrics. Cannot be set if
dropistrue. - Bucket
Id string - ID of the bucket the mapping rule belongs to.
- Drop bool
- If
true, drops the matching metrics instead of aggregating them. Cannot be set together withaggregations. Defaults tofalse. - Drop
Timestamp bool - Deprecated: no longer supported.
- Filter string
- Space-delimited list of
label=value_globmatchers that select the metrics this rule applies to. A metric must match every filter to be considered. - Interval string
- Interval between aggregated data points produced by this mapping rule. Defaults to a server-side value when unset. Conflicts with
storage_policy. - Mode string
- Mapping rule mode controlling whether it is active or in a preview state.
- Name string
- Display name of the mapping rule. Can be changed after creation.
- Slug string
- Stable identifier for the mapping rule. Generated from
nameif omitted. Immutable after creation. - Storage
Policy Chronosphere.Pulumi. Inputs. Mapping Rule Storage Policy - Storage policy controlling resolution and retention of mapped metrics. Deprecated: use
intervalinstead.
- Aggregations string
- Aggregation type applied to matching metrics. Cannot be set if
dropistrue. - Bucket
Id string - ID of the bucket the mapping rule belongs to.
- Drop bool
- If
true, drops the matching metrics instead of aggregating them. Cannot be set together withaggregations. Defaults tofalse. - Drop
Timestamp bool - Deprecated: no longer supported.
- Filter string
- Space-delimited list of
label=value_globmatchers that select the metrics this rule applies to. A metric must match every filter to be considered. - Interval string
- Interval between aggregated data points produced by this mapping rule. Defaults to a server-side value when unset. Conflicts with
storage_policy. - Mode string
- Mapping rule mode controlling whether it is active or in a preview state.
- Name string
- Display name of the mapping rule. Can be changed after creation.
- Slug string
- Stable identifier for the mapping rule. Generated from
nameif omitted. Immutable after creation. - Storage
Policy MappingRule Storage Policy Args - Storage policy controlling resolution and retention of mapped metrics. Deprecated: use
intervalinstead.
- aggregations string
- Aggregation type applied to matching metrics. Cannot be set if
dropistrue. - bucket_
id string - ID of the bucket the mapping rule belongs to.
- drop bool
- If
true, drops the matching metrics instead of aggregating them. Cannot be set together withaggregations. Defaults tofalse. - drop_
timestamp bool - Deprecated: no longer supported.
- filter string
- Space-delimited list of
label=value_globmatchers that select the metrics this rule applies to. A metric must match every filter to be considered. - interval string
- Interval between aggregated data points produced by this mapping rule. Defaults to a server-side value when unset. Conflicts with
storage_policy. - mode string
- Mapping rule mode controlling whether it is active or in a preview state.
- name string
- Display name of the mapping rule. Can be changed after creation.
- slug string
- Stable identifier for the mapping rule. Generated from
nameif omitted. Immutable after creation. - storage_
policy object - Storage policy controlling resolution and retention of mapped metrics. Deprecated: use
intervalinstead.
- aggregations String
- Aggregation type applied to matching metrics. Cannot be set if
dropistrue. - bucket
Id String - ID of the bucket the mapping rule belongs to.
- drop Boolean
- If
true, drops the matching metrics instead of aggregating them. Cannot be set together withaggregations. Defaults tofalse. - drop
Timestamp Boolean - Deprecated: no longer supported.
- filter String
- Space-delimited list of
label=value_globmatchers that select the metrics this rule applies to. A metric must match every filter to be considered. - interval String
- Interval between aggregated data points produced by this mapping rule. Defaults to a server-side value when unset. Conflicts with
storage_policy. - mode String
- Mapping rule mode controlling whether it is active or in a preview state.
- name String
- Display name of the mapping rule. Can be changed after creation.
- slug String
- Stable identifier for the mapping rule. Generated from
nameif omitted. Immutable after creation. - storage
Policy MappingRule Storage Policy - Storage policy controlling resolution and retention of mapped metrics. Deprecated: use
intervalinstead.
- aggregations string
- Aggregation type applied to matching metrics. Cannot be set if
dropistrue. - bucket
Id string - ID of the bucket the mapping rule belongs to.
- drop boolean
- If
true, drops the matching metrics instead of aggregating them. Cannot be set together withaggregations. Defaults tofalse. - drop
Timestamp boolean - Deprecated: no longer supported.
- filter string
- Space-delimited list of
label=value_globmatchers that select the metrics this rule applies to. A metric must match every filter to be considered. - interval string
- Interval between aggregated data points produced by this mapping rule. Defaults to a server-side value when unset. Conflicts with
storage_policy. - mode string
- Mapping rule mode controlling whether it is active or in a preview state.
- name string
- Display name of the mapping rule. Can be changed after creation.
- slug string
- Stable identifier for the mapping rule. Generated from
nameif omitted. Immutable after creation. - storage
Policy MappingRule Storage Policy - Storage policy controlling resolution and retention of mapped metrics. Deprecated: use
intervalinstead.
- aggregations str
- Aggregation type applied to matching metrics. Cannot be set if
dropistrue. - bucket_
id str - ID of the bucket the mapping rule belongs to.
- drop bool
- If
true, drops the matching metrics instead of aggregating them. Cannot be set together withaggregations. Defaults tofalse. - drop_
timestamp bool - Deprecated: no longer supported.
- filter str
- Space-delimited list of
label=value_globmatchers that select the metrics this rule applies to. A metric must match every filter to be considered. - interval str
- Interval between aggregated data points produced by this mapping rule. Defaults to a server-side value when unset. Conflicts with
storage_policy. - mode str
- Mapping rule mode controlling whether it is active or in a preview state.
- name str
- Display name of the mapping rule. Can be changed after creation.
- slug str
- Stable identifier for the mapping rule. Generated from
nameif omitted. Immutable after creation. - storage_
policy MappingRule Storage Policy Args - Storage policy controlling resolution and retention of mapped metrics. Deprecated: use
intervalinstead.
- aggregations String
- Aggregation type applied to matching metrics. Cannot be set if
dropistrue. - bucket
Id String - ID of the bucket the mapping rule belongs to.
- drop Boolean
- If
true, drops the matching metrics instead of aggregating them. Cannot be set together withaggregations. Defaults tofalse. - drop
Timestamp Boolean - Deprecated: no longer supported.
- filter String
- Space-delimited list of
label=value_globmatchers that select the metrics this rule applies to. A metric must match every filter to be considered. - interval String
- Interval between aggregated data points produced by this mapping rule. Defaults to a server-side value when unset. Conflicts with
storage_policy. - mode String
- Mapping rule mode controlling whether it is active or in a preview state.
- name String
- Display name of the mapping rule. Can be changed after creation.
- slug String
- Stable identifier for the mapping rule. Generated from
nameif omitted. Immutable after creation. - storage
Policy Property Map - Storage policy controlling resolution and retention of mapped metrics. Deprecated: use
intervalinstead.
Supporting Types
MappingRuleStoragePolicy, MappingRuleStoragePolicyArgs
- Resolution string
- Resolution at which mapped data points are stored.
- Retention string
- Retention duration for mapped data points.
- Resolution string
- Resolution at which mapped data points are stored.
- Retention string
- Retention duration for mapped data points.
- resolution string
- Resolution at which mapped data points are stored.
- retention string
- Retention duration for mapped data points.
- resolution String
- Resolution at which mapped data points are stored.
- retention String
- Retention duration for mapped data points.
- resolution string
- Resolution at which mapped data points are stored.
- retention string
- Retention duration for mapped data points.
- resolution str
- Resolution at which mapped data points are stored.
- retention str
- Retention duration for mapped data points.
- resolution String
- Resolution at which mapped data points are stored.
- retention String
- Retention duration for mapped data points.
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