Skip to content

Support nested OTEL attributes for Clickhouse exporter#313

Merged
mheffner merged 12 commits intomainfrom
nested-ch-attrs
Mar 2, 2026
Merged

Support nested OTEL attributes for Clickhouse exporter#313
mheffner merged 12 commits intomainfrom
nested-ch-attrs

Conversation

@mheffner
Copy link
Contributor

This is a version based on the PR #293 from @brightsparc that adds support for nested OTEL attributes when using the Clickhouse exporter with JSON attribute type. The depth of nesting is controlled by the --clickhouse-exporter-nested-kv-max-depth parameter, which defaults to 3. We have a limit to prevent possible DoS from infinitely recursing too deep. In most cases, 3 should be plenty, but some GenAI attributes may require more depth.

A chunk of this is a test added that can be run locally against CH, but is not included by default. This helped Claude implement and verify the encoding change.

@mheffner
Copy link
Contributor Author

I pulled this into the Lambda Forwarder and verified it's support on some nested CloudTrail logs. I'm considering making a depth of 5 default for the forwarder.

@mheffner
Copy link
Contributor Author

mheffner commented Mar 2, 2026

Confirmed in previous PR that this works for the nested GenAI attributes as well.

Copy link
Contributor

@rjenkins rjenkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a question about one of the depth checks, but otherwise looks good.


Some(Value::ArrayValue(a)) => {
let within_depth = match max_depth {
None => depth == 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this check for max depth different than the one above?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a comment earlier on the previous method, but it's a combination of the existing key/value handling that is done with cheaper key flattening (in transformer) and the need to maintain the flat simple value arrays. In this "flat mode" (depth=0) we maintain arrays of simple values at the top, but don't allow complex types. Key/values would be flattened earlier in the transformer, so the check is less important.

@mheffner mheffner merged commit 0651c90 into main Mar 2, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants