Skip to content

Commit 18c718b

Browse files
srikanthccvsbylica-splunk
authored andcommitted
[cmd/opampsupervisor]: do not log err when last received doesn't exist (open-telemetry#36014)
1 parent 9873ff3 commit 18c718b

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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: bug_fix
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: cmd/opampsupervisor
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Do not log err if the last received doesn't exist
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [36013]
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+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: []

cmd/opampsupervisor/supervisor/supervisor.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -782,15 +782,18 @@ func (s *Supervisor) loadAndWriteInitialMergedConfig() error {
782782
if s.config.Capabilities.AcceptsRemoteConfig {
783783
// Try to load the last received remote config if it exists.
784784
lastRecvRemoteConfig, err = os.ReadFile(filepath.Join(s.config.Storage.Directory, lastRecvRemoteConfigFile))
785-
if err == nil {
785+
switch {
786+
case err == nil:
786787
config := &protobufs.AgentRemoteConfig{}
787788
err = proto.Unmarshal(lastRecvRemoteConfig, config)
788789
if err != nil {
789790
s.logger.Error("Cannot parse last received remote config", zap.Error(err))
790791
} else {
791792
s.remoteConfig = config
792793
}
793-
} else {
794+
case errors.Is(err, os.ErrNotExist):
795+
s.logger.Info("No last received remote config found")
796+
default:
794797
s.logger.Error("error while reading last received config", zap.Error(err))
795798
}
796799
} else {

0 commit comments

Comments
 (0)