Update or create an Operation Pattern Rule by origin or ID
/api/operation-pattern-rules/{originOrId}Upsert semantics, per this API's standard {originOrId} convention: if {originOrId}
resolves to an existing rule, it's updated; if it doesn't resolve to anything, a new
rule is created for non-UI (machine token/OAuth) callers only --
- if
{originOrId}looks like a UUID, the new rule is created with that UUID as itsdash0.com/id(metadata.labels["dash0.com/origin"]in the body, if any, is stamped normally perPOST's rules); - otherwise,
{originOrId}itself becomes the new rule'sdash0.com/originand a freshdash0.com/idis generated.
A UI (Clerk session token) caller gets a strict 404 instead of a create when
{originOrId} doesn't resolve -- the UI creates rules via POST only, matching this
API's other single-/api/-family resources.
metadata.labels["dash0.com/origin"] is immutable after creation: a value supplied on
update is silently ignored, never rejected, so a normal GET -> edit spec -> PUT round
trip doesn't need to strip it back out.
metadata.labels["dash0.com/dataset"]/spec.serviceNamespace/spec.serviceName are immutable; a value that
disagrees with the stored row is rejected with 400 and the row is left unchanged.
Setting spec.ownership to auto_derived is rejected with 400; the only accepted
transition is auto_derived -> user_defined (promoting a Miner-inferred rule).
Unlike POST, spec.status is required on every PUT -- there is no default, since
omitting it could otherwise silently reactivate or deactivate a rule the caller did
not intend to touch.
If the incoming payload is identical to what's already stored, the write is skipped
entirely and the existing rule is returned as-is, without bumping
dash0.com/updated-at -- so re-applying the same manifest (a normal IaC workflow)
never spuriously conflicts with itself.
Parameters 2
originOrIdpathrequiredThe Operation Pattern Rule's dash0.com/origin or dash0.com/id.
datasetqueryrequiredThe dataset the Pattern Rule belongs to.
Optional dataset to query across. Defaults to whatever is configured to be the default dataset for the organization.
"^[a-zA-Z0-9_-]{3,26}$"Sample request123456789101112curl --request PUT 'https://api.eu-west-1.aws.dash0.com/api/operation-pattern-rules/123e4567-e89b-42d3-a456-426614174000?dataset=default' \--header "Authorization: Bearer ${DASH0_AUTH_TOKEN}" \--header 'Content-Type: application/json' \--data-raw '{"kind": "Dash0OperationPatternRule","metadata": {},"spec": {"serviceName": "example","pattern": "example","status": "active"}}'
Request body required
A Pattern Rule abstracts a high-cardinality span operation name (e.g. /users/1234)
into a templated one (e.g. /users/<userId>), so the collector's Operation Processor
can collapse matching operation names together. Rows are either authored by a human
through this API (spec.ownership: user_defined) or inferred by the Operation Miner
(spec.ownership: auto_derived).
Unlike most CRD-enveloped resources in this API, Pattern Rules have no independent,
user-editable display name, versioning, folder, or sharing concept -- metadata.name is
server-computed (see below). They are addressable either by their server-generated
metadata.labels["dash0.com/id"] or by metadata.labels["dash0.com/origin"] (an
IaC/Terraform-style stable label) -- see {originOrId} on each path below.
metadata.labels["dash0.com/dataset"]/spec.serviceNamespace/spec.serviceName identify
the partition (dataset + service) a rule belongs to, and are immutable once the rule is
created.
"Dash0OperationPatternRule"Responses
The updated or newly-created Operation Pattern Rule
A Pattern Rule abstracts a high-cardinality span operation name (e.g. /users/1234)
into a templated one (e.g. /users/<userId>), so the collector's Operation Processor
can collapse matching operation names together. Rows are either authored by a human
through this API (spec.ownership: user_defined) or inferred by the Operation Miner
(spec.ownership: auto_derived).
Unlike most CRD-enveloped resources in this API, Pattern Rules have no independent,
user-editable display name, versioning, folder, or sharing concept -- metadata.name is
server-computed (see below). They are addressable either by their server-generated
metadata.labels["dash0.com/id"] or by metadata.labels["dash0.com/origin"] (an
IaC/Terraform-style stable label) -- see {originOrId} on each path below.
metadata.labels["dash0.com/dataset"]/spec.serviceNamespace/spec.serviceName identify
the partition (dataset + service) a rule belongs to, and are immutable once the rule is
created.
"Dash0OperationPatternRule"