Skip to content

Commit

Permalink
Merge branch 'main' into remove_prometheus_exec
Browse files Browse the repository at this point in the history
  • Loading branch information
jinja2 authored Aug 17, 2023
2 parents 103d417 + eb7add8 commit fffb924
Show file tree
Hide file tree
Showing 17 changed files with 788 additions and 773 deletions.
276 changes: 137 additions & 139 deletions go.mod

Large diffs are not rendered by default.

571 changes: 284 additions & 287 deletions go.sum

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion internal/confmapprovider/discovery/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ type mapProvider struct {
logger *zap.Logger
configs map[string]*Config
discoverer *discoverer
retrieved *confmap.Retrieved
}

func New() (Provider, error) {
Expand Down Expand Up @@ -170,6 +171,12 @@ func (m *mapProvider) retrieve(scheme string) func(context.Context, string, conf
}

if strings.HasPrefix(uri, discoveryModeScheme) {
// https://github.com/open-telemetry/opentelemetry-collector/pull/6833/
// introduced repeated config resolution call so we need to memoize the provider to avoid
// duplicate loading. TODO: expand this to be uri based for all providers
if m.retrieved != nil {
return m.retrieved, nil
}
var bundledCfg *Config
if bundledCfg, ok = m.configs["<bundled>"]; !ok {
m.logger.Debug("loading bundle.d")
Expand All @@ -188,7 +195,8 @@ func (m *mapProvider) retrieve(scheme string) func(context.Context, string, conf
if err != nil {
return nil, fmt.Errorf("failed to successfully discover target services: %w", err)
}
return confmap.NewRetrieved(discoveryCfg)
m.retrieved, err = confmap.NewRetrieved(discoveryCfg)
return m.retrieved, err
}

return nil, fmt.Errorf("unsupported %s scheme %q", scheme, uri)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fffb924

Please sign in to comment.