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

Flatten schema explorer tree in Flux builder, update searching #4625

Closed
6 tasks done
alexpaxton opened this issue Oct 22, 2018 · 1 comment
Closed
6 tasks done

Flatten schema explorer tree in Flux builder, update searching #4625

alexpaxton opened this issue Oct 22, 2018 · 1 comment
Assignees
Labels
epic/flux Issues for 1.7 flux release
Milestone

Comments

@alexpaxton
Copy link
Contributor

alexpaxton commented Oct 22, 2018

  • The tree should look like this:

    Bucket
      MEASUREMENTS
        Measurement Name (has Make Filter button)
          Field Name (Click to add filter)
      TAGS
        Tag Key
            Tag Value (Click to add filter)
      FIELDS
        Field name (Click to add filter)
    
  • There should be a search box under the MEASUREMENTS and FIELDS headings, and under each tag key

  • When searching under MEASUREMENTS or FIELDS, all matching children and the path in the tree that leads to them should be displayed

  • All data for searching under MEASUREMENTS or FIELDS should exist prior to being able to search (synchronous search)

  • When searching under a tag key, an asynchronous regex-based search with a limit should be used (debounced)

  • When data is loading, a loading state should be displayed

  • If data fails to load, an error state should be displayed

explore_schema_v3

@chnn
Copy link
Contributor

chnn commented Oct 24, 2018

This story requires loading most of the data for the tree at once. That can be done with the following three queries:

RANGE_START = -1h

// Fetch all the measurements
from(bucket: "telegraf")
  |> range(start: RANGE_START)
  |> group(by: ["_measurement"])
  |> distinct(column: "_measurement")
  |> group(none: true)
  |> map(fn: (r) => ({_measurement: r._measurement}))
  |> yield(name: "measurements")
  
// Fetch all the tag keys
from(bucket: "telegraf")
  |> range(start: RANGE_START)
  |> group(none: true)
  |> keys(except:["_time", "_value", "_start", "_stop"])
  |> map(fn: (r) => ({tag: r._value}))
  |> yield(name: "tags")

// Fetch all the fields and their associated measurement
from(bucket: "telegraf")
  |> range(start: RANGE_START)
  |> group(by: ["_field", "_measurement"])
  |> distinct(column: "_field")
  |> group(none: true)
  |> map(fn: (r) => ({_measurement: r._measurement, _field: r._field}))
  |> yield(name: "fieldsByMeasurement")

Since Flux does not seem to support multiple yields yet, these should will have to be issued as separate queries for now.

Note that the flat list of fields (what is displayed in the FIELDS tree) can be extracted from the third query. However, the flat list of measurements has to be issued as a separate query (the first one), since a measurement does not necessarily have any fields associated with it.

These queries will need to be parsed at the bucket level into a data structure that looks something like the following:

{
  "measurements": {
    "measurement_1": [
      "field_1",
      "field_2",
    ],
    "measurement_2": [
      "field_3",
      "field_4",
    ],
  },
  "tags": [
    "tag_key_1",
    "tag_key_2",
    "tag_key_3",
  ],
  "fields": [
    "field_1",
    "field_2",
    "field_3",
    "field_4",
  ]
}

@chnn chnn changed the title Flatten schema explorer tree in Flux builder Flatten schema explorer tree in Flux builder, update searching Oct 24, 2018
@AlirieGray AlirieGray assigned AlirieGray and unassigned chnn Oct 24, 2018
@ischolten ischolten self-assigned this Oct 24, 2018
@ischolten ischolten removed their assignment Oct 29, 2018
@russorat russorat added this to the 1.7.0 milestone Nov 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic/flux Issues for 1.7 flux release
Projects
None yet
Development

No branches or pull requests

5 participants