Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
h0cheung opened this issue Apr 11, 2024 · 2 comments
Open

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

h0cheung opened this issue Apr 11, 2024 · 2 comments
Labels
bug Something isn't working pkg/stanza

Comments

@h0cheung
Copy link
Contributor

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?

@h0cheung h0cheung added bug Something isn't working needs triage New item requiring triage labels Apr 11, 2024
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@crobert-1
Copy link
Member

Removing needs triage based on code owner's response on PR that will resolve this issue.

@crobert-1 crobert-1 removed the needs triage New item requiring triage label Apr 15, 2024
djaglowski added a commit that referenced this issue Apr 19, 2024
…unc 'Build' returns an error (#32501)

**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
bug: 
- collector launch fail with '--feature-gates=logs.jsonParserArray'

how to fix:
1. `func init()` always register operator to `operator.DefaultRegistry`.
2. when the `jsonArrayParserFeatureGate` is disabled, the func `Build`
returns an error.

**Link to tracking Issue:** <Issue number if applicable>

#32313

---------

Co-authored-by: Daniel Jaglowski <jaglows3@gmail.com>
rimitchell pushed a commit to rimitchell/opentelemetry-collector-contrib that referenced this issue May 8, 2024
…unc 'Build' returns an error (open-telemetry#32501)

**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
bug: 
- collector launch fail with '--feature-gates=logs.jsonParserArray'

how to fix:
1. `func init()` always register operator to `operator.DefaultRegistry`.
2. when the `jsonArrayParserFeatureGate` is disabled, the func `Build`
returns an error.

**Link to tracking Issue:** <Issue number if applicable>

open-telemetry#32313

---------

Co-authored-by: Daniel Jaglowski <jaglows3@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pkg/stanza
Projects
None yet
Development

No branches or pull requests

2 participants