Skip to content

Commit 9b5e1e8

Browse files
authored
[cmd/opampsupervisor] chore: Unify package capability config options (#49770)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Remove the `reports_package_statuses` capability config option. The `accepts_packages` option now enables both the AcceptsPackages and ReportsPackageStatuses OpAMP capabilities. Neither capability was functional. The supervisor exits with an error at startup when configured, so no working configuration is affected. <!-- Issue number (e.g. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue Resolves #49762 <!--Describe what testing was performed and which tests were added.--> #### Testing - e2e tests updated - Unit tests updated <!--Describe the documentation added.--> #### Documentation - Documentation updated <!--Authorship attestation. See AGENTS.md for details. AI agents must not check this box on behalf of the user; the human author must check it themselves before the PR is ready for review.--> #### Authorship - [x] I, a human, wrote this pull request description myself. <!--Please delete paragraphs that you did not use before submitting.-->
1 parent 446ac57 commit 9b5e1e8

7 files changed

Lines changed: 44 additions & 24 deletions

File tree

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: breaking
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: Remove the `reports_package_statuses` capability config option. The `accepts_packages` option now enables both the AcceptsPackages and ReportsPackageStatuses OpAMP capabilities.
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: [49762]
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: Neither capability was functional; the supervisor exits with an error at startup when configured, so no working configuration is affected.
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: [user]

cmd/opampsupervisor/e2e_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,7 +1559,7 @@ func TestSupervisorConfiguresCapabilities(t *testing.T) {
15591559
}
15601560

15611561
func TestSupervisorPackageCapabilitiesReturnError(t *testing.T) {
1562-
// Verifies that when accepts_packages or reports_package_statuses are enabled,
1562+
// Verifies that when accepts_packages is enabled,
15631563
// the supervisor fails to start and never connects to the server.
15641564
if runtime.GOOS == "windows" {
15651565
t.Skip("Zap does not close the log file and Windows disallows removing files that are still opened.")
@@ -1590,7 +1590,7 @@ func TestSupervisorPackageCapabilitiesReturnError(t *testing.T) {
15901590
s, err := supervisor.NewSupervisor(t.Context(), logger, cfg)
15911591
require.NoError(t, err)
15921592
err = s.Start(t.Context())
1593-
require.ErrorContains(t, err, "accepts_packages and reports_package_statuses capabilities are not yet fully implemented")
1593+
require.ErrorContains(t, err, "accepts_packages capability is not yet fully implemented")
15941594
require.False(t, connected.Load(), "Supervisor should not have connected to the server")
15951595
}
15961596

cmd/opampsupervisor/specification/README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,14 @@ capabilities:
9191
accepts_opamp_connection_settings: # false if unspecified
9292

9393
# The Supervisor can accept Collector executable package updates.
94+
# Enables both the AcceptsPackages and ReportsPackageStatuses OpAMP
95+
# capabilities.
9496
# NOTE: This capability is not yet fully implemented.
9597
accepts_packages: # false if unspecified
9698

9799
# The Supervisor will report EffectiveConfig to the Server.
98100
reports_effective_config: # true if unspecified
99101

100-
# The Supervisor can report the status of Collector package updates.
101-
# NOTE: This capability is not yet fully implemented.
102-
reports_package_statuses: # false if unspecified
103-
104102
# The Collector will report own metrics to the destination specified by
105103
# the Server.
106104
reports_own_metrics: # true if unspecified
@@ -636,8 +634,9 @@ included in AgentDescription is expected to change after the executable
636634
is updated).
637635

638636
> **Note:** The collector executable update flow is not yet fully implemented.
639-
> The `accepts_packages` and `reports_package_statuses` capabilities are accepted
640-
> in configuration but are currently disabled at runtime. See
637+
> The `accepts_packages` capability (which enables both the AcceptsPackages and
638+
> ReportsPackageStatuses OpAMP capabilities) is accepted
639+
> in configuration but is currently disabled at runtime. See
641640
> [#47272](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/47272)
642641
> for implementation progress.
643642

cmd/opampsupervisor/supervisor/config/config.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ type Capabilities struct {
100100
ReportsAvailableComponents bool `mapstructure:"reports_available_components"`
101101
ReportsHeartbeat bool `mapstructure:"reports_heartbeat"`
102102
AcceptsPackages bool `mapstructure:"accepts_packages"`
103-
ReportsPackageStatuses bool `mapstructure:"reports_package_statuses"`
104103
}
105104

106105
func (c Capabilities) SupportedCapabilities() protobufs.AgentCapabilities {
@@ -149,14 +148,13 @@ func (c Capabilities) SupportedCapabilities() protobufs.AgentCapabilities {
149148
supportedCapabilities |= protobufs.AgentCapabilities_AgentCapabilities_ReportsHeartbeat
150149
}
151150

152-
// AcceptsPackages and ReportsPackageStatuses are not yet fully implemented.
153-
// They are included here for completeness.
151+
// AcceptsPackages is not yet fully implemented. It is included here for completeness.
154152
// See https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/47272
153+
// AcceptsPackages enables both the AcceptsPackages and ReportsPackageStatuses
154+
// OpAMP capabilities; accepting packages without reporting their statuses is not useful.
155155
if c.AcceptsPackages {
156-
supportedCapabilities |= protobufs.AgentCapabilities_AgentCapabilities_AcceptsPackages
157-
}
158-
if c.ReportsPackageStatuses {
159-
supportedCapabilities |= protobufs.AgentCapabilities_AgentCapabilities_ReportsPackageStatuses
156+
supportedCapabilities |= protobufs.AgentCapabilities_AgentCapabilities_AcceptsPackages |
157+
protobufs.AgentCapabilities_AgentCapabilities_ReportsPackageStatuses
160158
}
161159

162160
return supportedCapabilities
@@ -457,7 +455,6 @@ func DefaultSupervisor() Supervisor {
457455
ReportsAvailableComponents: false,
458456
ReportsHeartbeat: true,
459457
AcceptsPackages: false,
460-
ReportsPackageStatuses: false,
461458
},
462459
Storage: Storage{
463460
Directory: defaultStorageDir,

cmd/opampsupervisor/supervisor/config/config_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -981,10 +981,9 @@ func TestCapabilities_SupportedCapabilities(t *testing.T) {
981981
expectedAgentCapabilities: protobufs.AgentCapabilities_AgentCapabilities_ReportsStatus,
982982
},
983983
{
984-
name: "Package capabilities are reported",
984+
name: "AcceptsPackages enables both package capabilities",
985985
capabilities: Capabilities{
986-
AcceptsPackages: true,
987-
ReportsPackageStatuses: true,
986+
AcceptsPackages: true,
988987
},
989988
expectedAgentCapabilities: protobufs.AgentCapabilities_AgentCapabilities_ReportsStatus |
990989
protobufs.AgentCapabilities_AgentCapabilities_AcceptsPackages |
@@ -1005,7 +1004,6 @@ func TestCapabilities_SupportedCapabilities(t *testing.T) {
10051004
ReportsAvailableComponents: true,
10061005
ReportsHeartbeat: true,
10071006
AcceptsPackages: true,
1008-
ReportsPackageStatuses: true,
10091007
},
10101008
expectedAgentCapabilities: protobufs.AgentCapabilities_AgentCapabilities_ReportsStatus |
10111009
protobufs.AgentCapabilities_AgentCapabilities_ReportsEffectiveConfig |

cmd/opampsupervisor/supervisor/supervisor.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,12 +371,12 @@ func (s *Supervisor) Start(ctx context.Context) error {
371371
return err
372372
}
373373

374-
if s.config.Capabilities.AcceptsPackages || s.config.Capabilities.ReportsPackageStatuses {
374+
if s.config.Capabilities.AcceptsPackages {
375375
s.telemetrySettings.Logger.Error(
376-
"accepts_packages and reports_package_statuses capabilities are not yet fully implemented. " +
376+
"accepts_packages capability is not yet fully implemented. " +
377377
"See https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/47272 for progress.",
378378
)
379-
return errors.New("accepts_packages and reports_package_statuses capabilities are not yet fully implemented")
379+
return errors.New("accepts_packages capability is not yet fully implemented")
380380
}
381381

382382
if err = s.getFeatureGates(); err != nil {

cmd/opampsupervisor/testdata/supervisor/supervisor_packages_cap.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ capabilities:
55
reports_effective_config: true
66
reports_health: true
77
accepts_packages: true
8-
reports_package_statuses: true
98

109
storage:
1110
directory: '{{.storage_dir}}'

0 commit comments

Comments
 (0)