Coder Social home page Coder Social logo

Comments (12)

ryantxu avatar ryantxu commented on May 27, 2024 1

sorry did not see this till just now...

um, I'm super nervous about putting these details in the grpc interface. If we do add QueryResultMeta it should be the same object used in arrow, likely stored as JSON

I think it makes more sense to define a MUCH smaller set of things that the backend wants to track and figure out how to merge them with QueryResultMeta on the frontend.

from grafana-plugin-sdk-go.

ryantxu avatar ryantxu commented on May 27, 2024

I do not disagree... but will note that the UI only passes around DataFrame[] -- so we don't have anywhere obvious to put the response (without some very major changes!).

In practice, everything I have seen had special metadata for each result or has a single result. The one exception to this is that metrictank processes all queries at once, then returns global metadata and metadata for each result. in this case we put it on the first one and that seems OK so far.

from grafana-plugin-sdk-go.

kylebrandt avatar kylebrandt commented on May 27, 2024

In practice, everything I have seen had special metadata for each result or has a single result.

I don't think that is true. Prometheus, OpenTSDB, probably others are going to return []Frame for time series as the normal case. Basically anything that returns multiple time series from a single query, where they have different time values and/or different lengths for each series.

from grafana-plugin-sdk-go.

ryantxu avatar ryantxu commented on May 27, 2024

I don't disagree that it is normal to return an array of frames... Just that the metadata (in every case I have looked at) applies to a frame, not all frames. In the error case there is only one frame

from grafana-plugin-sdk-go.

bergquist avatar bergquist commented on May 27, 2024

I think this makes sense.

This will make plugin development easier to reason about since each query will result in a query response. One in, one out. Each query response can hold information that the backend might want to know about but without unpacking the dataframes. Ex error, execution items etc.

from grafana-plugin-sdk-go.

kylebrandt avatar kylebrandt commented on May 27, 2024

(Will work on PR to illustrate this).

from grafana-plugin-sdk-go.

ryantxu avatar ryantxu commented on May 27, 2024

I think this makes sense.

sure... but what should the frontend do with it? the frontend pipeline really just supports DataFrame[]... so this could explode into a much bigger issue

from grafana-plugin-sdk-go.

kylebrandt avatar kylebrandt commented on May 27, 2024

So the proto would be something like:

//-----------------------------------------------
// Data
//-----------------------------------------------

service Data {
  rpc QueryData(QueryDataRequest) returns (QueryDataResponse);
}

message TimeRange {
  int64 fromEpochMS = 1;
  int64 toEpochMS = 2;
}

message DataQuery {
  string refId = 1;
  int64 maxDataPoints = 2;
  int64 intervalMS = 3;
  TimeRange timeRange = 4;
  bytes json = 5;
}

// QueryDataRequest
message QueryDataRequest {
  // Plugin Configuration
  PluginConfig config = 1;

  //Info about the user who calls the plugin.
  User user = 2;

  // Environment info
  map<string,string> headers = 3;

  // List of data queries
  repeated DataQuery queries = 4;
}

message QueryDataResponse {
  // List of data query responses
  repeated DataResponse responses = 1;

  // Additional response metadata
  map<string,string> metadata = 2;
}

message DataResponse {
  string refId = 1;
  // Arrow encoded DataFrames
  // Frame has its own meta, warnings, and repeats refId
  repeated bytes frames = 2;
  QueryResultMeta queryMeta = 3;
}

message QueryResultMeta {
  google.protobuf.Any custom = 1;
  repeated QueryResultMetaNotice notices = 2;
}

message QueryResultMetaNotice {
  enum Severity {
    DEBUG = 0;
    INFO = 1;
    WARNING = 2;
    ERROR = 3;
  }
  Severity severity = 1;
  string text = 2;
  string url = 3;
  enum Inspect {
    META = 0;
    ERRORMSG = 1; // ENUM names must be unique across the parent
    DATA = 2;
    STATS = 3;
  }
  Inspect inspect = 4;
}

from grafana-plugin-sdk-go.

marefr avatar marefr commented on May 27, 2024

Only me who thinks notice/notices is a weird name? Not sure I have anything better though, message/messages or event/events maybe?

from grafana-plugin-sdk-go.

marefr avatar marefr commented on May 27, 2024

@kylebrandt I'm still a bit confused after seeing your proto update. What kind of meta would be part of the data frame vs this meta?

from grafana-plugin-sdk-go.

kylebrandt avatar kylebrandt commented on May 27, 2024

@kylebrandt I'm still a bit confused after seeing your proto update. What kind of meta would be part of the data frame vs this meta?

Generally, information about the query goes on the DataResponse, and information about the frame itself goes with the frame.

Details of the Frame changes I will get into as I work on my PR.

from grafana-plugin-sdk-go.

kylebrandt avatar kylebrandt commented on May 27, 2024

fixed in 9e678ab

from grafana-plugin-sdk-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.