-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tasks reported out of order if some events are deleted / missing #63
Comments
Thanks, Eric! I'm glad to hear it's been useful to you. So your reasoning is mostly correct. It's Eliot's builtin parser and it's waiting for the next event in the level to occur sequentially, which won't happen because it doesn't exist in the data. The good news is that eliottree has a way to filter events via the $ eliot-tree --select "level != 'debug'" normal.log There's an open issue on itamarst/eliot#289 about improving the documentation on this topic, if you want to follow along or suggest something that would have helped you I'm sure it would be appreciated. |
Winner! Thanks! When I originally read the description of the --select syntax in the README I thought it was an inclusive filter only (I didn't realize I could use "!=" to make an exclusive statement) and I incorrectly thought "--select" could only be used to filter in/out a whole task. I think that's because the language "If any child task is selected the entire top-level task is selected." made me think a whole task was either in or out. I'll take a look at the open documentation issue and help out. Thanks again for the quick response and for the excellent tool! |
Jonathan, I've been running some experiments in hopes of writing a filtering cookbook page for the Eliot documentation. Based on my observations (sample code below) I think the following statements are true. Can you confirm?
Thanks! from eliot import start_action, to_file, Message
import subprocess
to_file(open("example.log", "w"))
with start_action(action_type="first_action"):
Message.log(message_type="some_message", level='in_test', data=list(range(3)))
Message.log(message_type="some_message", level='in_production', data='spam')
try:
with start_action(action_type="second_action"):
Message.log(message_type="some_message", level='in_test', data=list(range(3, 5)))
Message.log(message_type="some_message", level='in_production', data='eggs')
raise RuntimeError("Broken pram")
except:
pass
select_expressions = [
None,
'"level != \'in_test\'"',
'"action_status == \'failed\'"',
'"task_level[0] == \\`3\\`"',
'"level == \'in_test\' && data[0] == \\`3\\`"',
'"level != \'in_test\' && level != \'in_production\'"',
]
print('')
for case, select_expression in enumerate(select_expressions):
command = 'eliot-tree'
if select_expression:
command += ' --select ' + select_expression
command += ' example.log'
print('Case: {}'.format(case))
print(command)
print('=' * len(command))
subprocess.call(command, shell=True)
select_expressions = [
('"level != \'in_test\'"', '"level != \'in_production\'"'),
('"level == \'in_test\'"', '"level == \'in_production\'"'),
('"level == \'in_test\'"', '"level == \'in_test\'"'),
]
for case, (select_expression1, select_expression2) in enumerate(select_expressions):
print('Case: Multi Select {}'.format(case))
command = 'eliot-tree --select {} --select {} example.log'.format(select_expression1, select_expression2)
print(command)
print('=' * len(command))
subprocess.call(command, shell=True) Output from the above script:
|
Eric, some comprehensive documentation for this feature would be great! In fact #37 has been open for a while. Documentation like this seems like it ought to be in eliottree rather than Eliot, however Eliot has a well structured documentation resource already. I'm not personally too phased about this since I'd appreciate the documentation either way, it might be worth running it past Itamar on the Eliot issue. Nevertheless, I appreciate your effort and enthusiasm, thank you! Recently-ish I ditched my own tree parser implementation in favour of the stricter one in Eliot, it's not impossible that subtle changes went unnoticed. Let me address some of your points:
To summarise my thoughts:
I'd be keen to hear your thoughts. |
Jonathan,
Fantastic tool! I have been making great use of it!
I have an application which logs debug events when a debug option is enabled. I've been experimenting with the idea of always logging the debug information, and filtering the debug events out of the log when I don't want/need to see them. I found that if I delete an event it can cause eliot-tree to render the associated task out of (chronological) order (presumably because the parser is waiting for the missing event to show up in the log data, and then eventually gives up?)
Here's an example:
Which results in:
normal.tree
filtered.tree
Perhaps I am crazy to be trying to filter events, but it seems so close to working that I thought I'd ask what you thought.
Cheers!
The text was updated successfully, but these errors were encountered: