-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate Get prefix funcs for featuregate.Gate
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
- Loading branch information
1 parent
b3c8744
commit 20e9967
Showing
6 changed files
with
129 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: deprecation | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) | ||
component: featuregate | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Deprecate Get prefix funcs for `featuregate.Gate` | ||
|
||
# One or more tracking issues or pull requests related to the change | ||
issues: [6528] | ||
|
||
# (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: | | ||
`featuregate.Gate.GetID` -> `featuregate.Gate.ID` | ||
`featuregate.Gate.GetDescription` -> `featuregate.Gate.Description` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package featuregate // import "go.opentelemetry.io/collector/featuregate" | ||
|
||
// Gate is an immutable object that is owned by the Registry and represents an individual feature that | ||
// may be enabled or disabled based on the lifecycle state of the feature and CLI flags specified by the user. | ||
type Gate struct { | ||
id string | ||
description string | ||
referenceURL string | ||
removalVersion string | ||
stage Stage | ||
enabled bool | ||
} | ||
|
||
// Deprecated: [v0.65.0] use ID. | ||
func (g *Gate) GetID() string { | ||
return g.ID() | ||
} | ||
|
||
// ID returns the id of the Gate. | ||
func (g *Gate) ID() string { | ||
return g.id | ||
} | ||
|
||
// IsEnabled returns true if the feature described by the Gate is enabled. | ||
func (g *Gate) IsEnabled() bool { | ||
return g.enabled | ||
} | ||
|
||
// Deprecated: [v0.65.0] use Description. | ||
func (g *Gate) GetDescription() string { | ||
return g.Description() | ||
} | ||
|
||
// Description returns the description for the Gate. | ||
func (g *Gate) Description() string { | ||
return g.description | ||
} | ||
|
||
// Stage returns the Gate's lifecycle stage. | ||
func (g *Gate) Stage() Stage { | ||
return g.stage | ||
} | ||
|
||
// ReferenceURL returns the URL to the contextual information about the Gate. | ||
func (g *Gate) ReferenceURL() string { | ||
return g.referenceURL | ||
} | ||
|
||
// RemovalVersion returns the removal version information for Gate's in StageStable. | ||
func (g *Gate) RemovalVersion() string { | ||
return g.removalVersion | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package featuregate | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestGate(t *testing.T) { | ||
g := &Gate{ | ||
id: "test", | ||
description: "test gate", | ||
enabled: false, | ||
stage: StageAlpha, | ||
referenceURL: "http://example.com", | ||
removalVersion: "v0.64.0", | ||
} | ||
|
||
assert.Equal(t, "test", g.ID()) | ||
assert.Equal(t, "test gate", g.Description()) | ||
assert.Equal(t, false, g.IsEnabled()) | ||
assert.Equal(t, StageAlpha, g.Stage()) | ||
assert.Equal(t, "http://example.com", g.ReferenceURL()) | ||
assert.Equal(t, "v0.64.0", g.RemovalVersion()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters