-
Notifications
You must be signed in to change notification settings - Fork 1
Conversation
} | ||
|
||
// FrameWrapper is a wrapper over data.Frame. | ||
type FrameWrapper interface { |
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.
fine for now... but maybe we should add "key" as a standard frame property 🤔
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.
hmm, maybe not - because the key here used mostly to construct a channel name to publish data into, maybe better try to keep live specifics separate from general data frame logic as long as possible?
frameWrappers, err := converter.Convert(testData) | ||
require.NoError(t, err) | ||
require.Len(t, frameWrappers, 1) | ||
|
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.
consider adding a "golden" test -- I find these super userful for understanding input vs output -- and would love your help/advice making the core interface better :)
See:
https://github.com/grafana/grafana/blob/master/pkg/tsdb/influxdb/flux/executor_test.go#L70
Or:
https://github.com/grafana/oas-datasource/blob/fa755294643e56371afe326850aaf76eb0bb6f88/pkg/server/test/server_test.go#L69
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.
Will do
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.
Done
) | ||
|
||
// FieldTypeFor returns a concrete type for a given interface or unknown if not known | ||
func FieldTypeFor(t interface{}) data.FieldType { |
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.
eventually in the SDK
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.
Yep
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.
Looks good -- can you try the golden file test. I find it a super helpful pattern
Added converter from telegraf/influx format to Grafana Data Frames. This converter generates one frame for each input metric name and time combination.
Not sure about naming - maybe it's better to call package
influx
instead oftelegraf
(since input is ininflux
format, but it contains metrics which aretelegraf.Metric
).Benchmark: