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

Closed
h0cheung opened this issue Apr 11, 2024 · 5 comments
Closed

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

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

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 <[email protected]>
Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

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

@github-actions github-actions bot added the Stale label Jun 17, 2024
@crobert-1
Copy link
Member

It looks like this was resolved by #32501, but please let me know if I misunderstood.

@li-zeyuan
Copy link
Contributor

It looks like this was resolved by #32501, but please let me know if I misunderstood.

Yes, it has been fixed.

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 Stale
Projects
None yet
Development

No branches or pull requests

3 participants