> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Check and Reflect Schema Summary

> Summary of OpenTelemetry schema transform rules and best practices for collector schema files, covering rename-focused transforms, ordering, versioning, and scoping for metrics, spans, events, and resources.

This page summarizes the essential rules and best practices for OpenTelemetry schema transforms. Use it as a quick reference when authoring schema files for the collector's schema processor.

Key takeaways:

* Patch increments imply no behavioral changes for consumers.
* Minor increments add optional, backward-compatible items.
* The `all` section may only contain `rename_attributes` and runs before signal-specific rules.
* Transform order matters: apply global (`all`) rules before signal-specific transforms.
* When migrating between schema versions, step through intermediate versions sequentially (X → X+1 → ... → Y).
* Use `rename_metrics` to change a metric's name and `rename_attributes` to change labels/attributes.
* Resource-level renames use `rename_attributes`.
* Always set `schema_url` to the highest schema version declared; it travels with telemetry.
* In `metrics.rename_attributes`, omitting `apply_to_metrics` makes the renaming apply to all metrics.
* Span selectors and event selectors can scope renames to specific spans or span events.
* The collector’s schema processor upgrades/downgrades telemetry by applying rename-based transforms in version order.
* Keep transforms minimal and rename-focused to limit complexity and reduce the chance of unintended semantic changes.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/ej4v9LnsFuza8uyJ/images/Prep-Course-OpenTelemetry-Certified-Associate-OTCA-Certification/Transforming-Telemetry-Pipeline-Processing/Check-and-Reflect-Schema-Summary/knowledge-check-file-format-software-versioning.jpg?fit=max&auto=format&n=ej4v9LnsFuza8uyJ&q=85&s=d1a3ac4aa1cd217d1d78f970686a44da" alt="The image is a slide titled &#x22;Knowledge Check #1 – File Format and Order,&#x22; showing five concepts related to software versioning processes, including patch increment, minor increment, all section, transform orders, and version stepping." width="1920" height="1080" data-path="images/Prep-Course-OpenTelemetry-Certified-Associate-OTCA-Certification/Transforming-Telemetry-Pipeline-Processing/Check-and-Reflect-Schema-Summary/knowledge-check-file-format-software-versioning.jpg" />
</Frame>

Practical notes and rules of thumb

* Always put `all` (global) `rename_attributes` rules first so broad attribute renames are applied before signal-specific renames.
* Use `rename_metrics` for the metric name itself and `rename_attributes` for metric labels.
* Use `apply_to_metrics` (when available) to scope an attribute rename to selected metric names; if omitted, the rename applies to all metrics.
* For spans and span events, use selectors such as `apply_to_spans` or `apply_to_events` to limit renames to specific names or patterns.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/ej4v9LnsFuza8uyJ/images/Prep-Course-OpenTelemetry-Certified-Associate-OTCA-Certification/Transforming-Telemetry-Pipeline-Processing/Check-and-Reflect-Schema-Summary/urls-schema-evolution-steps-diagram.jpg?fit=max&auto=format&n=ej4v9LnsFuza8uyJ&q=85&s=ddbf48c2a577c166df7ba90a5d891d72" alt="The image outlines four steps about URLs and schema evolution, focusing on schema URLs, processors, versioning, and transformation types, using icons and colored backgrounds to distinguish each step." width="1920" height="1080" data-path="images/Prep-Course-OpenTelemetry-Certified-Associate-OTCA-Certification/Transforming-Telemetry-Pipeline-Processing/Check-and-Reflect-Schema-Summary/urls-schema-evolution-steps-diagram.jpg" />
</Frame>

Quick reference table — transform types and example usage

| Transform type                  | Purpose                                                     | Example                                                                                                                                                                              |
| ------------------------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `rename_metrics`                | Change the metric's canonical name                          | `yaml<br> - rename_metrics:<br>     old.metric.name: new.metric.name<br>`                                                                                                            |
| `rename_attributes` (metrics)   | Rename metric labels; can be scoped with `apply_to_metrics` | `yaml<br> - rename_attributes:<br>     attribute_map:<br>       old_label: new_label<br>     apply_to_metrics: ["new.metric.name"]<br>`                                              |
| `rename_attributes` (resources) | Rename resource attributes                                  | `yaml<br> - rename_attributes:<br>     attribute_map:<br>       old_resource_attr: new_resource_attr<br>`                                                                            |
| Conditional selectors           | Scope renames to spans or events                            | `yaml<br> - rename_attributes:<br>     attribute_map:<br>       old_label: new_label<br>     apply_to_spans: ["service.span.name"]<br>     apply_to_events: ["span.event.name"]<br>` |

Example schema snippet (concise)

```yaml theme={null}
schema_url: https://opentelemetry.io/schemas/1.26.0

metrics:
  changes:
    - rename_metrics:
        old.metric.name: new.metric.name
    - rename_attributes:
        attribute_map:
          old_label: new_label
        # Optional scoping (commented examples):
        # apply_to_metrics: ["new.metric.name"]

resources:
  changes:
    - rename_attributes:
        attribute_map:
          old_resource_attr: new_resource_attr

# Span or span-events scoping can also be expressed with conditional selectors:
# - rename_attributes:
#     attribute_map:
#       old_label: new_label
#     # apply_to_spans: ["service.span.name"]
#     # apply_to_events: ["span.event.name"]
```

<Callout icon="lightbulb" color="#1CB2FE">
  Best practice: Always set `schema_url` to the highest schema version you list in the configuration. The schema URL travels with telemetry and the collector uses it to decide which transforms to apply when upgrading or downgrading. For further details, see the OpenTelemetry schema docs: [https://opentelemetry.io/docs/](https://opentelemetry.io/docs/).
</Callout>

Final recap — rules to remember

* Schema versioning follows semantic versioning: patch = no change, minor = backward-compatible additions, major = breaking changes.
* Schema files have organized sections: `all`, `resources`, `spans`, `span_events`, `metrics`, and `logs`. Use each section for focused transforms.
* The collector’s schema processor applies transforms sequentially, version-by-version (X → X+1 → ... → target).
* Favor rename-only transforms and minimal change sets to avoid accidental semantic shifts.

<Callout icon="warning" color="#FF6B6B">
  Validate your YAML and ensure keys and `schema_url` values are spelled correctly (for example, `opentelemetry.io`). YAML syntax errors or incorrect keys can prevent the collector from loading schema transforms.
</Callout>

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/prep-course-opentelemetry-certified-associate-certification-otca/module/85787c66-c021-47d9-bd3d-db54bc002465/lesson/aec14517-49d2-4509-bc8c-2f1f8c0ffdbc" />
</CardGroup>
