Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: conflicting types of log fields in json output #5592

Merged
merged 3 commits into from
Mar 27, 2024

Conversation

msvticket
Copy link
Contributor

@msvticket msvticket commented Mar 12, 2024

Summary

ScaledJob is an object in logs during setup, but a string later. So I change name to scaledJob.Name in the latter cases.

Details

When enabling json log format and debug level on the keda operator field ScaledObject has a value of type object during setup, but later is contains a string.

Examples

I have pretty printed the log lines for readability.

During setup

{
  "level": "info",
  "ts": "2024-03-12T05:00:08Z",
  "msg": "Reconciling ScaledJob",
  "controller": "scaledjob",
  "controllerGroup": "keda.sh",
  "controllerKind": "ScaledJob",
  "ScaledJob": {
    "name": "selenium-chrome-node",
    "namespace": "selenium-grid"
  },
  "namespace": "selenium-grid",
  "name": "selenium-chrome-node",
  "reconcileID": "a7191b5d-8677-43f2-adc2-47b285a448d9"
}

Later

{
  "level": "debug",
  "ts": "2024-03-12T05:00:09Z",
  "logger": "scalemetrics",
  "msg": "Checking if ScaleJob Scalers are active",
  "ScaledJob": "selenium-firefox-node",
  "isActive": false,
  "maxValue": 0,
  "MultipleScalersCalculation": ""
}

Effect

For me this prevents logs from being ingested into OpenSearch (using fluent bit), but it ought to cause problems with other objects stores as well.

Error message

Since I haven't explicitly set the type of the field ScaledObject in OpenSearch it will get the type object when the setup rows are ingested. Later this will cause errors like:

{
"type":"mapper_parsing_exception",
"reason":"object mapping for [ScaledJob] tried to parse field [ScaledJob] as object, but found a concrete value"
}

Checklist

@msvticket msvticket requested a review from a team as a code owner March 12, 2024 09:50
@msvticket msvticket force-pushed the fixlog branch 5 times, most recently from 051188f to 56081ac Compare March 12, 2024 10:38
ScaledJob is an object in logs during setup, but a string later. So I change name to scaledJob.Name in the latter cases.

Signed-off-by: Mårten Svantesson <Marten.Svantesson@ticket.se>
Copy link
Member

@zroubalik zroubalik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@zroubalik
Copy link
Member

zroubalik commented Mar 15, 2024

/run-e2e sj
Update: You can check the progress here

Signed-off-by: Mårten Svantesson <marten.svantesson@ticket.se>
@zroubalik zroubalik enabled auto-merge (squash) March 16, 2024 17:51
Copy link

@kumarankit999 kumarankit999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good that it resolves the Conflict types!!

Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
@zroubalik zroubalik disabled auto-merge March 27, 2024 15:59
@zroubalik zroubalik merged commit f288c01 into kedacore:main Mar 27, 2024
17 of 18 checks passed
@msvticket msvticket deleted the fixlog branch April 2, 2024 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants