-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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: Add support for opcua datetime values #12101
Conversation
the windows test failed for a seemingly unrelated reason -- perhaps a flaky test?
|
@vsinha maybe flaky, I have retriggered the test |
@LarsStegman do you know where i should leave a test to make sure DateTimes serialize properly? The test as specified here is failing |
Are you sure the NodeId is correct? Maybe the identifier type should be |
That fixed the |
@LarsStegman Thank you for your work and continued help with the opcua plugins! |
@MyaLongmire all the tests are passing except the readme linter, where this PR doesn't contain any changes to any readmes. Is this something we can sidestep? |
@vsinha Yes we can sidestep it as it is failing on things you did not change :) |
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.
One other person from the team will need to also approve this before we can merge it.
Questions before we land this:
Won't this increase the cardinality of a measurement greatly by having a possibly unique timestamp on every recording? If so, shouldn't this be a flag to enable this if you really want it? Or am I over estimating how often this tag value would change? |
Is that valid line protocol? No additional tags should be created by this PR. DateTime values for fields should become formatted as strings instead of being dropped. |
TIL: I can edit your comments... that is scary
I didn't think it was. I was going off of what is in the initial PR comment and made me stop. Is this just a case of a missing space? |
I think the field name is missing in the example. @vsinha can you confirm?
😅 |
@powersj updated the comment, agreed that as it was there was a a=b=c situation going on. Must've been a mistype from redacting the details specific to our opcua host |
@powersj @MyaLongmire anything else i should do to shepherd this PR along? |
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.
@vsinha looks good overall, I just added one suggestion... Can you please take a look!?
add type assertion so we don't panic if we fail to convert to a time string Co-authored-by: Sven Rebhan <36194019+srebhan@users.noreply.github.com>
updated, thanks @srebhan |
@srebhan @MyaLongmire any more pieces of feedback? or are we ready to merge |
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 for adding this feature!
Nice addition for the timestamp format. A suggestion, I would put the timestamp format in the InputClientConfig, as the value is used in the InputClient, not in the Client. |
Download PR build artifacts for linux_amd64.tar.gz, darwin_amd64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
done! |
Hey @srebhan @MyaLongmire @reimda -- do you think this is something we could get merged this week? Our plan is to fork telegraf to get this bug fix deployed if it's not something that can be upstreamed (via this PR) relatively quickly. I'm happy to make any more changes but I'm getting antsy. |
🙌 |
@powersj @MyaLongmire could I get a copy of my countersigned CCLA for this PR? We'd like it for our own records. Thanks! |
@vsinha - the form is a google docs form, so all I have is an entry in a spreadsheet. |
@powersj I think the individual CLA was a google form but the CCLA was a pdf we had our legal team sign and upload, am I remembering that correctly? |
@vsinha ah yes the CCLA is different. Let me ask if I copy can get sent to you. |
@vsinha what email did you send the signed CCLA? Can you send them a message to get a copy please? |
Resolves #12006
This PR adds support for returning OPCUA DateTime values via the opc-ua input plugin. Prior to this PR, we silently drop those values. Reopened because I made a mistake in #12020.
Details
The
gopcua
library returns these values as the time.Time type, which telegraf doesn't handle inmetric.go:convertField
. To make the smallest change possible, we simply convert the datetime value to a string in the default golang format before returning the updated value.Example
Example telegraf.toml
Before:
Notice the TimeEnded value has
Quality=OK
but the time value itself has failed to parse or be returned. This is because it falls into thedefault
case inmetric.go:convertField
After:
We return the time as a string as intended