Feature/influxdb metrics - #97
Conversation
dev to main
Make the internal hermes endpoints require authentication to stop bot…
cnweaver
left a comment
There was a problem hiding this comment.
I don't know much about InfluxDB, so I don't have much frame of reference for most of this, but the idea seems sound.
I like capturing both the endpoint and authenticated user (if any) in each record. I see that the final result code for the request is also included, which will give insight into whether each request succeeded, but I wonder if there are cases where more information might be important. A case I've often wanted in the past is to be able to check which user was responsible for creating a specific object (and in which request, from what origin), or similarly given a request, which object(s) it created/affected. For example, I've wanted this for incident response, like if some user has always connected from Kansas before, but there have now been some suspicious requests from Madagascar, I'd like to be able to locate all of those requests and what they touched. For GET /objects/obj_foo that's usually obvious, but I'm not sure if it in in HERMES for cases like POST /new_object, where the object ID is assigned by the server after receiving the request. Likewise, knowing the IP address from which each request arrived (possibly including a chain of proxies) can be pretty important.
@dpetravick might have thoughts on this also.
Adds a middleware to the end of the stack that sends completed request details to influxDB if it is configured correctly. Spawns off a Geventlet thread to actually write to the influxDB server so that problems with that connection don't impact the users response times. I've tested this locally with sending metrics to
hermes_teston the influxDB server and they were received as expected.