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

# Add Cluster Info

> This action adds static resource attributes to spans, metrics data points and log records. It is useful to add cluster-wide attributes to all telemetry signals.

## Considerations

<Warning>
  Before enabling **add cluster info**, please note the following:

  * This action is meant to be used for **static** attributes that are known in advanced. It is not suitable for dynamic attributes that need to be extracted from an API or calculated at runtime.
  * Some destinations may require specific configuration to index resource attributes and make them available for querying. Please refer to the documentation of the destination you are using for more information.
  * If the attribute already exists in the telemetry signal, the value will be overwritten by the value provided in the action.
  * An empty string is a valid value for the `attributeStringValue` field
</Warning>

## Configuration Options

The AddClusterInfo action is configured using the `odigos.io/v1alpha1.Action` CRD with the `addClusterInfo` configuration section.

<AccordionGroup>
  <Accordion title="actionName">
    **actionName** `string` : Allows you to attach a meaningful name to the action for convenience.

    * This field is *optional*
    * <Icon icon="triangle-exclamation" iconType="solid" color="yellow" /> Odigos does not use or assume any meaning from this field
  </Accordion>

  <Accordion title="notes">
    **notes** `string` : Allows you to attach notes regarding the action for convenience.

    * This field is *optional*
    * <Icon icon="triangle-exclamation" iconType="solid" color="yellow" /> Odigos does not use or assume any meaning from this field
  </Accordion>

  <Accordion title="disabled">
    **disabled** `boolean` : Allows you to temporarily disable the action, but keep it saved for future use.

    * This field is *optional*, and defaults to `false`
  </Accordion>

  <Accordion title="signals *">
    **signals** `string[]` : An array with the signals that the action will operate on.

    * This field is *required*
    * Supported values: `TRACES`, `METRICS`, `LOGS`
  </Accordion>

  <Accordion title="addClusterInfo *">
    **addClusterInfo** `object` : Configuration for the AddClusterInfo action.

    * This field is *required* for this action type

    <AccordionGroup>
      <Accordion title="clusterAttributes *">
        **clusterAttributes** `object[]` : An array of attributes to be added to the telemetry signals.

        * This field is *required*

        <AccordionGroup>
          <Accordion title="attributeName *">
            **attributeName** `string` : The name of the attribute to be added to the telemetry signals.

            * This field is *required*
          </Accordion>

          <Accordion title="attributeStringValue *">
            **attributeStringValue** `string` : The value of the attribute to be added to the telemetry signals.

            * This field is *required*
          </Accordion>
        </AccordionGroup>
      </Accordion>

      <Accordion title="overwriteExistingValues">
        **overwriteExistingValues** `boolean` : Whether to overwrite existing attribute values.

        * This field is *optional*, and defaults to `false`
      </Accordion>
    </AccordionGroup>
  </Accordion>
</AccordionGroup>

You can include any static value attribute that is meaningful to you, like `team.name` etc.

<Tip>
  We recommend:

  * `k8s.cluster.name`: The name of the k8s cluster which can be useful to distinguish between different clusters.
  * `deployment.environment`: The environment of the cluster (e.g. `production`, `staging`, `development`, etc).
</Tip>

## Basic Example

The following example demonstrates how to insert the `k8s.cluster.name` attribute to all telemetry signals using the new Action CRD.

<Steps>
  <Step>
    Create a YAML file with the following content:

    ```yaml insert-cluster-name.yaml theme={null}
    apiVersion: odigos.io/v1alpha1
    kind: Action
    metadata:
      name: insert-cluster-name
      namespace: odigos-system
    spec:
      actionName: insert-cluster-name
      signals:
        - TRACES
        - METRICS
        - LOGS
      addClusterInfo:
        clusterAttributes:
          - attributeName: k8s.cluster.name
            attributeStringValue: my-cluster
    ```
  </Step>

  <Step>
    Apply the action to the cluster:

    ```bash theme={null}
    kubectl apply -f insert-cluster-name.yaml
    ```
  </Step>
</Steps>
