Skip to content

Commit

Permalink
[confmap] Write up note about null maps (#10380)
Browse files Browse the repository at this point in the history
#### Link to tracking issue
Closes
#9931
  • Loading branch information
TylerHelmuth authored Jun 10, 2024
1 parent 7704414 commit 1a20888
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
57 changes: 57 additions & 0 deletions confmap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,60 @@ configuration retrieved via the `Provider` used to retrieve the “initial” co
```

The `Resolver` does that by passing an `onChange` func to each `Provider.Retrieve` call and capturing all watch events.

## Troubleshooting

### Null Maps

Due to how our underlying merge library, [koanf](https://github.com/knadh/koanf), behaves, configuration resolution
will treat configuration such as

```yaml
processors:
```
as null, which is a valid value. As a result if you have configuration `A`:

```yaml
receivers:
nop:
processors:
nop:
exporters:
nop:
extensions:
nop:
service:
extensions: [nop]
pipelines:
traces:
receivers: [nop]
processors: [nop]
exporters: [nop]
```

and configuration `B`:

```yaml
processors:
```

and do `./otelcorecol --config A.yaml --config B.yaml`

The result will be an error:

```
Error: invalid configuration: service::pipelines::traces: references processor "nop" which is not configured
2024/06/10 14:37:14 collector server run finished with error: invalid configuration: service::pipelines::traces: references processor "nop" which is not configured
```

This happens because configuration `B` sets `processors` to null, removing the `nop` processor defined in configuration `A`,
so the `nop` processor referenced in configuration `A`'s pipeline no longer exists.

This situation can be remedied 2 ways:
1. Use `{}` when you want to represent an empty map, such as `processors: {}` instead of `processors:`.
2. Omit configuration like `processors:` from your configuration.
4 changes: 4 additions & 0 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,7 @@ error: `The service process could not connect to the service controller`. In
this case the `NO_WINDOWS_SERVICE=1` environment variable should be set to force
the collector to be started as if it were running in an interactive terminal,
without attempting to run as a Windows service.

### Null Maps in Configuration

If you've ever experienced issues during configuration resolution where sections, like `processors:` from earlier configuration are removed, see [confmap](../confmap/README.md#troubleshooting)

0 comments on commit 1a20888

Please sign in to comment.