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

[confmap] Mark confmap.strictlyTypedInput as stable #10793

Merged
merged 13 commits into from
Aug 20, 2024

Conversation

mx-psi
Copy link
Member

@mx-psi mx-psi commented Aug 2, 2024

Description

Marks confmap.strictlyTypedInput as stable.

Link to tracking issue

Fixes #10552

Blocked by:

Copy link

codecov bot commented Aug 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.69%. Comparing base (d2ed276) to head (8216734).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10793      +/-   ##
==========================================
+ Coverage   91.60%   91.69%   +0.09%     
==========================================
  Files         404      404              
  Lines       18990    18953      -37     
==========================================
- Hits        17395    17379      -16     
+ Misses       1235     1216      -19     
+ Partials      360      358       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mx-psi mx-psi marked this pull request as ready for review August 5, 2024 11:33
@mx-psi mx-psi requested review from a team, songy23 and TylerHelmuth August 5, 2024 11:33
@mx-psi mx-psi added the release:blocker The issue must be resolved before cutting the next release label Aug 5, 2024
Copy link
Member

@songy23 songy23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mx-psi mx-psi removed the release:blocker The issue must be resolved before cutting the next release label Aug 7, 2024
@mx-psi
Copy link
Member Author

mx-psi commented Aug 7, 2024

Discussed on the stability meeting from 2024-08-07, we can have this for v0.108.0 instead of v0.107.0

@TylerHelmuth
Copy link
Member

@mx-psi ready for a rebase

@mx-psi mx-psi force-pushed the mx-psi/strict-typing-stable branch from cd787dd to 7325c66 Compare August 14, 2024 12:26
@dmitryax
Copy link
Member

dmitryax commented Aug 15, 2024

I've run into an interesting edge case. Investigating now. Please don't merge for now

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mx-psi, just one question

err = fmt.Errorf("cannot unmarshal the configuration: %w", err)

if globalgates.StrictlyTypedInputGate.IsEnabled() {
var shouldAddCoda bool
Copy link
Contributor

@codeboten codeboten Aug 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm likely missing context here, but in other places in this PR we've kept the behaviour inside the check if the StrictlyTypedInputGate.IsEnabled and here it's removed, is this correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The coda says:

Hint: Temporarily restore the previous behavior by disabling 
      the `confmap.strictlyTypedInput` feature gate. More details at:
      https://github.com/open-telemetry/opentelemetry-collector/issues/10552

which is not actionable after this PR is merged (you cannot disable the feature gate). Should we keep some sort of custom message? It could make sense to give people a place where they can complain

@mx-psi mx-psi requested a review from codeboten August 16, 2024 08:49
@mx-psi
Copy link
Member Author

mx-psi commented Aug 16, 2024

I've run into an interesting edge case. Investigating now. Please don't merge for now

👍, if you find something, could you file a separate issue?

@mx-psi
Copy link
Member Author

mx-psi commented Aug 16, 2024

I found one issue that should be fixed here #10897

@dmitryax
Copy link
Member

I found one issue that should be fixed here #10897

This is exactly what I've run into as well. Thanks @mx-psi!

@mx-psi
Copy link
Member Author

mx-psi commented Aug 19, 2024

Last call before I merge this cc @open-telemetry/collector-approvers.

I checked the two real issues reported on #10552 and verified that these were fixed with the binary:

Can't pass a number to a string field

Issue: #10552 (comment) (can't pass a number to a string field)

Config used to reproduce the issue:

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: ${env:ENDPOINT}

exporters:
  nop:

service:
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [nop]

Logs with 0.107.0:

❯ ENDPOINT=1234 ./otelcol --config config.yaml 
Error: failed to get config: cannot unmarshal the configuration: decoding failed due to the following error(s):

error decoding 'receivers': error reading configuration for "otlp": decoding failed due to the following error(s):

error decoding '': decoding failed due to the following error(s):

'protocols.grpc.endpoint' expected type 'string', got unconvertible type 'int', value: '1234'

Hint: Temporarily restore the previous behavior by disabling 
      the `confmap.strictlyTypedInput` feature gate. More details at:
      https://github.com/open-telemetry/opentelemetry-collector/issues/10552
2024/08/19 18:31:22 collector server run finished with error: failed to get config: cannot unmarshal the configuration: decoding failed due to the following error(s):

error decoding 'receivers': error reading configuration for "otlp": decoding failed due to the following error(s):

error decoding '': decoding failed due to the following error(s):

'protocols.grpc.endpoint' expected type 'string', got unconvertible type 'int', value: '1234'

Hint: Temporarily restore the previous behavior by disabling 
      the `confmap.strictlyTypedInput` feature gate. More details at:
      https://github.com/open-telemetry/opentelemetry-collector/issues/10552

Logs with HEAD (fails to start but passes validation and unmarshaling):

❯ ENDPOINT=1234 ./bin/otelcorecol_linux_amd64 --config config.yaml 
2024-08-19T18:18:35.255+0200    info    service@v0.107.0/service.go:114 Setting up own telemetry...
2024-08-19T18:18:35.255+0200    info    service@v0.107.0/telemetry.go:98        Serving metrics {"address": ":8888", "metrics level": "Normal"}
2024-08-19T18:18:35.258+0200    info    service@v0.107.0/service.go:193 Starting otelcorecol... {"Version": "0.107.0-dev", "NumCPU": 20}
2024-08-19T18:18:35.258+0200    info    extensions/extensions.go:37     Starting extensions...
2024-08-19T18:18:35.258+0200    info    otlpreceiver@v0.107.0/otlp.go:103       Starting GRPC server    {"kind": "receiver", "name": "otlp", "data_type": "traces", "endpoint": "1234"}
2024-08-19T18:18:35.258+0200    error   graph/graph.go:430      Failed to start component       {"error": "listen tcp: address 1234: missing port in address", "type": "Receiver", "id": "otlp"}
2024-08-19T18:18:35.258+0200    info    service@v0.107.0/service.go:256 Starting shutdown...
2024-08-19T18:18:35.258+0200    info    extensions/extensions.go:64     Stopping extensions...
2024-08-19T18:18:35.258+0200    info    service@v0.107.0/service.go:270 Shutdown complete.
Error: cannot start pipelines: listen tcp: address 1234: missing port in address
2024/08/19 18:18:35 collector server run finished with error: cannot start pipelines: listen tcp: address 1234: missing port in address
TLS min version in env variable

Issue: #10552 (comment)

Config used to reproduce the issue:

receivers:
  nop:

exporters:
  otlphttp:
    endpoint: localhost:4317
    tls:
      min_version: ${env:TLS_MIN_VERSION}

service:
  pipelines:
    traces:
      receivers: [nop]
      exporters: [otlphttp]

Logs with 0.107.0:

❯ TLS_MIN_VERSION=1.2 ./otelcol --config config.yaml 
Error: failed to get config: cannot unmarshal the configuration: decoding failed due to the following error(s):

error decoding 'exporters': error reading configuration for "otlphttp": decoding failed due to the following error(s):

'tls.min_version' expected type 'string', got unconvertible type 'float64', value: '1.2'

Hint: Temporarily restore the previous behavior by disabling 
      the `confmap.strictlyTypedInput` feature gate. More details at:
      https://github.com/open-telemetry/opentelemetry-collector/issues/10552
2024/08/19 18:32:18 collector server run finished with error: failed to get config: cannot unmarshal the configuration: decoding failed due to the following error(s):

error decoding 'exporters': error reading configuration for "otlphttp": decoding failed due to the following error(s):

'tls.min_version' expected type 'string', got unconvertible type 'float64', value: '1.2'

Hint: Temporarily restore the previous behavior by disabling 
      the `confmap.strictlyTypedInput` feature gate. More details at:
      https://github.com/open-telemetry/opentelemetry-collector/issues/10552

Logs with HEAD:

❯ TLS_MIN_VERSION=1.2 ./bin/otelcorecol_linux_amd64 --config config.yaml 
2024-08-19T18:26:25.705+0200    info    service@v0.107.0/service.go:114 Setting up own telemetry...
2024-08-19T18:26:25.706+0200    info    service@v0.107.0/telemetry.go:98        Serving metrics {"address": ":8888", "metrics level": "Normal"}
2024-08-19T18:26:25.709+0200    info    service@v0.107.0/service.go:193 Starting otelcorecol... {"Version": "0.107.0-dev", "NumCPU": 20}
2024-08-19T18:26:25.709+0200    info    extensions/extensions.go:37     Starting extensions...
2024-08-19T18:26:25.710+0200    info    service@v0.107.0/service.go:219 Everything is ready. Begin running and processing data.
2024-08-19T18:26:25.710+0200    info    localhostgate/featuregate.go:63 The default endpoints for all servers in components have changed to use localhost instead of 0.0.0.0. Disable the feature gate to temporarily revert to the previous default.     {"feature gate ID": "component.UseLocalHostAsDefaultHost"}
^C2024-08-19T18:26:27.819+0200  info    otelcol@v0.107.0/collector.go:318       Received signal from OS {"signal": "interrupt"}
2024-08-19T18:26:27.819+0200    info    service@v0.107.0/service.go:256 Starting shutdown...
2024-08-19T18:26:27.819+0200    info    extensions/extensions.go:64     Stopping extensions...
2024-08-19T18:26:27.819+0200    info    service@v0.107.0/service.go:270 Shutdown complete.

I have looked into adding end to end tests, I think we can and should do that, but it will take some time and I don't want to block this and confmap 1.0 on these tests.

@mx-psi mx-psi merged commit e477c3a into open-telemetry:main Aug 20, 2024
49 checks passed
@mx-psi mx-psi deleted the mx-psi/strict-typing-stable branch August 20, 2024 08:05
@github-actions github-actions bot added this to the next release milestone Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracking issue for confmap.strictlyTypedInput feature gate
5 participants