-
Notifications
You must be signed in to change notification settings - Fork 6
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
Prometheus metrics #1498
Prometheus metrics #1498
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I'd move some calls to increment counters as soon as possible within the functions to capture the metrics despite runtime errors
lib/ask/runtime/nuntium_channel.ex
Outdated
|> Nuntium.Client.send_ao(channel.settings["nuntium_account"], messages) | ||
|
||
SurvedaMetrics.increment_counter_with_label(:surveda_nuntium_enqueue, [elem(response, 0)]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will label the status with "ok" or "error" instead of the HTTP status code from Nuntium
lib/ask/runtime/verboice_channel.ex
Outdated
{:ok, %{"state" => "expired"}} -> false | ||
{:ok, %{"state" => _}} -> true | ||
{:ok, %{"state" => _}} -> | ||
SurvedaMetrics.increment_counter_with_label(:surveda_verboice_enqueue, [elem(response, 0)]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not where a call is enqueued in Verboice. Move this to the setup
function.
web/models/RespondentStatsMetrics.ex
Outdated
alias Ask.Repo | ||
|
||
def collect_mf(_registry, callback) do | ||
respondent_stats_query = "select rs.* from respondent_stats rs" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use RespondentStats
model?
|> Enum.zip(row) | ||
|> Enum.into([]) | ||
end) | ||
callback.(create_gauge( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not generating the gauge with the right shape. The count
value from the table should be used as the value for each set of labels.
Also I'd not "reflect" on the columns. The mode
column currently stores a JSON with an array of strings. Let's convert that into a comma separated string for the mode
label in the gauge.
web/models/RespondentStatsMetrics.ex
Outdated
Prometheus.Model.create_mf(name, help, :gauge, __MODULE__, data) | ||
end | ||
|
||
defp formatRow(row) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use camel case
…e RespondentStats model and correct formatting of metrics, moved verboice and nuntium enqueue metrics to each client accordingly to get the request status code
Changes and files for #1472