Hi folks,

Just exploring the best way to go about this. We use a X-Request-ID header
for tracing and logging requests through our application stack (from
CDN/load balancers through to databases) and I'm exploring adding support
this to GeoServer. The request ID values are UUIDs.

ows.Request has a protected UUID identifier property, which doesn't seem to
be used for much. So, I'm thinking:

   - Alter the Request class to make it settable
   - Set it in a custom early Dispatcher init() callback from the header if
   present -- it would miss some of the request parsing but that's not the end
   of the world.
   - Add it to the logging MDC context in the same custom callback
   - Use it in the logging output format from the MDC context so all log
   entries associated with that request are tagged with the ID
   - Alter the monitor extension so that the audit log has access to
   Request.identifier, so the audit log can contain the ID too
   - Get it through to the SQL session start/stop scripts so they can set
   it in postgres (via "SET application_name") -- maybe via EnvFunction a bit
   like GSUSER.
   - Postgres can log it for any SQL errors/slow-query traces/locks/etc


1. Obvious flaws? Am I missing an easier approach?
2. Would the changes to Request and the Monitor extension likely be
accepted as a contribution?
3. Is this behaviour that would be useful for others? If so, potentially a
config option that enables extracting a value from a defined header and
adding it to the logging context/environment early in Dispatcher itself.

Thanks,

Rob :)
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://makebettercode.com/inteldaal-eval
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to