Skip to content

Commit 26fb7cb

Browse files
authored
[otelcol] remove deprecated interface ConfmapProvider (#10934)
Signed-off-by: Alex Boten <[email protected]>
1 parent 3c1cf33 commit 26fb7cb

File tree

3 files changed

+25
-59
lines changed

3 files changed

+25
-59
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: breaking
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
7+
component: otelcol
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Remove deprecated `ConfmapProvider` interface.
11+
12+
# One or more tracking issues or pull requests related to the change
13+
issues: [10934]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# Optional: The change log or logs in which this entry should be included.
21+
# e.g. '[user]' or '[user, api]'
22+
# Include 'user' if the change is relevant to end users.
23+
# Include 'api' if there is a change to a library API.
24+
# Default: '[user]'
25+
change_logs: []

otelcol/configprovider.go

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,6 @@ type ConfigProvider interface {
4444
Shutdown(ctx context.Context) error
4545
}
4646

47-
// ConfmapProvider is an optional interface to be implemented by ConfigProviders
48-
// to provide confmap.Conf objects representing a marshaled version of the
49-
// Collector's configuration.
50-
//
51-
// The purpose of this interface is that otelcol.ConfigProvider structs do not
52-
// necessarily need to use confmap.Conf as their underlying config structure.
53-
//
54-
// Deprecated: [v0.105.0] This interface is deprecated. otelcol.Collector will now obtain
55-
// a confmap.Conf object from the unmarshaled config itself.
56-
type ConfmapProvider interface {
57-
// GetConfmap resolves the Collector's configuration and provides it as a confmap.Conf object.
58-
//
59-
// Should never be called concurrently with itself or any ConfigProvider method.
60-
GetConfmap(ctx context.Context) (*confmap.Conf, error)
61-
}
62-
6347
type configProvider struct {
6448
mapResolver *confmap.Resolver
6549
}
@@ -117,15 +101,3 @@ func (cm *configProvider) Watch() <-chan error {
117101
func (cm *configProvider) Shutdown(ctx context.Context) error {
118102
return cm.mapResolver.Shutdown(ctx)
119103
}
120-
121-
// Deprecated: [v0.105.0] Call `(*confmap.Conf).Marshal(*otelcol.Config)` to get
122-
// the Collector's configuration instead.
123-
func (cm *configProvider) GetConfmap(ctx context.Context) (*confmap.Conf, error) {
124-
conf, err := cm.mapResolver.Resolve(ctx)
125-
126-
if err != nil {
127-
return nil, fmt.Errorf("cannot resolve the configuration: %w", err)
128-
}
129-
130-
return conf, nil
131-
}

otelcol/configprovider_test.go

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -106,34 +106,3 @@ func TestConfigProviderFile(t *testing.T) {
106106

107107
assert.EqualValues(t, configNop, cfg)
108108
}
109-
110-
func TestGetConfmap(t *testing.T) {
111-
uriLocation := "file:" + filepath.Join("testdata", "otelcol-nop.yaml")
112-
fileProvider := newFakeProvider("file", func(_ context.Context, _ string, _ confmap.WatcherFunc) (*confmap.Retrieved, error) {
113-
return confmap.NewRetrieved(newConfFromFile(t, uriLocation[5:]))
114-
})
115-
set := ConfigProviderSettings{
116-
ResolverSettings: confmap.ResolverSettings{
117-
URIs: []string{uriLocation},
118-
ProviderFactories: []confmap.ProviderFactory{fileProvider},
119-
},
120-
}
121-
122-
configBytes, err := os.ReadFile(filepath.Join("testdata", "otelcol-nop.yaml"))
123-
require.NoError(t, err)
124-
125-
yamlMap := map[string]any{}
126-
err = yaml.Unmarshal(configBytes, yamlMap)
127-
require.NoError(t, err)
128-
129-
cp, err := NewConfigProvider(set)
130-
require.NoError(t, err)
131-
132-
cmp, ok := cp.(ConfmapProvider)
133-
require.True(t, ok)
134-
135-
cmap, err := cmp.GetConfmap(context.Background())
136-
require.NoError(t, err)
137-
138-
assert.EqualValues(t, yamlMap, cmap.ToStringMap())
139-
}

0 commit comments

Comments
 (0)