name = "storage_cardinality_example" # Values are automatically generated before the agents are initialized. They generate tag key/value pairs # with the name of the value as the tag key and the evaluated template as the value. These pairs # are Arc wrapped so they can be shared across tagsets and used in the agents as pre-generated data. [[values]] # the name must not have a . in it, which is used to access children later. Otherwise it's open. name = "role" # the template can use a number of helpers to get an id, a random string and the name, see below for examples template = "storage" # this number of tag pairs will be generated. If this is > 1, the id or a random character string should be # used in the template to ensure that the tag key/value pairs are unique. cardinality = 1 [[values]] name = "url" template = "http://127.0.0.1:6060/metrics/usage" cardinality = 1 [[values]] name = "org_id" # Fill in the value with the cardinality counter and 15 random alphanumeric characters template = "{{id}}_{{random 15}}" cardinality = 100 has_one = ["env"] [[values]] name = "env" template = "whatever-environment-{{id}}" cardinality = 2 [[values]] name = "bucket_id" # a bucket belongs to an org. With this, you would be able to access the org.id or org.value in the template belongs_to = "org_id" # each bucket will have a unique id, which is used here to guarantee uniqueness even across orgs. We also # have a random 15 character alphanumeric sequence to pad out the value length. template = "{{id}}_{{random 15}}" # For each org, 3 buckets will be generated cardinality = 3 [[values]] name = "partition_id" template = "{{id}}" cardinality = 10 # makes a tagset so every bucket appears in every partition. The other tags are descriptive and don't # increase the cardinality beyond count(bucket) * count(partition). Later this example will use the # agent and measurement generation to take this base tagset and increase cardinality on a per-agent basis. [[tag_sets]] name = "bucket_set" for_each = [ "role", "url", "org_id", "org_id.env", "org_id.bucket_id", "partition_id", ] [[database_writers]] database_ratio = 1.0 agents = [{name = "sender", sampling_interval = "10s"}] [[agents]] name = "sender" [[agents.measurements]] name = "storage_usage_bucket_cardinality" # each sampling will have all the tag sets from this collection in addition to the tags and tag_pairs specified tag_set = "bucket_set" # for each agent, this specific measurement will be decorated with these additional tags. tag_pairs = [ {key = "node_id", template = "{{agent.id}}"}, {key = "hostname", template = "{{agent.id}}"}, {key = "host", template = "storage-{{agent.id}}"}, ] [[agents.measurements.fields]] name = "gauge" i64_range = [1, 8147240]