async function dataframe({
limit = 100,
project = undefined,
measurement = undefined,
tags = undefined,
experiment = undefined,
user = "vogels"
}) {
let data = await graphql(
`query jobs($limit: Int = 5, $user: String, $project: String, $experiment: String, $measurement: String, $tags: String) {
jobs(limit: $limit, user: $user, project: $project, experiment: $experiment) {
id
experiment
job
config {
key
value
}
timeseries(measurement: $measurement, tags: $tags) {
measurement
tags
values
}
}
}`,
{ limit, project, experiment, user, measurement, tags }
);
const dataset = [];
for (let job of data.jobs) {
const { timeseries, config } = job;
const configMap = Object.fromEntries(config.map(c => [c.key, c.value]));
for (let timeserie of timeseries) {
const timeseriesId = Math.round(Math.random() * 1e16);
const { values, tags, ...otherProps } = timeserie;
for (let value of values) {
dataset.push({
...value,
...tags,
...otherProps,
config: configMap,
job,
curve: timeseriesId
});
}
}
}
return dataset;
}