Skip to content

Commit 6f22c7d

Browse files
authored
[pkg/stanza] Move filelog.container.removeOriginalTimeField feature gate to beta (#35169)
**Description:** <Describe what has changed.> <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> This PR moves the feature gate to delete the original time field from parsed container logs to beta as part of #33389. **Link to tracking Issue:** <Issue number if applicable> **Testing:** <Describe what testing was performed and which tests were added.> **Documentation:** <Describe the documentation added.> Signed-off-by: ChrsMark <[email protected]>
1 parent db787dd commit 6f22c7d

File tree

3 files changed

+35
-15
lines changed

3 files changed

+35
-15
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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: pkg/stanza
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Move `filelog.container.removeOriginalTimeField` feature gate to beta
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: [33389]
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+
- Disable the `filelog.container.removeOriginalTimeField` feature gate to get the old behavior.
20+
21+
# If your change doesn't affect end users or the exported elements of any package,
22+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
23+
# Optional: The change log or logs in which this entry should be included.
24+
# e.g. '[user]' or '[user, api]'
25+
# Include 'user' if the change is relevant to end users.
26+
# Include 'api' if there is a change to a library API.
27+
# Default: '[user]'
28+
change_logs: [user]

pkg/stanza/operator/parser/container/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const (
2727

2828
var removeOriginalTimeField = featuregate.GlobalRegistry().MustRegister(
2929
removeOriginalTimeFieldFeatureFlag,
30-
featuregate.StageAlpha,
30+
featuregate.StageBeta,
3131
featuregate.WithRegisterDescription("When enabled, deletes the original `time` field from the Log Attributes. Time is parsed to Timestamp field, which should be used instead."),
3232
featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/33389"),
3333
)

pkg/stanza/operator/parser/container/parser_test.go

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ func TestProcess(t *testing.T) {
115115
},
116116
&entry.Entry{
117117
Attributes: map[string]any{
118-
"time": "2029-03-30T08:31:20.545192187Z",
119118
"log.iostream": "stdout",
120119
},
121120
Body: "INFO: log line here",
@@ -135,7 +134,6 @@ func TestProcess(t *testing.T) {
135134
},
136135
&entry.Entry{
137136
Attributes: map[string]any{
138-
"time": "2029-03-30T08:31:20.545192187Z",
139137
"log.iostream": "stdout",
140138
},
141139
Body: "INFO: log line here",
@@ -158,7 +156,6 @@ func TestProcess(t *testing.T) {
158156
},
159157
&entry.Entry{
160158
Attributes: map[string]any{
161-
"time": "2029-03-30T08:31:20.545192187Z",
162159
"log.iostream": "stdout",
163160
"log.file.path": "/var/log/pods/some_kube-scheduler-kind-control-plane_49cc7c1fd3702c40b2686ea7486091d3/kube-scheduler44/1.log",
164161
},
@@ -215,7 +212,6 @@ func TestRecombineProcess(t *testing.T) {
215212
[]*entry.Entry{
216213
{
217214
Attributes: map[string]any{
218-
"time": "2024-04-13T07:59:37.505201169-10:00",
219215
"log.iostream": "stdout",
220216
"logtag": "F",
221217
"log.file.path": "/var/log/pods/some_kube-scheduler-kind-control-plane_49cc7c1fd3702c40b2686ea7486091d3/kube-scheduler44/1.log",
@@ -251,7 +247,6 @@ func TestRecombineProcess(t *testing.T) {
251247
[]*entry.Entry{
252248
{
253249
Attributes: map[string]any{
254-
"time": "2024-04-13T07:59:37.505201169Z",
255250
"log.iostream": "stdout",
256251
"logtag": "F",
257252
"log.file.path": "/var/log/pods/some_kube-scheduler-kind-control-plane_49cc7c1fd3702c40b2686ea7486091d3/kube-scheduler44/1.log",
@@ -293,7 +288,6 @@ func TestRecombineProcess(t *testing.T) {
293288
[]*entry.Entry{
294289
{
295290
Attributes: map[string]any{
296-
"time": "2024-04-13T07:59:37.505201169-10:00",
297291
"log.iostream": "stdout",
298292
"logtag": "P",
299293
"log.file.path": "/var/log/pods/some_kube-scheduler-kind-control-plane_49cc7c1fd3702c40b2686ea7486091d3/kube-scheduler44/1.log",
@@ -335,7 +329,6 @@ func TestRecombineProcess(t *testing.T) {
335329
[]*entry.Entry{
336330
{
337331
Attributes: map[string]any{
338-
"time": "2024-04-13T07:59:37.505201169Z",
339332
"log.iostream": "stdout",
340333
"logtag": "P",
341334
"log.file.path": "/var/log/pods/some_kube-scheduler-kind-control-plane_49cc7c1fd3702c40b2686ea7486091d3/kube-scheduler44/1.log",
@@ -418,7 +411,6 @@ func TestCRIRecombineProcessWithFailedDownstreamOperator(t *testing.T) {
418411
[]*entry.Entry{
419412
{
420413
Attributes: map[string]any{
421-
"time": "2024-04-13T07:59:37.505201169-10:00",
422414
"log.iostream": "stdout",
423415
"logtag": "P",
424416
"log.file.path": "/var/log/pods/some_kube-scheduler-kind-control-plane_49cc7c1fd3702c40b2686ea7486091d3/kube-scheduler44/1.log",
@@ -435,7 +427,6 @@ func TestCRIRecombineProcessWithFailedDownstreamOperator(t *testing.T) {
435427
},
436428
{
437429
Attributes: map[string]any{
438-
"time": "2024-04-13T07:59:37.505201169-10:00",
439430
"log.iostream": "stdout",
440431
"logtag": "F",
441432
"log.file.path": "/var/log/pods/some_kube-scheduler-kind-control-plane_49cc7c1fd3702c40b2686ea7486091d3/kube-scheduler44/1.log",
@@ -483,7 +474,6 @@ func TestCRIRecombineProcessWithFailedDownstreamOperator(t *testing.T) {
483474
[]*entry.Entry{
484475
{
485476
Attributes: map[string]any{
486-
"time": "2024-04-13T07:59:37.505201169Z",
487477
"log.iostream": "stdout",
488478
"logtag": "P",
489479
"log.file.path": "/var/log/pods/some_kube-scheduler-kind-control-plane_49cc7c1fd3702c40b2686ea7486091d3/kube-scheduler44/1.log",
@@ -500,7 +490,6 @@ func TestCRIRecombineProcessWithFailedDownstreamOperator(t *testing.T) {
500490
},
501491
{
502492
Attributes: map[string]any{
503-
"time": "2024-04-13T07:59:37.505201169Z",
504493
"log.iostream": "stdout",
505494
"logtag": "F",
506495
"log.file.path": "/var/log/pods/some_kube-scheduler-kind-control-plane_49cc7c1fd3702c40b2686ea7486091d3/kube-scheduler44/1.log",
@@ -545,11 +534,11 @@ func TestCRIRecombineProcessWithFailedDownstreamOperator(t *testing.T) {
545534
}
546535
}
547536

548-
func TestProcessWithTimeRemovalFlag(t *testing.T) {
537+
func TestProcessWithTimeRemovalFlagDisabled(t *testing.T) {
549538

550-
require.NoError(t, featuregate.GlobalRegistry().Set(removeOriginalTimeField.ID(), true))
539+
require.NoError(t, featuregate.GlobalRegistry().Set(removeOriginalTimeField.ID(), false))
551540
t.Cleanup(func() {
552-
require.NoError(t, featuregate.GlobalRegistry().Set(removeOriginalTimeField.ID(), false))
541+
require.NoError(t, featuregate.GlobalRegistry().Set(removeOriginalTimeField.ID(), true))
553542
})
554543

555544
cases := []struct {
@@ -572,6 +561,7 @@ func TestProcessWithTimeRemovalFlag(t *testing.T) {
572561
},
573562
&entry.Entry{
574563
Attributes: map[string]any{
564+
"time": "2029-03-30T08:31:20.545192187Z",
575565
"log.iostream": "stdout",
576566
},
577567
Body: "INFO: log line here",
@@ -591,6 +581,7 @@ func TestProcessWithTimeRemovalFlag(t *testing.T) {
591581
},
592582
&entry.Entry{
593583
Attributes: map[string]any{
584+
"time": "2029-03-30T08:31:20.545192187Z",
594585
"log.iostream": "stdout",
595586
},
596587
Body: "INFO: log line here",
@@ -614,6 +605,7 @@ func TestProcessWithTimeRemovalFlag(t *testing.T) {
614605
&entry.Entry{
615606
Attributes: map[string]any{
616607
"log.iostream": "stdout",
608+
"time": "2029-03-30T08:31:20.545192187Z",
617609
"log.file.path": "/var/log/pods/some_kube-scheduler-kind-control-plane_49cc7c1fd3702c40b2686ea7486091d3/kube-scheduler44/1.log",
618610
},
619611
Body: "INFO: log line here",

0 commit comments

Comments
 (0)