Skip to content

Commit

Permalink
[pkg/stanza] Move filelog.container.removeOriginalTimeField feature g…
Browse files Browse the repository at this point in the history
…ate 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]>
  • Loading branch information
ChrsMark authored and jriguera committed Oct 4, 2024
1 parent e8fe806 commit 73fb048
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 15 deletions.
28 changes: 28 additions & 0 deletions .chloggen/container_parser_featuregate_beta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Use this changelog template to create an entry for release notes.

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

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Move `filelog.container.removeOriginalTimeField` feature gate to beta

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

# (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: |
- Disable the `filelog.container.removeOriginalTimeField` feature gate to get the old behavior.
# 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: [user]
2 changes: 1 addition & 1 deletion pkg/stanza/operator/parser/container/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const (

var removeOriginalTimeField = featuregate.GlobalRegistry().MustRegister(
removeOriginalTimeFieldFeatureFlag,
featuregate.StageAlpha,
featuregate.StageBeta,
featuregate.WithRegisterDescription("When enabled, deletes the original `time` field from the Log Attributes. Time is parsed to Timestamp field, which should be used instead."),
featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/33389"),
)
Expand Down
20 changes: 6 additions & 14 deletions pkg/stanza/operator/parser/container/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ func TestProcess(t *testing.T) {
},
&entry.Entry{
Attributes: map[string]any{
"time": "2029-03-30T08:31:20.545192187Z",
"log.iostream": "stdout",
},
Body: "INFO: log line here",
Expand All @@ -135,7 +134,6 @@ func TestProcess(t *testing.T) {
},
&entry.Entry{
Attributes: map[string]any{
"time": "2029-03-30T08:31:20.545192187Z",
"log.iostream": "stdout",
},
Body: "INFO: log line here",
Expand All @@ -158,7 +156,6 @@ func TestProcess(t *testing.T) {
},
&entry.Entry{
Attributes: map[string]any{
"time": "2029-03-30T08:31:20.545192187Z",
"log.iostream": "stdout",
"log.file.path": "/var/log/pods/some_kube-scheduler-kind-control-plane_49cc7c1fd3702c40b2686ea7486091d3/kube-scheduler44/1.log",
},
Expand Down Expand Up @@ -215,7 +212,6 @@ func TestRecombineProcess(t *testing.T) {
[]*entry.Entry{
{
Attributes: map[string]any{
"time": "2024-04-13T07:59:37.505201169-10:00",
"log.iostream": "stdout",
"logtag": "F",
"log.file.path": "/var/log/pods/some_kube-scheduler-kind-control-plane_49cc7c1fd3702c40b2686ea7486091d3/kube-scheduler44/1.log",
Expand Down Expand Up @@ -251,7 +247,6 @@ func TestRecombineProcess(t *testing.T) {
[]*entry.Entry{
{
Attributes: map[string]any{
"time": "2024-04-13T07:59:37.505201169Z",
"log.iostream": "stdout",
"logtag": "F",
"log.file.path": "/var/log/pods/some_kube-scheduler-kind-control-plane_49cc7c1fd3702c40b2686ea7486091d3/kube-scheduler44/1.log",
Expand Down Expand Up @@ -293,7 +288,6 @@ func TestRecombineProcess(t *testing.T) {
[]*entry.Entry{
{
Attributes: map[string]any{
"time": "2024-04-13T07:59:37.505201169-10:00",
"log.iostream": "stdout",
"logtag": "P",
"log.file.path": "/var/log/pods/some_kube-scheduler-kind-control-plane_49cc7c1fd3702c40b2686ea7486091d3/kube-scheduler44/1.log",
Expand Down Expand Up @@ -335,7 +329,6 @@ func TestRecombineProcess(t *testing.T) {
[]*entry.Entry{
{
Attributes: map[string]any{
"time": "2024-04-13T07:59:37.505201169Z",
"log.iostream": "stdout",
"logtag": "P",
"log.file.path": "/var/log/pods/some_kube-scheduler-kind-control-plane_49cc7c1fd3702c40b2686ea7486091d3/kube-scheduler44/1.log",
Expand Down Expand Up @@ -418,7 +411,6 @@ func TestCRIRecombineProcessWithFailedDownstreamOperator(t *testing.T) {
[]*entry.Entry{
{
Attributes: map[string]any{
"time": "2024-04-13T07:59:37.505201169-10:00",
"log.iostream": "stdout",
"logtag": "P",
"log.file.path": "/var/log/pods/some_kube-scheduler-kind-control-plane_49cc7c1fd3702c40b2686ea7486091d3/kube-scheduler44/1.log",
Expand All @@ -435,7 +427,6 @@ func TestCRIRecombineProcessWithFailedDownstreamOperator(t *testing.T) {
},
{
Attributes: map[string]any{
"time": "2024-04-13T07:59:37.505201169-10:00",
"log.iostream": "stdout",
"logtag": "F",
"log.file.path": "/var/log/pods/some_kube-scheduler-kind-control-plane_49cc7c1fd3702c40b2686ea7486091d3/kube-scheduler44/1.log",
Expand Down Expand Up @@ -483,7 +474,6 @@ func TestCRIRecombineProcessWithFailedDownstreamOperator(t *testing.T) {
[]*entry.Entry{
{
Attributes: map[string]any{
"time": "2024-04-13T07:59:37.505201169Z",
"log.iostream": "stdout",
"logtag": "P",
"log.file.path": "/var/log/pods/some_kube-scheduler-kind-control-plane_49cc7c1fd3702c40b2686ea7486091d3/kube-scheduler44/1.log",
Expand All @@ -500,7 +490,6 @@ func TestCRIRecombineProcessWithFailedDownstreamOperator(t *testing.T) {
},
{
Attributes: map[string]any{
"time": "2024-04-13T07:59:37.505201169Z",
"log.iostream": "stdout",
"logtag": "F",
"log.file.path": "/var/log/pods/some_kube-scheduler-kind-control-plane_49cc7c1fd3702c40b2686ea7486091d3/kube-scheduler44/1.log",
Expand Down Expand Up @@ -545,11 +534,11 @@ func TestCRIRecombineProcessWithFailedDownstreamOperator(t *testing.T) {
}
}

func TestProcessWithTimeRemovalFlag(t *testing.T) {
func TestProcessWithTimeRemovalFlagDisabled(t *testing.T) {

require.NoError(t, featuregate.GlobalRegistry().Set(removeOriginalTimeField.ID(), true))
require.NoError(t, featuregate.GlobalRegistry().Set(removeOriginalTimeField.ID(), false))
t.Cleanup(func() {
require.NoError(t, featuregate.GlobalRegistry().Set(removeOriginalTimeField.ID(), false))
require.NoError(t, featuregate.GlobalRegistry().Set(removeOriginalTimeField.ID(), true))
})

cases := []struct {
Expand All @@ -572,6 +561,7 @@ func TestProcessWithTimeRemovalFlag(t *testing.T) {
},
&entry.Entry{
Attributes: map[string]any{
"time": "2029-03-30T08:31:20.545192187Z",
"log.iostream": "stdout",
},
Body: "INFO: log line here",
Expand All @@ -591,6 +581,7 @@ func TestProcessWithTimeRemovalFlag(t *testing.T) {
},
&entry.Entry{
Attributes: map[string]any{
"time": "2029-03-30T08:31:20.545192187Z",
"log.iostream": "stdout",
},
Body: "INFO: log line here",
Expand All @@ -614,6 +605,7 @@ func TestProcessWithTimeRemovalFlag(t *testing.T) {
&entry.Entry{
Attributes: map[string]any{
"log.iostream": "stdout",
"time": "2029-03-30T08:31:20.545192187Z",
"log.file.path": "/var/log/pods/some_kube-scheduler-kind-control-plane_49cc7c1fd3702c40b2686ea7486091d3/kube-scheduler44/1.log",
},
Body: "INFO: log line here",
Expand Down

0 comments on commit 73fb048

Please sign in to comment.