- From: Norman Walsh <ndw@nwalsh.com>
- Date: Sat, 07 Oct 2017 15:54:55 -0400
- To: XProc Dev <xproc-dev@w3.org>
- Message-ID: <87vajq7my8.fsf@nwalsh.com>
Vojtech Toman <vtoman@opentext.com> writes: > What about a Spring AOP-like approach? Instead of inserting new steps > into the dependency graph, the processor could simply create "proxy > steps" that would wrap around the inspected steps and intercept the > before/during/after/... stages of the invocation? Ideally, that’s an implementation detail. In fact, I’ve since refactored my design and now what I do is closer to what you describe. > Using the > AOP/AspectJ terminology, you would be defining pointcuts (expressions > identifying the steps you want to inspect) and advices (actions to be > taken when a point in execution with a matching pointcut is reached). > You could register Before advices that will be executed before a step > runs, After advices that will get executed after the step runs, etc. The current motivation for this spec is inspection for debugging purposes: what steps ran, when did they run, how long did they take, what where the inputs, outputs, and parameters to them? In my implementation, at the API level, you get something clsoer to advices, but I haven’t tried to design for complete generality. > It might also be useful to allow, in addition to being able to point > to specific steps, to create pointcuts that match steps with a > specific QName (for instance, to trace all p:http-request steps), or > even a namespace (to trace all steps from a 3rd-party library). My proposal uses XPath to identify the steps. If you want to know when all the p:http-request steps run: <p:start step="//p:http-request" …> I’ve added four functions that you can use in AVT/TVTs in the injectable: cx:injectable-id() returns an identifier for the injectable being run (At the moment, it’s only unique to the element that defined the injectable, not the instance of the injectable. That’s probably not good enough, but I’m not sure what’s best.) cx:step-name() returns the name of the step being observed cx:step-type() returns the type of the step being observed cx:step-elapsed() returns the number of seconds that the step ran (only available in a p:end injectable.) > Apart from the obvious use for tracing/debugging, you could the > AOP-like approach use this for processor-dependent things like > ensuring that a step (or a sequence of steps) runs in a transaction > etc. You could. I wonder if we should allow the injectables to provide hints about the implementation of the injectable. I suppose that can be done with implementation-defined extensions. Be seeing you, norm -- Norman Walsh Lead Engineer MarkLogic Corporation Phone: +1 512 761 6676 www.marklogic.com
Received on Saturday, 7 October 2017 21:12:07 UTC