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

Add a default build configuration to ocb. #5752

Merged
merged 1 commit into from
Sep 13, 2022

Conversation

jpeach
Copy link
Contributor

@jpeach jpeach commented Jul 26, 2022

Description:

Embed the build configuration that is used to build otelcorecol into ocb
so that end users can easily generate a useful collector. This makes the
--config flag optional again.

Link to tracking Issue:

None.

Testing:

$ make ocb
/Library/Developer/CommandLineTools/usr/bin/make -C cmd/builder config
sed '-e/replaces:/,$d' <../otelcorecol/builder-config.yaml > internal/config/default.yaml
/Library/Developer/CommandLineTools/usr/bin/make -C cmd/builder ocb
GO111MODULE=on CGO_ENABLED=0 go build -trimpath -o ../../bin/ocb_darwin_arm64 .
$ ./bin/ocb_darwin_arm64
2022-07-26T16:05:06.722+1000	INFO	internal/command.go:91	OpenTelemetry Collector Builder	{"version": "dev", "date": "unknown"}
2022-07-26T16:05:06.722+1000	INFO	internal/command.go:102	Using default build configuration
2022-07-26T16:05:06.723+1000	INFO	builder/config.go:99	Using go	{"go-executable": "/opt/homebrew/bin/go"}
2022-07-26T16:05:06.724+1000	INFO	builder/main.go:76	Sources created	{"path": "/var/folders/hf/8frlwk6s40j0wj3jpgbq94z00000gp/T/otelcol-distribution1809706932"}
2022-07-26T16:05:06.913+1000	INFO	builder/main.go:108	Getting go modules
2022-07-26T16:05:06.942+1000	INFO	builder/main.go:87	Compiling
2022-07-26T16:05:07.948+1000	INFO	builder/main.go:94	Compiled	{"binary": "/var/folders/hf/8frlwk6s40j0wj3jpgbq94z00000gp/T/otelcol-distribution1809706932/otelcorecol"}

Documentation:

None.

@jpeach jpeach requested review from a team and dmitryax July 26, 2022 06:05
@codecov
Copy link

codecov bot commented Jul 26, 2022

Codecov Report

Base: 91.89% // Head: 91.90% // Increases project coverage by +0.01% 🎉

Coverage data is based on head (17f982e) compared to base (36f0b5c).
Patch has no changes to coverable lines.

❗ Current head 17f982e differs from pull request most recent head b52d1b5. Consider uploading reports for the commit b52d1b5 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5752      +/-   ##
==========================================
+ Coverage   91.89%   91.90%   +0.01%     
==========================================
  Files         213      200      -13     
  Lines       13357    12414     -943     
==========================================
- Hits        12274    11409     -865     
+ Misses        862      793      -69     
+ Partials      221      212       -9     
Impacted Files Coverage Δ
extension/experimental/storage/nop_client.go 33.33% <0.00%> (-16.67%) ⬇️
component/extension.go 86.66% <0.00%> (-13.34%) ⬇️
pdata/plog/json.go 85.00% <0.00%> (-13.06%) ⬇️
pdata/internal/data/bytesid.go 81.25% <0.00%> (-6.75%) ⬇️
processor/processorhelper/logs.go 84.37% <0.00%> (-5.63%) ⬇️
processor/processorhelper/traces.go 84.37% <0.00%> (-5.63%) ⬇️
processor/processorhelper/metrics.go 84.37% <0.00%> (-5.63%) ⬇️
exporter/exporterhelper/traces.go 83.87% <0.00%> (-2.80%) ⬇️
exporter/exporterhelper/logs.go 81.96% <0.00%> (-2.78%) ⬇️
exporter/exporterhelper/metrics.go 81.96% <0.00%> (-2.78%) ⬇️
... and 57 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@TylerHelmuth TylerHelmuth left a comment

Choose a reason for hiding this comment

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

Is it possible to add a new happy-path test to test/test.sh to test this new functionality? It would be good to have a test that verifies the ocb can be run without a config.

cmd/builder/internal/config/default.yaml Outdated Show resolved Hide resolved
// configuration file. This is the same configuration that otelcorecol is
// built with.
func DefaultProvider() koanf.Provider {
return fs.Provider(configs, "default.yaml")
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to use FS here or could we use file.Provider instead? I ask bc Fs is listed as experimental still.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I found it marked experimental on the github page: https://github.com/knadh/koanf#bundled-providers. That particular line hasn't been updated in 13 months, so could be out of date.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. I was looking at the source and godoc, which doesn't mention experimental status. We can switch to the file provider, but the code needed for that will be basically the same as the fs one, so I don't think there's much benefit.

@jpeach
Copy link
Contributor Author

jpeach commented Jul 27, 2022

Is it possible to add a new happy-path test to test/test.sh to test this new functionality? It would be good to have a test that verifies the ocb can be run without a config.

Done

builder jpeach$ ./test/test.sh
Using /opt/homebrew/bin/go to compile the distributions.
Running the tests in /var/folders/hf/8frlwk6s40j0wj3jpgbq94z00000gp/T/tmp.1yTemUe3I7
✅ PASS default
✅ PASS core

@jpeach
Copy link
Contributor Author

jpeach commented Jul 27, 2022

Pretty sure that this PR doesn't break contrib-tests.

@jpkrohling jpkrohling self-requested a review July 28, 2022 17:31
@jpkrohling
Copy link
Member

jpkrohling commented Aug 1, 2022

I just restarted the failed job. If it fails, please try rebasing this PR, as there might be some incompatibility problem not caused by this PR but fixed in the main branch already (on either side).

@jpkrohling
Copy link
Member

PR rebased.

@jpeach
Copy link
Contributor Author

jpeach commented Aug 2, 2022

# github.com/influxdata/influxdb-observability/common
Error: /home/runner/go/pkg/mod/github.com/influxdata/influxdb-observability/common@v0.2.24/metrics_sort.go:56:43: hdp.MExplicitBounds undefined (type internal.HistogramDataPoint has no field or method MExplicitBounds)
Error: /home/runner/go/pkg/mod/github.com/influxdata/influxdb-observability/common@v0.2.24/metrics_sort.go:57:21: hdp.MExplicitBounds undefined (type internal.HistogramDataPoint has no field or method MExplicitBounds)

@jpkrohling
Copy link
Member

The failure is related to #5770

@jpeach jpeach force-pushed the ocb-default-config branch 2 times, most recently from e9e3c44 to 08f3c67 Compare August 3, 2022 00:17
Copy link
Member

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

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

LGTM, but the versions need to be bumped.

cmd/builder/internal/config/default.yaml Outdated Show resolved Hide resolved
@jpeach
Copy link
Contributor Author

jpeach commented Aug 9, 2022

LGTM, but the versions need to be bumped.

Updated

CHANGELOG.md Outdated
- `ocb` now exits with an error if it fails to load the build configuration. (#5731)
- Deprecate `HTTPClientSettings.ToClientWithHost` (#5737)
- Deprecate `HTTPClientSettings.ToClientWithHost`. (#5737)
Copy link
Member

Choose a reason for hiding this comment

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

Confused about these changes...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just making the formatting consistent

Copy link
Member

Choose a reason for hiding this comment

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

Please split them in a separate PR :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

reverted and rebased

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can rebase this again. Is it ready to merge when I do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

rebases 🤷

Copy link
Member

Choose a reason for hiding this comment

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

@bogdandrutu, I believe this PR is pending on your side. Would you be able to review/merge this?

Copy link
Member

@bogdandrutu bogdandrutu Sep 1, 2022

Choose a reason for hiding this comment

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

I think it should be your side as well, we should not have "refactoring, formatting" changes in the same PR. I sent a separate PR #6012

@bogdandrutu
Copy link
Member

@jpkrohling can you document the motivation? Does not seem to be that useful to produce a standard collector that we already produce and release anyway?

@jpeach
Copy link
Contributor Author

jpeach commented Sep 1, 2022

@jpkrohling can you document the motivation? Does not seem to be that useful to produce a standard collector that we already produce and release anyway?

Originally, when you ran ocb with no configuration, it generated a collector with no plugins, which was completely useless (see my other PR which adds a way to know what plugins you have included in the collector). The original documentation for all this claimed that ocb would produce a "default collector" when run without any arguments, and this PR restores that claim, so users can build the default collector.

Embed the build configuration that is used to build otelcorecol into ocb
so that end users can easily generate a useful collector. This makes the
`--config` flag optional again.

Signed-off-by: James Peach <jpeach@cloudflare.com>
@jpeach
Copy link
Contributor Author

jpeach commented Sep 11, 2022

@open-telemetry/collector-approvers is this ready to merge?

Copy link
Member

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

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

LGTM, but I can't merge.

@bogdandrutu, could you review and merge this if you think it's ready?

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.

4 participants