opentelemetry-collector icon indicating copy to clipboard operation
opentelemetry-collector copied to clipboard

Add a default build configuration to ocb.

Open jpeach opened this issue 2 years ago • 7 comments

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 avatar Jul 26 '22 06:07 jpeach

Codecov Report

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

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

:exclamation: 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%) :arrow_down:
component/extension.go 86.66% <0.00%> (-13.34%) :arrow_down:
pdata/plog/json.go 85.00% <0.00%> (-13.06%) :arrow_down:
pdata/internal/data/bytesid.go 81.25% <0.00%> (-6.75%) :arrow_down:
processor/processorhelper/logs.go 84.37% <0.00%> (-5.63%) :arrow_down:
processor/processorhelper/traces.go 84.37% <0.00%> (-5.63%) :arrow_down:
processor/processorhelper/metrics.go 84.37% <0.00%> (-5.63%) :arrow_down:
exporter/exporterhelper/traces.go 83.87% <0.00%> (-2.80%) :arrow_down:
exporter/exporterhelper/logs.go 81.96% <0.00%> (-2.78%) :arrow_down:
exporter/exporterhelper/metrics.go 81.96% <0.00%> (-2.78%) :arrow_down:
... 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.

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

codecov[bot] avatar Jul 26 '22 06:07 codecov[bot]

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 avatar Jul 27 '22 01:07 jpeach

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

jpeach avatar Jul 27 '22 02:07 jpeach

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 avatar Aug 01 '22 14:08 jpkrohling

PR rebased.

jpkrohling avatar Aug 01 '22 17:08 jpkrohling

# github.com/influxdata/influxdb-observability/common
Error: /home/runner/go/pkg/mod/github.com/influxdata/influxdb-observability/[email protected]/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/[email protected]/metrics_sort.go:57:21: hdp.MExplicitBounds undefined (type internal.HistogramDataPoint has no field or method MExplicitBounds)

jpeach avatar Aug 02 '22 06:08 jpeach

The failure is related to https://github.com/open-telemetry/opentelemetry-collector/issues/5770

jpkrohling avatar Aug 02 '22 16:08 jpkrohling

LGTM, but the versions need to be bumped.

Updated

jpeach avatar Aug 09 '22 03:08 jpeach

@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?

bogdandrutu avatar Sep 01 '22 18:09 bogdandrutu

@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.

jpeach avatar Sep 01 '22 21:09 jpeach

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

jpeach avatar Sep 11 '22 23:09 jpeach