feat(common.opcua): Add support for datetime arrays#18411
Merged
skartikey merged 2 commits intoinfluxdata:masterfrom Mar 2, 2026
Merged
feat(common.opcua): Add support for datetime arrays#18411skartikey merged 2 commits intoinfluxdata:masterfrom
skartikey merged 2 commits intoinfluxdata:masterfrom
Conversation
Contributor
|
Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
srebhan
approved these changes
Feb 25, 2026
Member
srebhan
left a comment
There was a problem hiding this comment.
Thanks for your contribution @jprandelliberief!
skartikey
approved these changes
Mar 2, 2026
Contributor
skartikey
left a comment
There was a problem hiding this comment.
@jprandelliberief Thanks for the contribution!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OPC UA nodes with a
DateTime[]value type are decoded by gopcua as[]time.Time.Telegraf's array-unpacking type-switch in the shared OPC UA input code did not handle this type, causing it to fall through to the
defaultcase and log:could not unpack variant array of type: []time.TimeThis change adds a
case []time.Time:branch to the switch inplugins/common/opcua/input/input_client.go. Each element is formatted as an RFC3339Nano UTC string and the resulting[]stringis passed to the existingunpack()helper, producing indexed fields (e.g.field[0]="2024-01-01T00:00:00Z",field[1]=...) consistent with how all other array types are handled.A unit test case (
datetime array metric build correctly) is added toTestMetricForNodeto cover this path.Checklist
Related issues
resolves #18410