RedHatInsights / insights-api-common-rails

Header, Encryption, RBAC, Serialization, Pagination and other common behavior for Insights microservices built with Rails
Apache License 2.0
3 stars 25 forks source link

Add support for custom prometheus metrics defined by the application #184

Closed lindgrenj6 closed 4 years ago

lindgrenj6 commented 4 years ago

This is for https://github.com/RedHatInsights/topological_inventory-ingress_api/pull/87 and potentially other applications that are currently using the Common Metrics classes.

Basically it allows passing in a hash defined by the application to register prometheus metrics and make helper methods for them as specified.

First pass only supports counters, but maybe I'll implement support for histograms etc in the future.

example implementation: https://github.com/RedHatInsights/topological_inventory-ingress_api/pull/87

# TODO:

lindgrenj6 commented 4 years ago

@syncrou I updated the implementation to only require :name, :type, and :description. This way it'll just define methods based on the name, the instancevar is just the name parameter with `#{type}` appended since it's not really exposed by the api. Let me know what you think!

syncrou commented 4 years ago

@lindgrenj6 - Looks good but seems to be some Travis issues.

syncrou commented 4 years ago

@mkanoor would you mind taking a look?