Skip to content

Jinja toyaml filter weirdness #825

@lmolkova

Description

@lmolkova

Try this

weaver.yaml

templates:
  - pattern: schema.j2
    filter: .
    application_mode: single
    file_name: next-version-dev/schema.yaml

whitespace_control:
  trim_blocks: true
  lstrip_blocks: true
  keep_trailing_newline: true

template

{{ ctx | toyaml }}

produces something weird (one group for all of them, full output: https://gist.github.com/lmolkova/d1ea914a2b802fcfff08629d03d9dfca)

groups:
- attributes:
  - brief: |
      Uniquely identifies the framework API revision offered by a version (`os.version`) of the android operating system. More information can be found [here](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels).
    examples:
    - \u002733\u0027
    - \u002732\u0027
   ...
  - brief: |
      This attribute represents the state of the application.
    examples:
    - created
    name: android.app.state
  ...
  metric_name: null
  name: null
  span_kind: null
  type: attribute_group
  unit: null
- attributes:
   ...
  metric_name: null
  name: null
  span_kind: null
  type: attribute_group
...

also escaping is wrong

  brief: \u0027Deprecated, use `db.client.connection.create_time` instead. Note: the unit also changed from `ms` to `s`.\u0027

tojson works like a charm. See open-telemetry/semantic-conventions#2469 for the details

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions