mirror of
https://github.com/hanzoai/telemetry.git
synced 2026-10-30 20:01:49 +00:00
This PR contains the following updates: | Package | Change | Age | Confidence | |---|---|---|---| | golang.org/x/mod | `v0.28.0` -> `v0.30.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | golang.org/x/sys | `v0.37.0` -> `v0.38.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | golang.org/x/tools | `v0.38.0` -> `v0.39.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Configuration 📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/open-telemetry/opentelemetry-collector). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi4xOS45IiwidXBkYXRlZEluVmVyIjoiNDIuMTkuOSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIiwicmVub3ZhdGVib3QiXX0=--> --------- Signed-off-by: alex boten <[email protected]> Co-authored-by: Hanzo Dev <[email protected]> Co-authored-by: Pablo Baeyens <[email protected]> Co-authored-by: Alex Boten <[email protected]> Co-authored-by: Pablo Baeyens <[email protected]>
60 lines
1.6 KiB
Go
60 lines
1.6 KiB
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package otelcol // import "go.opentelemetry.io/collector/otelcol"
|
|
|
|
import (
|
|
"errors"
|
|
"flag"
|
|
"strings"
|
|
|
|
"go.opentelemetry.io/collector/featuregate"
|
|
)
|
|
|
|
const (
|
|
configFlag = "config"
|
|
)
|
|
|
|
type configFlagValue struct {
|
|
values []string
|
|
sets []string
|
|
}
|
|
|
|
func (s *configFlagValue) Set(val string) error {
|
|
s.values = append(s.values, val)
|
|
return nil
|
|
}
|
|
|
|
func (s *configFlagValue) String() string {
|
|
return "[" + strings.Join(s.values, ", ") + "]"
|
|
}
|
|
|
|
func flags(reg *featuregate.Registry) *flag.FlagSet {
|
|
flagSet := new(flag.FlagSet)
|
|
|
|
cfgs := new(configFlagValue)
|
|
flagSet.Var(cfgs, configFlag, "Locations to the config file(s), note that only a"+
|
|
" single location can be set per flag entry e.g. `--config=file:/path/to/first --config=file:path/to/second`.")
|
|
|
|
flagSet.Func("set",
|
|
"Set arbitrary component config property. The component has to be defined in the config file and the flag"+
|
|
" has a higher precedence. Array config properties are overridden and maps are joined. Example --set=processors.batch.timeout=2s",
|
|
func(s string) error {
|
|
before, after, ok := strings.Cut(s, "=")
|
|
if !ok {
|
|
// No need for more context, see TestSetFlag/invalid_set.
|
|
return errors.New("missing equal sign")
|
|
}
|
|
cfgs.sets = append(cfgs.sets, "yaml:"+strings.TrimSpace(strings.ReplaceAll(before, ".", "::"))+": "+strings.TrimSpace(after))
|
|
return nil
|
|
})
|
|
|
|
reg.RegisterFlags(flagSet)
|
|
return flagSet
|
|
}
|
|
|
|
func getConfigFlag(flagSet *flag.FlagSet) []string {
|
|
cfv := flagSet.Lookup(configFlag).Value.(*configFlagValue)
|
|
return append(cfv.values, cfv.sets...)
|
|
}
|