{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://raw.githubusercontent.com/api-evangelist/chronosphere/main/json-schema/chronosphere-config-v1-update-derived-label-body-schema.json", "title": "ConfigV1UpdateDerivedLabelBody", "x-generated": "2026-10-03", "x-method": "derived", "x-generator": "derive-json-schema.py", "x-source": "openapi/chronosphere-derivedlabel-api-openapi.yml#/components/schemas/ConfigV1UpdateDerivedLabelBody", "properties": { "create_if_missing": { "description": "If `true`, the DerivedLabel will be created if it does not already exist, identified by `slug`. If `false`, an error will be returned if the DerivedLabel does not already exist.", "type": "boolean" }, "derived_label": { "allOf": [ { "$ref": "#/$defs/configv1DerivedLabel" } ], "description": "The DerivedLabel to update." }, "dry_run": { "description": "If `true`, validates the specified configuration without creating or updating the DerivedLabel. If the specified configuration is valid, the endpoint returns a partial response without the DerivedLabel. If the specified configuration is invalid, the endpoint returns an error.", "type": "boolean" } }, "type": "object", "$defs": { "ConstructedLabelValueDefinition": { "properties": { "filters": { "description": "Determine when to apply `name_mappings`, filtering out all other values.", "items": { "$ref": "#/$defs/configv1LabelFilter" }, "type": "array" }, "value": { "type": "string" } }, "type": "object" }, "DerivedLabelMetricLabel": { "properties": { "constructed_label": { "allOf": [ { "$ref": "#/$defs/MetricLabelConstructedLabel" } ], "description": "A constructed label creates a label where none previously existed, in contrast\nto a mapping derived label. For example, this mapping constructs a label\nthat's defined only when an `instance` begins with\n`m3coordinator-{read,write,admin}`, and where the value is statically\ndefined.\n```yaml\nlabel_name: tier\nconstructed_label:\n value_definitions:\n - filters:\n - name: instance\n value_glob: m3coordinator-read*\n value: read\n - filters:\n - name: instance\n value_glob: m3coordinator-write*\n value: write\n - filters:\n - name: instance\n value_glob: m3coordinator-admin*\n value: admin\n```" }, "mapping_label": { "allOf": [ { "$ref": "#/$defs/MetricLabelMappingLabel" } ], "description": "A mapping label is a type of derived label that's generated by pulling values\nfrom some other label on the time series. For example, this mapping matches a\nlabel that's defined only when `__name__` begins with `envoy_` or `grpc_,` and\nwhere the value is copied from `backend_service` or `grpc_service`:\n```yaml\nlabel_name: chronosphere_service\nmapping_label:\n name_mappings:\n - filters:\n - name: __name__\n value_glob: grpc_*\n source_label: grpc_service\n - filters:\n - name: __name__\n value_glob: envoy_*\n source_label: backend_service\n```" } }, "type": "object" }, "DerivedLabelSpanTag": { "properties": { "name_mappings": { "description": "Determines where the input data for a derived label comes from. For each\nname mapping, you must define a `source_label`. If multiple name mappings\nare defined, the first name mapping that matches is used to map the source\ntag to the derived tag.", "items": { "$ref": "#/$defs/DerivedLabelSpanTagNameMapping" }, "type": "array" } }, "type": "object" }, "DerivedLabelSpanTagNameMapping": { "properties": { "source_tag": { "description": "The source span tag name.", "type": "string" } }, "type": "object" }, "MappingLabelValueMapping": { "properties": { "source_value_globs": { "description": "Defines the source label values that map into the given `target_value`.", "items": { "type": "string" }, "type": "array" }, "target_value": { "description": "The value that `source_value_globs` are mapped into. For example, this\nmapping indicates that the target value `cat` maps to the source label's\nvalues of `Cat` and `CAT`.:\n```yaml\nvalue_mappings:\n - source_value_globs:\n - Cat\n - CAT\n target_value: cat\n```", "type": "string" } }, "type": "object" }, "MetricLabelConstructedLabel": { "properties": { "value_definitions": { "items": { "$ref": "#/$defs/ConstructedLabelValueDefinition" }, "type": "array" } }, "type": "object" }, "MetricLabelMappingLabel": { "properties": { "name_mappings": { "description": "Determines where the input data for a derived label comes from. For each\nname mapping, you must define a `source_label`. If multiple name mappings\nare defined, the first name mapping that matches is used to map the source\nlabel to the derived label.", "items": { "$ref": "#/$defs/MetricLabelMappingLabelNameMapping" }, "type": "array" }, "value_mappings": { "description": "These value mappings apply to the whole mapping label.\nIf there's no name_mappings, these value mappings apply to the label that exists on the metric.", "items": { "$ref": "#/$defs/MappingLabelValueMapping" }, "type": "array" } }, "required": [ "name_mappings" ], "type": "object" }, "MetricLabelMappingLabelNameMapping": { "properties": { "filters": { "items": { "$ref": "#/$defs/configv1LabelFilter" }, "type": "array" }, "source_label": { "description": "The source label name on the time series from when it was ingested.", "type": "string" }, "value_mappings": { "description": "These value mappings apply only to the name mapping they belong to.", "items": { "$ref": "#/$defs/MappingLabelValueMapping" }, "type": "array" } }, "type": "object" }, "configv1DerivedLabel": { "properties": { "created_at": { "description": "Timestamp of when the DerivedLabel was created. Cannot be set by clients.", "format": "date-time", "readOnly": true, "type": "string" }, "description": { "description": "Optional. Description of the derived label.", "type": "string" }, "existing_label_policy": { "allOf": [ { "$ref": "#/$defs/configv1DerivedLabelLabelPolicy" } ], "description": "Specifies the action taken when there's a metric label with the same name as\nthis derived label, on the same time series. If the label is present on another\ntime series, this field doesn't apply. Default: `KEEP`.\n- If set to `KEEP`, the label that already exists on the metric is used instead of the derived label.\n- If set to `OVERRIDE`, the derived label is used instead of the metric's existing label." }, "label_name": { "description": "Name of the derived label. Must be unique across the system.", "type": "string" }, "metric_label": { "allOf": [ { "$ref": "#/$defs/DerivedLabelMetricLabel" } ], "description": "Sets the metric labels to map to `label_name`." }, "name": { "description": "The name of the DerivedLabel. You can modify this value after the DerivedLabel is created.", "type": "string" }, "slug": { "description": "The unique identifier of the DerivedLabel. If a `slug` isn't provided, one is generated based on the `name` field. You can't modify this field after the DerivedLabel is created.", "type": "string" }, "span_tag": { "allOf": [ { "$ref": "#/$defs/DerivedLabelSpanTag" } ], "description": "Sets the span tags to map to `label_name`." }, "updated_at": { "description": "Timestamp of when the DerivedLabel was last updated. Cannot be set by clients.", "format": "date-time", "readOnly": true, "type": "string" } }, "required": [ "label_name", "name" ], "type": "object" }, "configv1DerivedLabelLabelPolicy": { "enum": [ "KEEP", "OVERRIDE" ], "type": "string" }, "configv1LabelFilter": { "properties": { "name": { "description": "The name of the label to match.", "type": "string" }, "value_glob": { "description": "The glob value of the label to match.", "type": "string" } }, "type": "object" } } }