odis-labs / refana Goto Github PK
View Code? Open in Web Editor NEWDefine Grafana dashboards with ReasonML
Home Page: https://odis-labs.github.io/refana/refana
License: MIT License
Define Grafana dashboards with ReasonML
Home Page: https://odis-labs.github.io/refana/refana
License: MIT License
type no_data_state = [
| `ok
| `no_data
| `keep_state
| `alerting
];
let no_data_state_to_yojson = (alert) =>
switch (alert) {
| `ok => `String("ok")
| `no_data => `String("no_data")
| `keep_state => `String("keep_state")
| `alerting => `String("alerting")
};
type execution_error_state = [
| `no_data
| `paused
| `alerting
| `ok
| `pending
];
let execution_error_state_to_yojson = (error_state) =>
switch (error_state) {
| `no_data => `String("no_data")
| `paused => `String("paused")
| `alerting => `String("alerting")
| `ok => `String("ok")
| `pending => `String("pending")
};
/* Operator */
type operator_type = [
| `and_
| `or_
];
let operator_type_to_yojson = (operator_type) =>
switch (operator_type) {
| `and_ => `String("and")
| `or_ => `String("or")
};
[@deriving (make, to_yojson { strict: false })]
type operator = {
[@deriving.yojson.key "type"]
[@deriving.make.default `and_]
type_: operator_type
};
/* Reducer */
type reducer_type = [
| `avg
| `min
| `max
| `sum
| `count
| `last
| `median
| `diff
| `percent_diff
| `count_non_null
];
let reducer_type_to_yojson = (reducer) =>
switch (reducer) {
| `avg => `String("avg")
| `min => `String("min")
| `max => `String("max")
| `sum => `String("sum")
| `count => `String("count")
| `last => `String("last")
| `median => `String("median")
| `diff => `String("diff")
| `percent_diff => `String("percent_diff")
| `count_non_null => `String("count_non_null")
};
[@deriving (make, to_yojson { strict: false })]
type reducer = {
[@deriving.yojson.key "type"]
[@deriving.make.default `avg]
type_: reducer_type,
[@deriving.make.default []]
params: list(string),
};
let reducer = (reducer_type) => { type_: reducer_type, params: [] };
/* Query */
[@deriving (make, to_yojson { strict: false })]
type query = {
[@deriving.make.default ["A", "5m", "now"]]
params: list(string)
};
let query = (a, b, c) => {params: [a, b, c]};
/* Evaluator */
[@deriving (make, to_yojson { strict: false })]
type evaluator = {
[@deriving.yojson.key "type"]
[@deriving.make.default "gt"]
type_: string,
[@deriving.make.default []]
params: list(int),
};
let gt = (value) => { type_: "gt", params: [value] };
let lt = (value) => { type_: "lt", params: [value] };
let outside_range = (from_, to_) => { type_: "outside_range", params: [from_, to_] };
let within_range = (from_, to_) => { type_: "within_range", params: [from_, to_] };
let no_value = () => { type_: "no_value", params: [] };
/* Condition */
[@deriving (make, to_yojson { strict: false })]
type condition = {
[@deriving.make.default "query"]
type_: string,
operator: operator,
reducer: reducer,
query: query,
evaluator: evaluator,
};
[@deriving (make, to_yojson { strict: false })]
type notification = {
/* Currently the notification with ID 1 is Slack */
[@deriving.make.default 1]
id: int
};
let notifiction = make_notification;
let condition = (operator_type, reducer_type, query, evaluator) =>
{ type_: "query", operator: {type_: operator_type}, reducer: reducer(reducer_type), query, evaluator};
[@deriving (make, to_yojson { strict: false })]
type t = {
message: string,
name: string,
[@deriving.make.default []]
conditions: list(condition),
[@deriving.yojson.key "executionErrorState"]
[@deriving.make.default `alerting]
execution_error_state: execution_error_state,
[@deriving.make.default "60s"]
frequency: string,
[@deriving.yojson.key "noDataState"]
[@deriving.make.default `ok]
no_data_state: no_data_state,
[@deriving.make.default [notifiction()]]
notifications: list(notification),
[@deriving.make.default 1]
handler: int,
};
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.