Skip to content

feature gate logs.jsonParserArray doesn't work. #32313

Closed
@h0cheung

Description

@h0cheung

Component(s)

pkg/stanza

What happened?

Description

After enabling feature gate logs.jsonParserArray, when I try to use json_array_parser, it still reports unsupported type 'json_array_parser'

Steps to Reproduce

Try to use json_array_parser in a config file. Then launch otelcol-contrib with --feature-gates=logs.jsonParserArray.

Expected Result

It should launch normally.

Actual Result

It reports unsupported type 'json_array_parser' and exits.

Collector version

v0.95.0

Environment information

Environment

OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

receivers: 
  filelog:
    include:
    - /tmp/test.log
    include_file_path: true
    include_file_name: false
    preserve_leading_whitespaces: true
    max_log_size: 40kb
    operators:
    - type: json_array_parser
      parse_to: body

exporters:
  debug:

service:
  pipelines:
    logs:
      receivers:
      - filelog
      exporters:
      - debug

Log output

Error: failed to get config: cannot unmarshal the configuration: 1 error(s) decoding:

* error decoding 'receivers': error reading configuration for "filelog": 1 error(s) decoding:

* error decoding 'operators[0]': unsupported type 'json_array_parser'
2024/04/11 14:34:58 collector server run finished with error: failed to get config: cannot unmarshal the configuration: 1 error(s) decoding:

* error decoding 'receivers': error reading configuration for "filelog": 1 error(s) decoding:

* error decoding 'operators[0]': unsupported type 'json_array_parser'

Additional context

The parser checks feature gates in init(), which seems to run before the command line arguements have been loaded?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions