eliot icon indicating copy to clipboard operation
eliot copied to clipboard

Bring back addFailureFields or a way to log information only when an action (or sub-action) fails

Open wallrj opened this issue 8 years ago • 2 comments

Eliot used to have addFailureFields

  • https://github.com/ClusterHQ/eliot/blob/0.3.0/eliot/_action.py#L274

But it was removed for want of a use case. Here's one:

In Flocker we'd like to be able to log the entire configuration and cluster state seen by a Flocker agent when it is converging on that configuration from that cluster state.

But in large clusters the with large state and configuration structures, it becomes prohibitively expensive to serialise and log those structures.

  • https://github.com/ClusterHQ/flocker/pull/2729

We'd also like to be able to log the entire response body of every request serviced by our control services, but that too is prohibitively expensive so we removed the logging:

  • https://github.com/ClusterHQ/flocker/pull/2729

But without that information it'll be difficult to understand the situation that led to the exception.

So perhaps we can add that configuration and state in the parent Action:

  • https://github.com/ClusterHQ/flocker/blob/c2e49b5cf95b31708751076a5989c211d0b776ce/flocker/node/_loop.py#L524

And have that logged only if, for example, the CreateFileSystem action fails:

  • https://github.com/ClusterHQ/flocker/blob/c2e49b5cf95b31708751076a5989c211d0b776ce/flocker/node/agents/blockdevice.py#L533

wallrj avatar Mar 30 '16 18:03 wallrj

The API might look something like the addDetail feature in testtools.

  • https://testtools.readthedocs.org/en/latest/for-test-authors.html#details

wallrj avatar Mar 30 '16 18:03 wallrj

I've started just using a raw Message.log(...) to add more details to a started action. I'm not sure if this is awesome or not but it at least gets the information capture in the right place.

exarkun avatar Feb 08 '17 14:02 exarkun