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

Docs: Need clarification on Long/Wide Formats #880

Open
1 of 6 tasks
sarahzinger opened this issue Apr 16, 2024 · 4 comments
Open
1 of 6 tasks

Docs: Need clarification on Long/Wide Formats #880

sarahzinger opened this issue Apr 16, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request type/docs Changes only affect the documentation

Comments

@sarahzinger
Copy link
Member

sarahzinger commented Apr 16, 2024

Which areas does this feature request relate to

  • Create Plugin
  • Sign Plugin
  • Plugin E2E
  • Documentation

Problem

I'm working on a datasource and reading through the long vs wide data frame section and find myself a bit confused by this line:

"Grafana can detect and convert data frames in long format into wide format."

This doesn't happen automatically right? My understanding is that grafana offers some helper functions to make this easier, perhaps we could add docs for that? Or does the timeseries visualization always convert dataframes to wide?

I think it'd also be good to mention here that if developers want to their dataframes to support alerting they need to use wide dataframes

Solution

Maybe link to the wideToLong and longToWide functions? https://github.com/grafana/grafana-plugin-sdk-go/blob/main/data/time_series.go#L210

Alternatives

No response

Additional context

No response

Are you interested in contributing the solution?

  • Yes
  • No
@sarahzinger sarahzinger added the enhancement New feature or request label Apr 16, 2024
@tolzhabayev tolzhabayev added the type/docs Changes only affect the documentation label Apr 19, 2024
@derek-cadzow
Copy link

@josmperez please have a look and unassign if you are unable to fix this one. Thanks!

@josmperez
Copy link
Contributor

Thanks for pointing this out. I'll take a look.

@josmperez
Copy link
Contributor

Need engineer tech review (@andresmgot ?) of this suggested fix.

@josmperez josmperez changed the title Feat: Docs clarification on Long/Wide Formats Docs: Need clarification on Long/Wide Formats Jul 31, 2024
@andresmgot
Copy link
Contributor

I agree that the sentence is a bit confusing, maybe @marefr can correct me if I am wrong but it could clarify:

  • When it says "Grafana can detect ...", I believe it means that "With the Grafana plugin SDK for Go, a plugin can detect ...". That clarifies that it can detect the data frame type if you are using a backend for your plugin (this is, the library is written in go).
  • For detecting and converting a data frame, we could give an example:
		tsSchema := frame.TimeSeriesSchema()
		if tsSchema.Type == data.TimeSeriesTypeLong {
			wideFrame, err := data.LongToWide(frame, nil)
			if err == nil {
				// handle error
			}
			// return wideFrame
		}

Or does the timeseries visualization always convert dataframes to wide?

I don't think this happens but I am no expert of the timeseries visualization so maybe it's the case.

I think it'd also be good to mention here that if developers want to their dataframes to support alerting they need to use wide dataframes

I was not aware of this either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request type/docs Changes only affect the documentation
Projects
Status: 💡 Ideation
Development

No branches or pull requests

5 participants