Add metrics for prometheus observability - #661
Conversation
ef08f14 to
56cee10
Compare
56cee10 to
142e3f8
Compare
|
do we have a formatter? |
miles-grant-ibigroup
left a comment
There was a problem hiding this comment.
Haven't had a chance to test it yet, but looks solid
| } | ||
|
|
||
| public static void register() { | ||
| get("/metrics", MetricsController::getMetrics); |
There was a problem hiding this comment.
Is there no way to throw in a key param here? And that key could be set in the config
There was a problem hiding this comment.
yeah we could do that. I don't think it's really conventional but it's a reasonable approach.
There was a problem hiding this comment.
I wasn't sure which would be easier so I added both query param and header based API key support!!
36b941b to
5c612db
Compare
miles-grant-ibigroup
left a comment
There was a problem hiding this comment.
Working great! I adore it
binh-dam-ibigroup
left a comment
There was a problem hiding this comment.
Please move secrets from server.yml to env.yml.
| * A method to initialize all scheduled tasks upon server startup. | ||
| */ | ||
| public static void initialize() { | ||
| if(DataManager.isModuleEnabled("metrics")) { |
There was a problem hiding this comment.
Insert space after if.
| * Schedules a task to refresh the metrics inventory on a regular interval | ||
| * @param period refresh interval | ||
| * @param unit unit for the refresh interval | ||
| */ |
| enabled: true | ||
| # If set, this API key must be passed to access the /metrics endpoint. | ||
| # Pass via header "X-API-Key" or query parameter "api_key". | ||
| # api_key: your-secret-api-key |
There was a problem hiding this comment.
Secrets should be stored in env.yml instead of server.yml.
| import static spark.Spark.get; | ||
|
|
||
| public class MetricsController { | ||
| private static final String METRICS_API_KEY_CONFIG = "modules.metrics.api_key"; |
There was a problem hiding this comment.
Secrets should be from env.yml. All properties are stored flat in env.yml (no hierarchy or categories).
Checklist
devbefore they can be merged tomaster)Description
I'm adding a /metrics endpoint and tracking a bunch of metrics with micrometer gauges and counters. We also get a bunch of JVM stats built in from micrometer.
note it's unauthenticated, so users will need to make sure to filter that url in their reverse proxy if they feel like the data contained is sensitive.
example of metrics here: https://gist.github.com/daniel-heppner-ibigroup/3efda5ac5238337727af09009d84b9a1