Skip to content

Commit 6d61a75

Browse files
authored
[chore][exporter/awsxray] migrate feature gate to metadata.yaml (#48619)
### Description Migrate the `exporter.awsxray.skiptimestampvalidation` feature gate from manual `featuregate.GlobalRegistry().MustRegister()` in `factory.go` to `metadata.yaml`, letting mdatagen generate the registration code. ### Link to tracking issue Part of #46116
1 parent 2daec02 commit 6d61a75

6 files changed

Lines changed: 40 additions & 12 deletions

File tree

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ linters:
112112
# https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/46116
113113
- linters:
114114
- forbidigo
115-
path: exporter/awsxrayexporter/
115+
path: exporter/awsxrayexporter/internal/translator/
116116
- linters:
117117
- forbidigo
118118
path: internal/filter/
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[comment]: <> (Code generated by mdatagen. DO NOT EDIT.)
2+
3+
# awsxray
4+
5+
## Feature Gates
6+
7+
This component has the following feature gates:
8+
9+
| Feature Gate | Stage | Description | From Version | To Version | Reference |
10+
| ------------ | ----- | ----------- | ------------ | ---------- | --------- |
11+
| `exporter.awsxray.skiptimestampvalidation` | beta | Remove XRay's timestamp validation on first 32 bits of trace ID | v0.84.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/48737) |
12+
13+
For more information about feature gates, see the [Feature Gates](https://github.com/open-telemetry/opentelemetry-collector/blob/main/featuregate/README.md) documentation.

exporter/awsxrayexporter/factory.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,12 @@ import (
88

99
"go.opentelemetry.io/collector/component"
1010
"go.opentelemetry.io/collector/exporter"
11-
"go.opentelemetry.io/collector/featuregate"
1211

1312
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter/internal/metadata"
1413
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil"
1514
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray/telemetry"
1615
)
1716

18-
var skipTimestampValidationFeatureGate = featuregate.GlobalRegistry().MustRegister(
19-
"exporter.awsxray.skiptimestampvalidation",
20-
featuregate.StageBeta,
21-
featuregate.WithRegisterDescription("Remove XRay's timestamp validation on first 32 bits of trace ID"),
22-
featuregate.WithRegisterFromVersion("v0.84.0"))
23-
2417
// NewFactory creates a factory for AWS-Xray exporter.
2518
func NewFactory() exporter.Factory {
2619
return exporter.NewFactory(
@@ -32,7 +25,7 @@ func NewFactory() exporter.Factory {
3225
func createDefaultConfig() component.Config {
3326
return &Config{
3427
AWSSessionSettings: awsutil.CreateDefaultSessionConfig(),
35-
skipTimestampValidation: skipTimestampValidationFeatureGate.IsEnabled(),
28+
skipTimestampValidation: metadata.ExporterAwsxraySkiptimestampvalidationFeatureGate.IsEnabled(),
3629
}
3730
}
3831

exporter/awsxrayexporter/factory_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ import (
2121

2222
func setSkipTimestampValidation(tb testing.TB, value bool) {
2323
tb.Helper()
24-
prev := skipTimestampValidationFeatureGate.IsEnabled()
25-
require.NoError(tb, featuregate.GlobalRegistry().Set(skipTimestampValidationFeatureGate.ID(), value))
24+
prev := metadata.ExporterAwsxraySkiptimestampvalidationFeatureGate.IsEnabled()
25+
require.NoError(tb, featuregate.GlobalRegistry().Set(metadata.ExporterAwsxraySkiptimestampvalidationFeatureGate.ID(), value))
2626
tb.Cleanup(func() {
27-
require.NoError(tb, featuregate.GlobalRegistry().Set(skipTimestampValidationFeatureGate.ID(), prev))
27+
require.NoError(tb, featuregate.GlobalRegistry().Set(metadata.ExporterAwsxraySkiptimestampvalidationFeatureGate.ID(), prev))
2828
})
2929
}
3030

exporter/awsxrayexporter/internal/metadata/generated_feature_gates.go

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

exporter/awsxrayexporter/metadata.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ status:
99
codeowners:
1010
active: [wangzlei, srprash]
1111

12+
feature_gates:
13+
- id: exporter.awsxray.skiptimestampvalidation
14+
description: "Remove XRay's timestamp validation on first 32 bits of trace ID"
15+
stage: beta
16+
from_version: v0.84.0
17+
reference_url: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/48737
18+
1219
tests:
1320
config:
1421
region: 'us-west-2'

0 commit comments

Comments
 (0)