---
title: "PUT /api/v1/config/trace-metrics-rules/{slug}"
method: PUT
path: "/api/v1/config/trace-metrics-rules/{slug}"
tags: ["TraceMetricsRule"]
---

# PUT /api/v1/config/trace-metrics-rules/{slug}

`PUT /api/v1/config/trace-metrics-rules/{slug}`

## Path parameters

- `slug` string, required

## Request body

- ConfigV1UpdateTraceMetricsRuleBody
  - `create_if_missing` boolean — If `true`, the TraceMetricsRule will be created if it does not already exist, identified by `slug`. If `false`, an error will be returned if the TraceMetricsRule does not already exist.
  - `dry_run` boolean — If `true`, validates the specified configuration without creating or updating 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.
  - `trace_metrics_rule` Configv1TraceMetricsRule
    - `created_at` string, date-time — Timestamp of when the TraceMetricsRule was created. Cannot be set by clients.
    - `group_by` Configv1TraceMetricsRuleGroupBy[] — Add labels to the resultant metrics based on the specified key:value pairs.
      - `key` GroupByGroupByKey — GroupByKey describes a key to group by.
        - `named_key` string — For named key types, such as span tags, indicates the name of the key to group by.
        - `type` 'SERVICE' | 'OPERATION' | 'TAG' | 'PARENT_SERVICE' | 'PARENT_OPERATION' | 'ROOT_SERVICE' | 'ROOT_OPERATION' — - SERVICE: The service to group by. - OPERATION: The operation to group by. - TAG: The span tag to group by. - PARENT_SERVICE: The parent service to group by. - PARENT_OPERATION: The parent operation to group by. - ROOT_SERVICE: The root service to group by. - ROOT_OPERATION: The root operation to group by.
      - `label` string — The label to use in the resulting metrics.
    - `histogram_buckets_secs` number[] — Histogram bucket values, in seconds, for generated duration metrics.
    - `metric_labels` object — Labels to apply to the generated trace metrics.
    - `metric_name` string — The name of the generated trace metrics.
    - `name` string, required — The name of the TraceMetricsRule. You can modify this value after the TraceMetricsRule is created.
    - `scope_filter` TraceSearchFilterScopeFilter
      - `span_scopes` TraceSearchFilterSpanFilter[] — Specifies the span filters that define which spans contribute to the metrics calculation. Only spans matching these filters will be included in the metrics aggregation.
        - `duration` TraceSearchFilterDurationFilter
          - `max_secs` number, double — Maximum duration, in seconds, required for a span or trace to match.
          - `min_secs` number, double — Minimum duration, in seconds, required for a span or trace to match.
        - `error` TraceSearchFilterBoolFilter
          - `value` boolean — The value of the filter compared to the target trace or span field.
        - `is_root_span` TraceSearchFilterBoolFilter
          - `value` boolean — The value of the filter compared to the target trace or span field.
        - `match_type` 'INCLUDE' | 'EXCLUDE'
        - `operation` TraceSearchFilterStringFilter
          - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
          - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
          - `value` string — The value of the filter compared to the target trace or span field.
        - `parent_operation` TraceSearchFilterStringFilter
          - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
          - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
          - `value` string — The value of the filter compared to the target trace or span field.
        - `parent_service` TraceSearchFilterStringFilter
          - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
          - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
          - `value` string — The value of the filter compared to the target trace or span field.
        - `service` TraceSearchFilterStringFilter
          - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
          - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
          - `value` string — The value of the filter compared to the target trace or span field.
        - `span_count` TraceSearchFilterCountFilter
          - `max` integer — Maximum number of spans that must match a span query, inclusive.
          - `min` integer — Minimum number of spans that must match a span query, inclusive.
        - `tags` TraceSearchFilterTagFilter[] — Matches the tags of the candidate span.
          - `key` string — The key or name of the span tag that this filter inspects.
          - `numeric_value` TraceSearchFilterNumericFilter
            - `comparison` 'EQUAL' | 'NOT_EQUAL' | 'GREATER_THAN' | 'GREATER_THAN_OR_EQUAL' | 'LESS_THAN' | 'LESS_THAN_OR_EQUAL'
            - `value` number, double — The filter value used in comparison against match candidates.
          - `value` TraceSearchFilterStringFilter
            - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
            - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
            - `value` string — The value of the filter compared to the target trace or span field.
    - `slug` string — 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.
    - `trace_filter` Configv1TraceSearchFilter
      - `scope_filter` TraceSearchFilterScopeFilter
        - `span_scopes` TraceSearchFilterSpanFilter[] — Specifies the span filters that define which spans contribute to the metrics calculation. Only spans matching these filters will be included in the metrics aggregation.
          - `duration` TraceSearchFilterDurationFilter
            - `max_secs` number, double — Maximum duration, in seconds, required for a span or trace to match.
            - `min_secs` number, double — Minimum duration, in seconds, required for a span or trace to match.
          - `error` TraceSearchFilterBoolFilter
            - `value` boolean — The value of the filter compared to the target trace or span field.
          - `is_root_span` TraceSearchFilterBoolFilter
            - `value` boolean — The value of the filter compared to the target trace or span field.
          - `match_type` 'INCLUDE' | 'EXCLUDE'
          - `operation` TraceSearchFilterStringFilter
            - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
            - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
            - `value` string — The value of the filter compared to the target trace or span field.
          - `parent_operation` TraceSearchFilterStringFilter
            - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
            - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
            - `value` string — The value of the filter compared to the target trace or span field.
          - `parent_service` TraceSearchFilterStringFilter
            - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
            - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
            - `value` string — The value of the filter compared to the target trace or span field.
          - `service` TraceSearchFilterStringFilter
            - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
            - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
            - `value` string — The value of the filter compared to the target trace or span field.
          - `span_count` TraceSearchFilterCountFilter
            - `max` integer — Maximum number of spans that must match a span query, inclusive.
            - `min` integer — Minimum number of spans that must match a span query, inclusive.
          - `tags` TraceSearchFilterTagFilter[] — Matches the tags of the candidate span.
            - `key` string — The key or name of the span tag that this filter inspects.
            - `numeric_value` TraceSearchFilterNumericFilter
              - …
            - `value` TraceSearchFilterStringFilter
              - …
      - `span` TraceSearchFilterSpanFilter[] — Specifies the span conditions to match on. All conditions must be true in a single span for the span to be considered a match. If `span_count` is specified, the number of spans within the trace that match span conditions must be within `[min, max]`. You can specify multiple span conditions, and each can be satisfied by any number of spans within the trace.
        - `duration` TraceSearchFilterDurationFilter
          - `max_secs` number, double — Maximum duration, in seconds, required for a span or trace to match.
          - `min_secs` number, double — Minimum duration, in seconds, required for a span or trace to match.
        - `error` TraceSearchFilterBoolFilter
          - `value` boolean — The value of the filter compared to the target trace or span field.
        - `is_root_span` TraceSearchFilterBoolFilter
          - `value` boolean — The value of the filter compared to the target trace or span field.
        - `match_type` 'INCLUDE' | 'EXCLUDE'
        - `operation` TraceSearchFilterStringFilter
          - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
          - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
          - `value` string — The value of the filter compared to the target trace or span field.
        - `parent_operation` TraceSearchFilterStringFilter
          - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
          - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
          - `value` string — The value of the filter compared to the target trace or span field.
        - `parent_service` TraceSearchFilterStringFilter
          - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
          - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
          - `value` string — The value of the filter compared to the target trace or span field.
        - `service` TraceSearchFilterStringFilter
          - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
          - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
          - `value` string — The value of the filter compared to the target trace or span field.
        - `span_count` TraceSearchFilterCountFilter
          - `max` integer — Maximum number of spans that must match a span query, inclusive.
          - `min` integer — Minimum number of spans that must match a span query, inclusive.
        - `tags` TraceSearchFilterTagFilter[] — Matches the tags of the candidate span.
          - `key` string — The key or name of the span tag that this filter inspects.
          - `numeric_value` TraceSearchFilterNumericFilter
            - `comparison` 'EQUAL' | 'NOT_EQUAL' | 'GREATER_THAN' | 'GREATER_THAN_OR_EQUAL' | 'LESS_THAN' | 'LESS_THAN_OR_EQUAL'
            - `value` number, double — The filter value used in comparison against match candidates.
          - `value` TraceSearchFilterStringFilter
            - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
            - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
            - `value` string — The value of the filter compared to the target trace or span field.
      - `trace` TraceSearchFilterTraceFilter
        - `duration` TraceSearchFilterDurationFilter
          - `max_secs` number, double — Maximum duration, in seconds, required for a span or trace to match.
          - `min_secs` number, double — Minimum duration, in seconds, required for a span or trace to match.
        - `error` TraceSearchFilterBoolFilter
          - `value` boolean — The value of the filter compared to the target trace or span field.
    - `updated_at` string, date-time — Timestamp of when the TraceMetricsRule was last updated. Cannot be set by clients.

## Response `200`

A successful response containing the updated TraceMetricsRule.

- Configv1UpdateTraceMetricsRuleResponse
  - `trace_metrics_rule` Configv1TraceMetricsRule
    - `created_at` string, date-time — Timestamp of when the TraceMetricsRule was created. Cannot be set by clients.
    - `group_by` Configv1TraceMetricsRuleGroupBy[] — Add labels to the resultant metrics based on the specified key:value pairs.
      - `key` GroupByGroupByKey — GroupByKey describes a key to group by.
        - `named_key` string — For named key types, such as span tags, indicates the name of the key to group by.
        - `type` 'SERVICE' | 'OPERATION' | 'TAG' | 'PARENT_SERVICE' | 'PARENT_OPERATION' | 'ROOT_SERVICE' | 'ROOT_OPERATION' — - SERVICE: The service to group by. - OPERATION: The operation to group by. - TAG: The span tag to group by. - PARENT_SERVICE: The parent service to group by. - PARENT_OPERATION: The parent operation to group by. - ROOT_SERVICE: The root service to group by. - ROOT_OPERATION: The root operation to group by.
      - `label` string — The label to use in the resulting metrics.
    - `histogram_buckets_secs` number[] — Histogram bucket values, in seconds, for generated duration metrics.
    - `metric_labels` object — Labels to apply to the generated trace metrics.
    - `metric_name` string — The name of the generated trace metrics.
    - `name` string, required — The name of the TraceMetricsRule. You can modify this value after the TraceMetricsRule is created.
    - `scope_filter` TraceSearchFilterScopeFilter
      - `span_scopes` TraceSearchFilterSpanFilter[] — Specifies the span filters that define which spans contribute to the metrics calculation. Only spans matching these filters will be included in the metrics aggregation.
        - `duration` TraceSearchFilterDurationFilter
          - `max_secs` number, double — Maximum duration, in seconds, required for a span or trace to match.
          - `min_secs` number, double — Minimum duration, in seconds, required for a span or trace to match.
        - `error` TraceSearchFilterBoolFilter
          - `value` boolean — The value of the filter compared to the target trace or span field.
        - `is_root_span` TraceSearchFilterBoolFilter
          - `value` boolean — The value of the filter compared to the target trace or span field.
        - `match_type` 'INCLUDE' | 'EXCLUDE'
        - `operation` TraceSearchFilterStringFilter
          - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
          - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
          - `value` string — The value of the filter compared to the target trace or span field.
        - `parent_operation` TraceSearchFilterStringFilter
          - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
          - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
          - `value` string — The value of the filter compared to the target trace or span field.
        - `parent_service` TraceSearchFilterStringFilter
          - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
          - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
          - `value` string — The value of the filter compared to the target trace or span field.
        - `service` TraceSearchFilterStringFilter
          - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
          - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
          - `value` string — The value of the filter compared to the target trace or span field.
        - `span_count` TraceSearchFilterCountFilter
          - `max` integer — Maximum number of spans that must match a span query, inclusive.
          - `min` integer — Minimum number of spans that must match a span query, inclusive.
        - `tags` TraceSearchFilterTagFilter[] — Matches the tags of the candidate span.
          - `key` string — The key or name of the span tag that this filter inspects.
          - `numeric_value` TraceSearchFilterNumericFilter
            - `comparison` 'EQUAL' | 'NOT_EQUAL' | 'GREATER_THAN' | 'GREATER_THAN_OR_EQUAL' | 'LESS_THAN' | 'LESS_THAN_OR_EQUAL'
            - `value` number, double — The filter value used in comparison against match candidates.
          - `value` TraceSearchFilterStringFilter
            - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
            - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
            - `value` string — The value of the filter compared to the target trace or span field.
    - `slug` string — 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.
    - `trace_filter` Configv1TraceSearchFilter
      - `scope_filter` TraceSearchFilterScopeFilter
        - `span_scopes` TraceSearchFilterSpanFilter[] — Specifies the span filters that define which spans contribute to the metrics calculation. Only spans matching these filters will be included in the metrics aggregation.
          - `duration` TraceSearchFilterDurationFilter
            - `max_secs` number, double — Maximum duration, in seconds, required for a span or trace to match.
            - `min_secs` number, double — Minimum duration, in seconds, required for a span or trace to match.
          - `error` TraceSearchFilterBoolFilter
            - `value` boolean — The value of the filter compared to the target trace or span field.
          - `is_root_span` TraceSearchFilterBoolFilter
            - `value` boolean — The value of the filter compared to the target trace or span field.
          - `match_type` 'INCLUDE' | 'EXCLUDE'
          - `operation` TraceSearchFilterStringFilter
            - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
            - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
            - `value` string — The value of the filter compared to the target trace or span field.
          - `parent_operation` TraceSearchFilterStringFilter
            - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
            - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
            - `value` string — The value of the filter compared to the target trace or span field.
          - `parent_service` TraceSearchFilterStringFilter
            - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
            - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
            - `value` string — The value of the filter compared to the target trace or span field.
          - `service` TraceSearchFilterStringFilter
            - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
            - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
            - `value` string — The value of the filter compared to the target trace or span field.
          - `span_count` TraceSearchFilterCountFilter
            - `max` integer — Maximum number of spans that must match a span query, inclusive.
            - `min` integer — Minimum number of spans that must match a span query, inclusive.
          - `tags` TraceSearchFilterTagFilter[] — Matches the tags of the candidate span.
            - `key` string — The key or name of the span tag that this filter inspects.
            - `numeric_value` TraceSearchFilterNumericFilter
              - …
            - `value` TraceSearchFilterStringFilter
              - …
      - `span` TraceSearchFilterSpanFilter[] — Specifies the span conditions to match on. All conditions must be true in a single span for the span to be considered a match. If `span_count` is specified, the number of spans within the trace that match span conditions must be within `[min, max]`. You can specify multiple span conditions, and each can be satisfied by any number of spans within the trace.
        - `duration` TraceSearchFilterDurationFilter
          - `max_secs` number, double — Maximum duration, in seconds, required for a span or trace to match.
          - `min_secs` number, double — Minimum duration, in seconds, required for a span or trace to match.
        - `error` TraceSearchFilterBoolFilter
          - `value` boolean — The value of the filter compared to the target trace or span field.
        - `is_root_span` TraceSearchFilterBoolFilter
          - `value` boolean — The value of the filter compared to the target trace or span field.
        - `match_type` 'INCLUDE' | 'EXCLUDE'
        - `operation` TraceSearchFilterStringFilter
          - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
          - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
          - `value` string — The value of the filter compared to the target trace or span field.
        - `parent_operation` TraceSearchFilterStringFilter
          - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
          - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
          - `value` string — The value of the filter compared to the target trace or span field.
        - `parent_service` TraceSearchFilterStringFilter
          - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
          - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
          - `value` string — The value of the filter compared to the target trace or span field.
        - `service` TraceSearchFilterStringFilter
          - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
          - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
          - `value` string — The value of the filter compared to the target trace or span field.
        - `span_count` TraceSearchFilterCountFilter
          - `max` integer — Maximum number of spans that must match a span query, inclusive.
          - `min` integer — Minimum number of spans that must match a span query, inclusive.
        - `tags` TraceSearchFilterTagFilter[] — Matches the tags of the candidate span.
          - `key` string — The key or name of the span tag that this filter inspects.
          - `numeric_value` TraceSearchFilterNumericFilter
            - `comparison` 'EQUAL' | 'NOT_EQUAL' | 'GREATER_THAN' | 'GREATER_THAN_OR_EQUAL' | 'LESS_THAN' | 'LESS_THAN_OR_EQUAL'
            - `value` number, double — The filter value used in comparison against match candidates.
          - `value` TraceSearchFilterStringFilter
            - `in_values` string[] — Values the filter tests against when using `IN` or `NOT_IN` match type.
            - `match` 'EXACT' | 'REGEX' | 'EXACT_NEGATION' | 'REGEX_NEGATION' | 'IN' | 'NOT_IN'
            - `value` string — The value of the filter compared to the target trace or span field.
      - `trace` TraceSearchFilterTraceFilter
        - `duration` TraceSearchFilterDurationFilter
          - `max_secs` number, double — Maximum duration, in seconds, required for a span or trace to match.
          - `min_secs` number, double — Minimum duration, in seconds, required for a span or trace to match.
        - `error` TraceSearchFilterBoolFilter
          - `value` boolean — The value of the filter compared to the target trace or span field.
    - `updated_at` string, date-time — Timestamp of when the TraceMetricsRule was last updated. Cannot be set by clients.

## Other responses

- `400` — Cannot update the TraceMetricsRule because the request is invalid.
- `404` — Cannot update the TraceMetricsRule because the slug does not exist.
- `409` — Cannot update the TraceMetricsRule because there is a conflict with an existing TraceMetricsRule.
- `500` — An unexpected error response.
- `default` — An undefined error response.

---

[API](https://skmtc.dev/chronosphere/apis/data-v1-api.md) · [All operations](https://skmtc.dev/chronosphere/apis/data-v1-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/chronosphere/data-v1-api/revisions/ee91fd539ced/schema)
