Skip to content

Commit

Permalink
[opampsupervisor] avoid nil pointer access when reporting remote conf…
Browse files Browse the repository at this point in the history
…ig status (#36849)

#### Description

When working on an unrelated PR I noticed that one of the opamp
supervisor e2e tests was randomly failing, due to a nil pointer access -
see
https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/12350739300/job/34464544343?pr=36844#step:8:647
This PR avoids this by using the `GetConfigHash()` method of the
`remoteConfig` instead of directly accessing the `ConfigHash` property.

#### Link to tracking issue

Fixes #36850

---------

Signed-off-by: Florian Bacher <[email protected]>
  • Loading branch information
bacherfl authored Dec 16, 2024
1 parent 1f10e2d commit ddfadc2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions .chloggen/opampsupervisor-nil-pointer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: opampsupervisor

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: avoid nil pointer access when reporting the last received remote config

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [ 36850 ]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
2 changes: 1 addition & 1 deletion cmd/opampsupervisor/supervisor/supervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ func (s *Supervisor) saveLastReceivedOwnTelemetrySettings(set *protobufs.Telemet

func (s *Supervisor) reportConfigStatus(status protobufs.RemoteConfigStatuses, errorMessage string) {
err := s.opampClient.SetRemoteConfigStatus(&protobufs.RemoteConfigStatus{
LastRemoteConfigHash: s.remoteConfig.ConfigHash,
LastRemoteConfigHash: s.remoteConfig.GetConfigHash(),
Status: status,
ErrorMessage: errorMessage,
})
Expand Down

0 comments on commit ddfadc2

Please sign in to comment.