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

Data: Add Numeric Kind constants, link to DP docs #560

Merged
merged 5 commits into from Dec 2, 2022
Merged

Conversation

kylebrandt
Copy link
Contributor

@kylebrandt kylebrandt commented Nov 13, 2022

What this PR does / why we need it:

  • Fixes FrameTypeXYZ contstant to be of type FrameType instead of an untyped string.
  • Deprecates TimeSeriesMany in favor of TimeSeriesMulti
  • Adds Numeric FrameTypes, And IsNumeric()
  • Add FrameTypeKind
  • Links FrameTypes and FrameKinds to Dataplane documentation

Special notes for your reviewer:
Puts things in their own constant lines so the link documentation works with pkgsite (go package documentation).

Didn't do heatmap yet, that could be another PR.

@kylebrandt kylebrandt added documentation Improvements or additions to documentation dataframe area/dataplane Dataplane Project (Data type contract) labels Nov 13, 2022
@kylebrandt kylebrandt marked this pull request as ready for review November 13, 2022 17:20
@kylebrandt kylebrandt requested a review from a team as a code owner November 13, 2022 17:20
@kylebrandt kylebrandt requested review from wbrowne and marefr and removed request for a team November 13, 2022 17:20
FrameTypeTable = "table"
)
// ---
// Docs Note: Constants need to be on their own line for links to work with the pkgsite docs.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way to preview the output?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I run:

https://github.com/golang/pkgsite

# kbrandt @ kbrandt-ws in ~/go/github.com/grafana/grafana-plugin-sdk-go on git:frameTypeNumeric x [12:22:58] C:130
$ pkgsite -http localhost:9123 -gorepo . 

and then my url is http://localhost:9123/github.com/grafana/grafana-plugin-sdk-go@v0.0.0/data

const FrameTypeTimeSeriesLong FrameType = "timeseries-long"

// FrameTypeTimeSeriesMany is the same as "Wide" with exactly one numeric value field
// Deprecated: use FrameTypeTimeSeriesMulti instead.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does Deprecated need a line break above it to be recognized?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem to help, but cleaner so will change anyways

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like it works with linting, but not pkgsite

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it seems, need to make sure FE understands it first, will either wait a little bit after checking or move that particular one to another PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this what you had asked me to work on @kylebrandt? Will this help with pkgsite? grafana/grafana#59070

Comment on lines +79 to 86
FrameTypeTimeSeriesMulti,
FrameTypeTimeSeriesMany,

FrameTypeNumericWide,
FrameTypeNumericLong,
FrameTypeNumericMulti:
return true
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FrameTypeDirectoryListing, FrameTypeTable are still considered UnknownTypes? It is still unclear where and how the IsKnownType should be used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure on use for IsKnownType() either...

Comment on lines +132 to +138
case p.IsTimeSeries():
return KindTimeSeries
case p.IsNumeric():
return KindNumeric
default:
return KindUnknown
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as previous comment. Don't we have kind for FrameTypeDirectoryListing \ FrameTypeTable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I'm not sure what they should be. Going with Table, is seems we could say:

  • Kind is Table
  • Format is Table
  • We abbreviate "TableTable" as "Table"

Could do the same for "directory-listing". I guess the assumption here is there will only ever be one format for the kind, but we could do "DirectoryListingSomething" or "TableSomething" if we have to someday. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also perhaps unsure about "Table" itself.

For example, with a SQL query like like Select Avg(foo), city group by city, at least in SSE, it would be looking for "NumericLong", but the in the SQL query UI in grafana that would be format as "Table". And this also makes me realize the collision on the word "format" between the contract and UI.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved these to #572 so can go forward with this PR for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dataplane Dataplane Project (Data type contract) dataframe documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants