From 7d2cb74e293e1261e3808c0db6bfc8cbeaefb0d0 Mon Sep 17 00:00:00 2001 From: xu0o0 Date: Wed, 29 Nov 2023 00:42:56 +0800 Subject: [PATCH] [chore][extension] update NotifyConfig contract (#9005) **Description:** The collector implementation makes a copy of effective configuration before calling `NotifyConfig` so it's safe for the config watcher to save the pointer and use it later. It is resonable to promise this in the API contract. **Link to tracking Issue:** https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/29277#discussion_r1406522281 --------- Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com> --- extension/extension.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extension/extension.go b/extension/extension.go index b19f4236734..292358b33ba 100644 --- a/extension/extension.go +++ b/extension/extension.go @@ -45,6 +45,9 @@ type PipelineWatcher interface { // wishes to be notified of the Collector's effective configuration. type ConfigWatcher interface { // NotifyConfig notifies the extension of the Collector's current effective configuration. + // The extension owns the `confmap.Conf`. Callers must ensure that it's safe for + // extensions to store the `conf` pointer and use it concurrently with any other + // instances of `conf`. NotifyConfig(ctx context.Context, conf *confmap.Conf) error }