Skip to content

[pkg/ottl] Validate that all parts of a Key are used by a Context #30051

@TylerHelmuth

Description

@TylerHelmuth

Component(s)

pkg/ottl

Is your feature request related to a problem? Please describe.

OTTL currently validates that a context "consumes" all segments in a path, but does not validate that all a path's keys are used. This means users can do something like name["foo"] in the span context and get back the name of the span, completely ignoring the foo key. In this scenario the context is allowing parsing to succeed when it shouldnt. To simplify this process for all the different contexts, we can build something into OTTL, similar to Path validation, but for Keys.

Things to consider:

  • Should we validate just the first key? - [pkg/ottl] Don't check that all keys are used #30047 (comment)
  • How will key validation interact with dynamic indexing? If we don't know the value of the key until hot path execution, how should we validate that all keys are being considered?
  • Should we have a way for contexts to declare that they've reached a point where the map is arbitrarily deep? So a context exposing a path of underlying type map[string]string would not declare this since stringMap["key"]["nestedKey"] would be invalid. But a context would declare this for an attributes path since the type is map[string]any and attributes["key1"]["key2"][...] is valid. - Originally from [pkg/ottl] Don't check that all keys are used #30047 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions