> For the complete documentation index, see [llms.txt](https://archivedocs.stackstate.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://archivedocs.stackstate.com/5.1/stackpacks/integrations/opentelemetry/manual-instrumentation/relations.md).

# Relations between components

## Overview

Component and span relations show the relationship between components in StackState. For example, the image below shows a relation running from a parent to a child component, that child also then has another component as a child component:

```
Service Name: Parent Component
|
---> Service Name: Child Component
     |
     ---> Service Name: Child 2 Component
```

An example of the above displayed in StackState will show up as follows:

![Topology Perspective - Unmerged OTEL Components](/files/nsMIgOe0Wc5rqib386Zr)

These relations are based on the parent and child structure. A relationship is drawn from a parent component to a child component.

This means that:

* `Service Name: Child Component` has the parent ID set as `Service Name: Parent Component`
* `Service Name: Child 2 Component` has the parent ID set as `Service Name: Child Component`

## Health state propagation

In StackState, the health state of a component will propagate upwards through the dependency tree. This means that in the following situation:

```
Service Name: Parent Component
|
---> Service Name: Child Component [400 Status]
     |
     ---> Service Name: Child 2 Component
```

The following components will have a propagated CRITICAL state:

```
Service Name: Parent Component [Propagated 400 Status]
|
---> Service Name: Child Component [400 Status]
     |
     ---> Service Name: Child 2 Component
```

A visual example of this in the StackState UI will be as follows:

![Topology Perspective - OTEL Components CRITICAL State](/files/ST0yO6dqWyBKD8kE7Hzl)

So remember to create your parent and children spans in the correct order as it may affect the propagation of health state.

➡️ [Learn more about health state propagation](/5.1/use/concepts/health-state.md#element-propagated-health-state)

## Relations when merging

Relations are retained when merging components; this allows you to create a parent component, create a child component for this parent and then merge that child component with an existing component. This will then create a relationship between the pre-existing component that the child component merged with and the parent component. For example, here we have the three components as described above:

![Topology Perspective - OTEL Components and Pre-Existing Components](/files/Gmh2ZSYMhAsAKalRcvis)

If we then merge our middle component `Service Name: Child Component` with the existing healthy Lambda component `otel-example-custom-instrumentation-dev-create-custom-component` in the bottom right corner:

* The middle component will disappear (merged with the Lambda component)
* The Lambda component will have relations to the first and third components (inherited relation mappings from the middle component).

![Topology Perspective - Merged with Healthy Component](/files/WKWSb3WEwhQpS6czrIkw)

## Multiple children

It's also good to know that a single parent can have multiple children. This allows you to build a tree with branches of relations, for example:

```
Service Name: Parent Component
|
---> Service Name: Child Component
|
---> Service Name: Child 2 Component
```

![Topology Perspective - OTEL Components with Multiple Children](/files/IkC2c4Io0THnecVy2uuB)
