> For the complete documentation index, see [llms.txt](https://docs.bindplane.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bindplane.com/integrations/processors/group-by-attributes.md).

# Group by Attributes

Groups records by attribute keys, moving the named attributes onto the resource so telemetry that shares those values is collected under one resource. When no keys are given, records that already share the same attributes are compacted into a single resource. Works on logs, metrics, and traces.

### Supported Telemetry

| Metrics | Logs | Traces |
| ------- | ---- | ------ |
| ✓       | ✓    | ✓      |

Choose Telemetry Type selects which signals this instance acts on. It defaults to all three; per-signal attribute keys are configured independently below.

### Configuration

<figure><img src="/files/ooROOGDFCpNxPo2wQIcC" alt="Bindplane docs - Group by Attributes - image 1"><figcaption></figcaption></figure>

**General**

| Parameter             | Type               | Required | Default               | Description                                                                                    |
| --------------------- | ------------------ | -------- | --------------------- | ---------------------------------------------------------------------------------------------- |
| Choose Telemetry Type | Telemetry Selector | No       | Logs, Metrics, Traces | The signals this instance runs on. Each selected signal exposes its own Attribute Fields list. |

**Logs**

| Parameter        | Type    | Required | Default   | Description                                                                                                                                                                     |
| ---------------- | ------- | -------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Attribute Fields | Strings | No       | *(empty)* | A list of log attribute field names to group by and move to the resource. If none are specified, resources with the same attributes are compacted. Shown when Logs is selected. |

**Metrics**

| Parameter        | Type    | Required | Default   | Description                                                                                                                                                                                     |
| ---------------- | ------- | -------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Attribute Fields | Strings | No       | *(empty)* | A list of metric datapoint attribute field names to group by and move to the resource. If none are specified, resources with the same attributes are compacted. Shown when Metrics is selected. |

**Traces**

| Parameter        | Type    | Required | Default   | Description                                                                                                                                                                        |
| ---------------- | ------- | -------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Attribute Fields | Strings | No       | *(empty)* | A list of span attribute field names to group by and move to the resource. If none are specified, resources with the same attributes are compacted. Shown when Traces is selected. |

### Examples

#### Promote log attributes to the resource

Move the `user`, `env`, and `region` attributes off each log record onto the resource. Logs that share the same values for those keys are grouped under one resource.

```yaml
apiVersion: bindplane.observiq.com/v1
kind: Processor
metadata:
  name: group-by-attributes
spec:
  type: group_by_attributes
  parameters:
    - name: telemetry_types
      value:
        - Logs
    - name: log_attributes
      value:
        - user
        - env
        - region
```

#### Compact telemetry after batching

With no attribute keys specified, the processor compacts records that already share identical resource and scope attributes into a single resource. Placing it after the Batch processor reduces duplicated resources and the number of export requests sent downstream.

```yaml
apiVersion: bindplane.observiq.com/v1
kind: Processor
metadata:
  name: group-by-attributes
spec:
  type: group_by_attributes
  parameters:
    - name: telemetry_types
      value:
        - Logs
        - Metrics
        - Traces
```

### Configuration Tips

* Leaving Attribute Fields empty enables compaction only. Use this after the Batch processor to collapse duplicated resources before export.
* Promoted keys are removed from the record and written to the resource. Choose low-cardinality keys; promoting a high-cardinality attribute (such as a request ID) creates one resource per distinct value and increases memory and export overhead.
* Configure each signal's Attribute Fields independently. The same key list does not carry across Logs, Metrics, and Traces.

### Troubleshooting

#### Records are not grouped as expected

Symptoms: telemetry still arrives under separate resources after the processor runs.

Solutions:

1. Confirm the named keys exist as attributes on the records (log attributes, metric datapoint attributes, or span attributes for the matching signal).
2. Verify the signal is selected in Choose Telemetry Type so its Attribute Fields list is applied.

#### Compaction has no effect

Symptoms: no reduction in resource count or export requests when Attribute Fields is empty.

Solutions:

1. Compaction only merges records whose resource and scope attributes already match. If they differ, they remain separate resources.
2. Place the processor after the Batch processor so multiple matching records are present in the same payload to compact.

### Standalone Processor

```yaml
apiVersion: bindplane.observiq.com/v1
kind: Processor
metadata:
  name: group-by-attributes
spec:
  type: group_by_attributes
  parameters:
    - name: telemetry_types
      value:
        - Logs
        - Metrics
        - Traces
    - name: log_attributes
      value:
        - user
        - env
        - region
    - name: metric_attributes
      value:
        - service.name
        - region
    - name: trace_attributes
      value:
        - service.name
        - deployment.environment
```

### Related Resources

* [groupbyattrs processor — OpenTelemetry Collector Contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/groupbyattrsprocessor)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.bindplane.com/integrations/processors/group-by-attributes.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
