-
Notifications
You must be signed in to change notification settings - Fork 5.7k
fix(outputs.sql): Add timestamp to derived datatypes #17310
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Soldrym! The code looks good. Could you please add a unit-test to avoid future regressions!?
I added a unit test. Ran into issues where adding the field would just send through a nil and had to add a time.Time conversion to metric.convertField. That was the most time I've ever spent adding 9 lines of code. |
So I don't know what to do about this failing check. It's in plugins/inputs/ecs. They unmarshal the a json source file into a struct called ecsTask with a slice of ecsContainer structs in it. The ecsContainer struct has the CreatedAt and StartedAt fields, so that all makes sense. The final output function (metastats) creates a map with keys created_at and started_at with the values of CreatedAt and StartedAt, but the expected data does not have those fields. Before changing the metric convert field function, the ecs metastats function didn't output the created_at and started_at keys, so the expected matched the output. I just don't know if that's actually supposed to be like that. It looks like a bug in the ecs test but I don't know much about ECS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Soldrym your change to metric/metric.go
will break many non-input plugins! Please revert this change, it's definitively not the right thing to do...
Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip. 👍 This pull request doesn't change the Telegraf binary size 📦 Click here to get additional PR build artifactsArtifact URLs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Thanks a lot @Soldrym!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Soldrym Thanks!
Co-authored-by: Soldrym <soldrym@users.noreply.github.com> (cherry picked from commit 467ac0c)
Summary
outputs.sql derived datatypes does not account for time.Time values causing errors.
Checklist
Related issues
resolves #17309