This message was deleted.
# community-support
s
This message was deleted.
v
Which information do you need that is not given to the operation completion listener? Yes, it is only triggered after a task finished, but it contains also information about when the task started.
m
What I'm missing is an officially supported way of getting this data, and with start events. The external API I'm tracing to requires the parent to be there before the child, so with only
finished
events, I'd have to keep a cache of all events until the build is fully finished before I can process them. Not good, since the main build this should be used for generates about 100k events.
v
What I'm missing is an officially supported way of getting this data, and with start events.
I asked which information it is you miss from the officially supported
OperationCompletionListener
that you currently cannot get out of it.
The external API I'm tracing to requires the parent to be there before the child, so with only
finished
events, I'd have to keep a cache of all events until the build is fully finished before I can process them.
Unfortunately, I didn't get what you mean, can you elaborate a bit on what you mean / what you try to achieve? Then I might be able to suggest some proper way to do it.
m
I'm trying to collect as much data about build configuration and execution as I can, to be able to find performance degradations and other problems, so the more events I can get, the better. I might be wrong, but
OperationCompletionListener
only seems to support task executions, which is way too coarse for my purposes and completely excludes the configuration phase. To correlate all that information in the external system I'm reporting to, I need proper parent-child relationships at the time I'm seeing the child, which is the opposite order of
finished
events. I can get all that if I register a
BuildOperationListener
via an injected
BuildOperationListenerManager
, but all of that is internal, and if I don't manage to remove my listener again, it even stays active in the daemon for all subsequent builds, which is really not what I want.
v
I don't think there is a supported way for what you are trying to do, besides "simply" using build scans.
m
I was afraid you'd say that. So just to make sure: there is nothing better than`OperationCompletionListener` that's officially supported, right? The only way to get build information via listeners is for tasks and nothing else?
v
As far as I am aware of, yes. You could maybe add a
doFirst
action to all tasks where you can to "before-task" actions.
m
Yeah, but that would still only give me information about tasks. Thanks for your help and for confirming my suspicions that I'll have to do this via internal APIs. As little as I like that.
👌 1
e
https://docs.gradle.org/current/javadoc/org/gradle/build/event/BuildEventsListenerRegistry.html you only get notified on completion, but the events include start and end time in result
m
Thanks, I had tried that, because it was official, but it's only for tasks and backwards from the way I need it.
v
Btw. for task there is an official public API that also gets start events:
TaskExecutionGraph.addTaskExecutionListener
It's just deprecated and not compatible with configuration cache. 🙂
🤣 1