Skip to content

Commit

Permalink
add flag.Parse so HandlFlags works correctly (#14214) (#14225)
Browse files Browse the repository at this point in the history
* add flag.Parse so HandlFlags works correctly

* fix: move flag init outside package initialization

Since go 1.13 testing flags are now only registered when running
a test binary, and packages that call flag.Parse during package
initialization may cause tests to fail.

To resolve this move the flag init to a proper function outside of
package init and call it explicitly

* build(deps): bump the dependencies group in /systemtest with 2 updates (#14213)

Bumps the dependencies group in /systemtest with 2 updates: [go.opentelemetry.io/collector/pdata](https://github.com/open-telemetry/opentelemetry-collector) and [go.opentelemetry.io/collector/semconv](https://github.com/open-telemetry/opentelemetry-collector).

Updates `go.opentelemetry.io/collector/pdata` from 1.15.0 to 1.16.0
- [Release notes](https://github.com/open-telemetry/opentelemetry-collector/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-collector/blob/main/CHANGELOG-API.md)
- [Commits](open-telemetry/opentelemetry-collector@pdata/v1.15.0...pdata/v1.16.0)

Updates `go.opentelemetry.io/collector/semconv` from 0.109.0 to 0.110.0
- [Release notes](https://github.com/open-telemetry/opentelemetry-collector/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-collector/blob/main/CHANGELOG-API.md)
- [Commits](open-telemetry/opentelemetry-collector@v0.109.0...v0.110.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/collector/pdata
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: go.opentelemetry.io/collector/semconv
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump go.elastic.co/go-licence-detector (#14212)

Bumps the dependencies group in /tools with 1 update: [go.elastic.co/go-licence-detector](https://github.com/elastic/go-licence-detector).

Updates `go.elastic.co/go-licence-detector` from 0.6.1 to 0.7.0
- [Release notes](https://github.com/elastic/go-licence-detector/releases)
- [Commits](elastic/go-licence-detector@v0.6.1...v0.7.0)

---
updated-dependencies:
- dependency-name: go.elastic.co/go-licence-detector
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: kruskall <[email protected]>

* ci: use ephemeral tokens (#14217)

* build(deps): bump github.com/elastic/elastic-agent-system-metrics from 0.11.2 to 0.11.3 (#14211)

* build(deps): bump github.com/elastic/elastic-agent-system-metrics

Bumps [github.com/elastic/elastic-agent-system-metrics](https://github.com/elastic/elastic-agent-system-metrics) from 0.11.2 to 0.11.3.
- [Release notes](https://github.com/elastic/elastic-agent-system-metrics/releases)
- [Commits](elastic/elastic-agent-system-metrics@v0.11.2...v0.11.3)

---
updated-dependencies:
- dependency-name: github.com/elastic/elastic-agent-system-metrics
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update NOTICE.txt

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: kruskall <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: kruskal <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Victor Martinez <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
(cherry picked from commit 7efa6d5)

Co-authored-by: Lee E Hinman <[email protected]>
  • Loading branch information
mergify[bot] and leehinman authored Oct 1, 2024
1 parent fe02a75 commit 3484778
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions cmd/apm-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
)

func main() {
beatcmd.InitBeatCmd()
rootCmd := beatcmd.NewRootCommand(beatcmd.BeatParams{
NewRunner: func(args beatcmd.RunnerParams) (beatcmd.Runner, error) {
return beater.NewRunner(beater.RunnerParams{
Expand Down
4 changes: 3 additions & 1 deletion internal/beatcmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package beatcmd

import (
cryptorand "crypto/rand"
"flag"
"log"
"math"
"math/big"
Expand All @@ -38,7 +39,7 @@ import (
_ "github.com/elastic/beats/v7/libbeat/publisher/queue/memqueue"
)

func init() {
func InitBeatCmd() {
initRand()
initFlags()
}
Expand All @@ -62,6 +63,7 @@ func initFlags() {
}
}

flag.Parse()
if err := cfgfile.HandleFlags(); err != nil {
log.Fatal(err)
}
Expand Down
1 change: 1 addition & 0 deletions x-pack/apm-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ func cleanup() error {
}

func Main() error {
beatcmd.InitBeatCmd()
rootCmd := newXPackRootCommand(
func(args beatcmd.RunnerParams) (beatcmd.Runner, error) {
return beater.NewRunner(beater.RunnerParams{
Expand Down
1 change: 1 addition & 0 deletions x-pack/apm-server/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
)

func TestSubCommands(t *testing.T) {
beatcmd.InitBeatCmd()
rootCmd := newXPackRootCommand(func(beatcmd.RunnerParams) (beatcmd.Runner, error) {
panic("unexpected call")
})
Expand Down

0 comments on commit 3484778

Please sign in to comment.