{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://raw.githubusercontent.com/api-evangelist/chronosphere/main/json-schema/chronosphere-configv1-create-trace-metrics-rule-request-schema.json", "title": "configv1CreateTraceMetricsRuleRequest", "x-generated": "2026-10-03", "x-method": "derived", "x-generator": "derive-json-schema.py", "x-source": "openapi/chronosphere-tracemetricsrule-api-openapi.yml#/components/schemas/configv1CreateTraceMetricsRuleRequest", "properties": { "dry_run": { "description": "If `true`, validates the specified configuration without creating the TraceMetricsRule. If the specified configuration is valid, the endpoint returns a partial response without the TraceMetricsRule. If the specified configuration is invalid, the endpoint returns an error.", "type": "boolean" }, "trace_metrics_rule": { "allOf": [ { "$ref": "#/$defs/configv1TraceMetricsRule" } ], "description": "The TraceMetricsRule to create." } }, "type": "object", "$defs": { "GroupByGroupByKey": { "description": "GroupByKey describes a key to group by.", "properties": { "named_key": { "description": "For named key types, such as span tags, indicates the name of the key to\ngroup by.", "type": "string" }, "type": { "allOf": [ { "$ref": "#/$defs/GroupByKeyGroupByKeyType" } ], "description": "Type of key to group by." } }, "type": "object" }, "GroupByKeyGroupByKeyType": { "description": " - SERVICE: The service to group by.\n - OPERATION: The operation to group by.\n - TAG: The span tag to group by.\n - PARENT_SERVICE: The parent service to group by.\n - PARENT_OPERATION: The parent operation to group by.\n - ROOT_SERVICE: The root service to group by.\n - ROOT_OPERATION: The root operation to group by.", "enum": [ "SERVICE", "OPERATION", "TAG", "PARENT_SERVICE", "PARENT_OPERATION", "ROOT_SERVICE", "ROOT_OPERATION" ], "type": "string" }, "NumericFilterComparisonType": { "enum": [ "EQUAL", "NOT_EQUAL", "GREATER_THAN", "GREATER_THAN_OR_EQUAL", "LESS_THAN", "LESS_THAN_OR_EQUAL" ], "type": "string" }, "SpanFilterSpanFilterMatchType": { "enum": [ "INCLUDE", "EXCLUDE" ], "type": "string" }, "StringFilterStringFilterMatchType": { "enum": [ "EXACT", "REGEX", "EXACT_NEGATION", "REGEX_NEGATION", "IN", "NOT_IN" ], "type": "string" }, "TraceSearchFilterBoolFilter": { "properties": { "value": { "description": "The value of the filter compared to the target trace or span field.", "type": "boolean" } }, "type": "object" }, "TraceSearchFilterCountFilter": { "properties": { "max": { "description": "Maximum number of spans that must match a span query, inclusive.", "format": "int32", "type": "integer" }, "min": { "description": "Minimum number of spans that must match a span query, inclusive.", "format": "int32", "type": "integer" } }, "type": "object" }, "TraceSearchFilterDurationFilter": { "properties": { "max_secs": { "description": "Maximum duration, in seconds, required for a span or trace to match.", "format": "double", "type": "number" }, "min_secs": { "description": "Minimum duration, in seconds, required for a span or trace to match.", "format": "double", "type": "number" } }, "type": "object" }, "TraceSearchFilterNumericFilter": { "properties": { "comparison": { "allOf": [ { "$ref": "#/$defs/NumericFilterComparisonType" } ], "description": "The comparison operation to apply to an input against the given query value." }, "value": { "description": "The filter value used in comparison against match candidates.", "format": "double", "type": "number" } }, "type": "object" }, "TraceSearchFilterScopeFilter": { "properties": { "span_scopes": { "description": "Specifies the span filters that define which spans contribute to the metrics calculation.\nOnly spans matching these filters will be included in the metrics aggregation.", "items": { "$ref": "#/$defs/TraceSearchFilterSpanFilter" }, "type": "array" } }, "type": "object" }, "TraceSearchFilterSpanFilter": { "properties": { "duration": { "allOf": [ { "$ref": "#/$defs/TraceSearchFilterDurationFilter" } ], "description": "Matches the duration of the candidate span." }, "error": { "allOf": [ { "$ref": "#/$defs/TraceSearchFilterBoolFilter" } ], "description": "Matches the error status of the candidate span." }, "is_root_span": { "allOf": [ { "$ref": "#/$defs/TraceSearchFilterBoolFilter" } ], "description": "Matches the root span of a trace. For example, if the parent span has no child\nspans." }, "match_type": { "allOf": [ { "$ref": "#/$defs/SpanFilterSpanFilterMatchType" } ], "description": "If `INCLUDE`, includes all traces that have at least one (or `span_count`)\nspans matching the query. If `EXCLUDE`, excludes all traces that have at least\none (or `span_count`) spans matching the query." }, "operation": { "allOf": [ { "$ref": "#/$defs/TraceSearchFilterStringFilter" } ], "description": "Matches the operation of the candidate span." }, "parent_operation": { "allOf": [ { "$ref": "#/$defs/TraceSearchFilterStringFilter" } ], "description": "If not a root span, matches the operation of the candidate span's parent span" }, "parent_service": { "allOf": [ { "$ref": "#/$defs/TraceSearchFilterStringFilter" } ], "description": "If not a root span, matches the service of the candidate span's parent span." }, "service": { "allOf": [ { "$ref": "#/$defs/TraceSearchFilterStringFilter" } ], "description": "Matches the service of the candidate span." }, "span_count": { "allOf": [ { "$ref": "#/$defs/TraceSearchFilterCountFilter" } ], "description": "Defines the number of spans that must match the criteria defined by the span\nquery. Defaults to requiring that at least one span matches the span query." }, "tags": { "description": "Matches the tags of the candidate span.", "items": { "$ref": "#/$defs/TraceSearchFilterTagFilter" }, "type": "array" } }, "type": "object" }, "TraceSearchFilterStringFilter": { "properties": { "in_values": { "description": "Values the filter tests against when using `IN` or `NOT_IN` match type.", "items": { "type": "string" }, "type": "array" }, "match": { "allOf": [ { "$ref": "#/$defs/StringFilterStringFilterMatchType" } ], "description": "Specifies the comparison operator for the query. If `EXACT`, compared strings\nmust have the exact value of the query value." }, "value": { "description": "The value of the filter compared to the target trace or span field.", "type": "string" } }, "type": "object" }, "TraceSearchFilterTagFilter": { "properties": { "key": { "description": "The key or name of the span tag that this filter inspects.", "type": "string" }, "numeric_value": { "allOf": [ { "$ref": "#/$defs/TraceSearchFilterNumericFilter" } ], "description": "If the query matches the tag with the specified key, and the value type is\n`numeric`, specifies the matcher used to evaluate the span tag value." }, "value": { "allOf": [ { "$ref": "#/$defs/TraceSearchFilterStringFilter" } ], "description": "If the query matches the tag with the specified key, and the value type is a\n`string`, specifies the matcher used to evaluate the span tag value." } }, "type": "object" }, "TraceSearchFilterTraceFilter": { "properties": { "duration": { "allOf": [ { "$ref": "#/$defs/TraceSearchFilterDurationFilter" } ], "description": "Matches traces based on the duration of the entire trace." }, "error": { "allOf": [ { "$ref": "#/$defs/TraceSearchFilterBoolFilter" } ], "description": "Matches traces based on the top-level error status." } }, "type": "object" }, "configv1TraceMetricsRule": { "properties": { "created_at": { "description": "Timestamp of when the TraceMetricsRule was created. Cannot be set by clients.", "format": "date-time", "readOnly": true, "type": "string" }, "group_by": { "description": "Add labels to the resultant metrics based on the specified key:value pairs.", "items": { "$ref": "#/$defs/configv1TraceMetricsRuleGroupBy" }, "type": "array" }, "histogram_buckets_secs": { "description": "Histogram bucket values, in seconds, for generated duration metrics.", "items": { "format": "double", "type": "number" }, "type": "array" }, "metric_labels": { "additionalProperties": { "type": "string" }, "description": "Labels to apply to the generated trace metrics.", "type": "object" }, "metric_name": { "description": "The name of the generated trace metrics.", "type": "string" }, "name": { "description": "The name of the TraceMetricsRule. You can modify this value after the TraceMetricsRule is created.", "type": "string" }, "scope_filter": { "allOf": [ { "$ref": "#/$defs/TraceSearchFilterScopeFilter" } ], "description": "Scope filter to determine which spans should be counted for metrics generation.\nOnly spans matching the scope filter will contribute to trace metrics." }, "slug": { "description": "The unique identifier of the TraceMetricsRule. If a `slug` isn't provided, one is generated based on the `name` field. You can't modify this field after the TraceMetricsRule is created.", "type": "string" }, "trace_filter": { "allOf": [ { "$ref": "#/$defs/configv1TraceSearchFilter" } ], "description": "Filter that defines traces that should yield the defined metrics." }, "updated_at": { "description": "Timestamp of when the TraceMetricsRule was last updated. Cannot be set by clients.", "format": "date-time", "readOnly": true, "type": "string" } }, "required": [ "name" ], "type": "object" }, "configv1TraceMetricsRuleGroupBy": { "description": "GroupBy contains fields required to group the resultant metrics of a TraceMetricsRule by a specific key.", "properties": { "key": { "allOf": [ { "$ref": "#/$defs/GroupByGroupByKey" } ], "description": "The key to group by." }, "label": { "description": "The label to use in the resulting metrics.", "type": "string" } }, "type": "object" }, "configv1TraceSearchFilter": { "properties": { "scope_filter": { "allOf": [ { "$ref": "#/$defs/TraceSearchFilterScopeFilter" } ], "description": "Scope filter that defines which spans within matching traces contribute to metrics calculation." }, "span": { "description": "Specifies the span conditions to match on. All conditions must be true in a\nsingle span for the span to be considered a match. If `span_count` is specified,\nthe number of spans within the trace that match span conditions must be within\n`[min, max]`. You can specify multiple span conditions, and each can be\nsatisfied by any number of spans within the trace.", "items": { "$ref": "#/$defs/TraceSearchFilterSpanFilter" }, "type": "array" }, "trace": { "allOf": [ { "$ref": "#/$defs/TraceSearchFilterTraceFilter" } ], "description": "Trace-level filter criteria (effectively matching the root span)." } }, "type": "object" } } }