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

Add InfluxDB/Grafana visualization support #127

Merged
merged 6 commits into from
Jan 31, 2017
Merged

Add InfluxDB/Grafana visualization support #127

merged 6 commits into from
Jan 31, 2017

Conversation

larstvei
Copy link
Contributor

@larstvei larstvei commented Oct 5, 2016

This patch enables the erlang backend to write metrics to a running InfluxDB instance, which can be visualized using Grafana. A script run_influx_grafana.sh is provided which starts an InfluxDB and a Grafana instance using Docker:

$ absc -erlang "example.abs"
$ cd gen/erl/influx-grafana/
$ sh run_influx_grafana.sh 

After a short while Grafana will be available at http://localhost:3000, initialized with the InfluxDB datasource and a dashboard showing cpu load. The dashboard is located at Home -> ABS.

While the InfluxDB and Grafana instances are running, the model can be run with option -i to enable writing to the InfluxDB:

$ cd /path/to/gen/erl/absmodel
$ run -i

A screenshot demonstrating the visualization provided by Grafana:
screen shot 2016-09-30 at 12 00 16 2

- Adding a version number allows for `abs-mode.el' installable using
  `package-install-file'.

- Adding autoloads ensures that `abs-mode' is loaded when needed.
- Added a module for writing to a InfluxDB using gen_server.

- Modified runtime.erl so that the user can enable writing to a InfluxDB
  with a command line argument. Additional options for specifying the
  URL and/or database are provided.

- These options can be specified using Emacs variables.

- A script for running a InfluxDB+Grafana is provided. It is located at
  `gen/erl/influx-grafana/run_influx_grafana.sh' of a compiled ABS
  model.
@rudi rudi self-assigned this Oct 6, 2016
@rudi rudi added the ready label Oct 6, 2016
- Rather than writing each measurement to the database separately,
  collect measurements while writing to the database and write the
  collected measurements in bulk.

- Use gen_fsm in favor of gen_server. There are two states, namely
  `ready_to_send' and `wait_for_response'. In a ready state, a
  new measurement will be sent to the database along with previously
  collected measurements. In a waiting state measurements are simply
  collected.
- A separate function was used for making a synchronous request to the
  database, which was used on termination. The request might as well be
  asynchronous, and so the function is removed.

- Instead of removing possibly problematic characters from the label of
  the deployment component, just escape the string.
- Since we mainly run grafana locally, there is no need for having a
  login. We allowed anonymous users, but failed to make them
  administrators (i.e. having the privilege to make new dashboards and
  so on).
Copy link
Member

@rudi rudi left a comment

Choose a reason for hiding this comment

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

Looks good and is unrelated to the rest; I cherry-picked this commit into master.

@rudi rudi merged commit f23faac into abstools:master Jan 31, 2017
@rudi rudi removed the ready label Jan 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants