-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 "components" Command #6322
Add "components" Command #6322
Conversation
0f14527
to
73be175
Compare
Missed adding the distribution version, adding it now |
Hi, please I noticed something about the flag, it is always, true. I am fixing that now Update: Fixed it |
Signed-off-by: Maureen <amaka013@gmail.com>
240fa64
to
f0c3ead
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution @Chinwendu20! Please add a unit test for the new functionality.
Adding entries to the changelog is done via yaml files in the .chloggen
directory. Please take a look at https://github.com/open-telemetry/opentelemetry-collector/blob/main/CONTRIBUTING.md#adding-a-changelog-entry for all the details!
Codecov ReportBase: 91.66% // Head: 91.13% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #6322 +/- ##
==========================================
- Coverage 91.66% 91.13% -0.53%
==========================================
Files 240 245 +5
Lines 13815 14143 +328
==========================================
+ Hits 12663 12889 +226
- Misses 921 1002 +81
- Partials 231 252 +21
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. |
Signed-off-by: Maureen <amaka013@gmail.com>
I have pushed the new change for the changelog and unit test. I am still waiting for your response to the "logger.info" recommendation, thank you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried it locally and this is what I got:
$ ./bin/otelcorecol_linux_amd64 --build-info
version: 0.62.1-dev
receivers:
- otlp
processors:
- batch
- memory_limiter
exporters:
- otlphttp
- logging
- otlp
extensions:
- memory_ballast
- zpages
This looks nice!
service/flags.go
Outdated
) | ||
|
||
var ( | ||
// Command-line flag that control the configuration file. | ||
gatesList = featuregate.FlagValue{} | ||
BuildFlag bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be public
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, thanks. I would be changing that.
service/flags.go
Outdated
"strings" | ||
|
||
"fmt" | ||
"go.opentelemetry.io/collector/config" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why the linter didn't catch this. The import order seems odd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run make lint
and see if it complains. I expect it to complain with something like this:
service/flags.go:20: File is not `goimports`-ed with -local go.opentelemetry.io/collector (goimports)
"fmt"
You can then run the following command to fix it automatically for you:
make fmt
service/flags.go
Outdated
) | ||
|
||
type configFlagValue struct { | ||
values []string | ||
sets []string | ||
} | ||
|
||
type componentsOutput struct { | ||
Version string | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the extraneous empty lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, changing that. Thanks
service/flags.go
Outdated
components.Version = set.BuildInfo.Version | ||
|
||
yamlData, err := yaml.Marshal(components) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this empty line, keeping the error check close to where the error is received.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, thank you. On it.
service/flags_test.go
Outdated
} | ||
ExpectedYamlStruct := componentsOutput{ | ||
Version: "latest", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reconsider the empty lines here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok thank you
Thank youu |
Co-authored-by: Juraci Paixão Kröhling <juraci.github@kroehling.de>
Once this is ready for review again, please ping me. Note that there's a merge conflict now that needs to be solved. |
Okay, thank you. On it. |
Signed-off-by: Maureen <amaka013@gmail.com>
Signed-off-by: Maureen <amaka013@gmail.com>
Signed-off-by: Maureen <amaka013@gmail.com>
Thanks @jpkrohling. I have pushed with the changes. |
Oh missed writing a test. I would push that soon |
Signed-off-by: Maureen <amaka013@gmail.com>
I have pushed with the test @jpkrohling |
Signed-off-by: Maureen <amaka013@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, but @Aneurysm9 and @codeboten had comments as well, I would want to request their approval in addition to mine.
service/command.go
Outdated
|
||
"github.com/spf13/cobra" | ||
"gopkg.in/yaml.v3" | ||
|
||
"go.opentelemetry.io/collector/config" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those two imports should be together (go.opentelemetry.io/collector/...
) but I think the linter will tell you that as well :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks I attempted putting them together but when I ran "make fmt", it sorted them back in this order
Thank you all for your time and patience with me. I have fixed the lint test but the build test, am afraid would still fail. I ran "make test" locally and it fails probably because there is no test in the telemetry package. I would need your guidance:
|
Signed-off-by: Maureen <amaka013@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can see the issue here:
=== RUN TestNewBuildSubCommand
==================
WARNING: DATA RACE
Write at 0x00c000209b50 by goroutine 17:
go.opentelemetry.io/collector/service.TestNewBuildSubCommand.func1()
/home/runner/work/opentelemetry-collector/opentelemetry-collector/service/command_build_info_test.go:73 +0xdd
Previous write at 0x00c000209b50 by goroutine 42:
go.opentelemetry.io/collector/service.TestNewBuildSubCommand()
/home/runner/work/opentelemetry-collector/opentelemetry-collector/service/command_build_info_test.go:78 +0xce4
testing.tRunner()
/opt/hostedtoolcache/go/1.18.7/x64/src/testing/testing.go:1439 +0x213
testing.(*T).Run.func1()
/opt/hostedtoolcache/go/1.18.7/x64/src/testing/testing.go:1486 +0x47
Goroutine 17 (running) created at:
go.opentelemetry.io/collector/service.TestNewBuildSubCommand()
/home/runner/work/opentelemetry-collector/opentelemetry-collector/service/command_build_info_test.go:71 +0xc85
testing.tRunner()
/opt/hostedtoolcache/go/1.18.7/x64/src/testing/testing.go:1439 +0x213
testing.(*T).Run.func1()
/opt/hostedtoolcache/go/1.18.7/x64/src/testing/testing.go:1486 +0x47
Goroutine 42 (running) created at:
testing.(*T).Run()
/opt/hostedtoolcache/go/1.18.7/x64/src/testing/testing.go:1486 +0x724
testing.runTests.func1()
/opt/hostedtoolcache/go/1.18.7/x64/src/testing/testing.go:1839 +0x99
testing.tRunner()
/opt/hostedtoolcache/go/1.18.7/x64/src/testing/testing.go:1439 +0x213
testing.runTests()
/opt/hostedtoolcache/go/1.18.7/x64/src/testing/testing.go:1837 +0x7e4
testing.(*M).Run()
/opt/hostedtoolcache/go/1.18.7/x64/src/testing/testing.go:1719 +0xa71
main.main()
_testmain.go:113 +0x2e4
==================
Wow that is new. I would look into it |
Signed-off-by: Maureen <amaka013@gmail.com>
Thank you so much @codeboten. I have pushed a commit that should fix the error that you referenced but what I commented about the command, "make test" still stands, please look at my most recent screenshot. The codecov test also fails but I have written a test for my feature, any advice? |
@Chinwendu20 I've submitted a change to your PR to use |
Thank you. The unit tests are passing now. I will fix the lint test |
Signed-off-by: Maureen <amaka013@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the work @Chinwendu20!
Bit of cleanup left over from open-telemetry#6322.
Bit of cleanup left over from #6322.
Hello, please I would like to push a commit updating the readme with the correct command name and I would also like to update the file name of the command |
@Chinwendu20, please open a new PR with the new commit. |
Okay thank you |
Enhancement: Added build command to output components in collector distribution in YAML format Signed-off-by: Maureen <amaka013@gmail.com> Co-authored-by: Juraci Paixão Kröhling <juraci.github@kroehling.de> Co-authored-by: Alex Boten <aboten@lightstep.com>
Bit of cleanup left over from open-telemetry#6322.
Enhancement: Added build command to output components in collector distribution in YAML format Signed-off-by: Maureen <amaka013@gmail.com> Co-authored-by: Juraci Paixão Kröhling <juraci.github@kroehling.de> Co-authored-by: Alex Boten <aboten@lightstep.com>
Bit of cleanup left over from open-telemetry#6322.
Signed-off-by: Maureen amaka013@gmail.com
Description:
Enhancement: Added build command to output components in collector distribution in YAML format
Link to tracking Issue: Closes #4671
Documentation: I would open an issue on opentelemetry.io for the documentation, however, I updated the readme of the service package.
@jpkrohling please check this out