Skip to content
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

Improved server logging #1521

Merged
merged 7 commits into from
Jul 27, 2016
Merged

Improved server logging #1521

merged 7 commits into from
Jul 27, 2016

Conversation

necaris
Copy link

@necaris necaris commented Jun 8, 2016

Takes #1492 and adds to it, defaulting logging to sys.stdout and adding documentation strings for the new parameters.

As far as basic logging of output this is already done, however we will probably want to add more specific logging for different scenarios -- this can be in this PR or in a future update.

@coveralls
Copy link

coveralls commented Jun 8, 2016

Coverage Status

Changes Unknown when pulling 740c36c on necaris:brain-dead-server-logging into * on blaze:master*.

@necaris
Copy link
Author

necaris commented Jun 9, 2016

@kwmsmith Without knowing more about what users want to track in the server this is pretty much good to go -- I just added a couple of debug logging calls and defaulting to stdout to your initial work.

@kwmsmith
Copy link
Member

kwmsmith commented Jun 9, 2016

@necaris great.

@llllllllll thoughts?

@coveralls
Copy link

coveralls commented Jun 9, 2016

Coverage Status

Changes Unknown when pulling 0a43fd6 on necaris:brain-dead-server-logging into * on blaze:master*.

@kwmsmith kwmsmith added this to the 0.11 milestone Jun 9, 2016
@llllllllll
Copy link
Member

I like it! ping @richafrank

logger = flask.current_app.logger
logger.debug("Calling %s" % func.__name__)
ret = func(*args, **kwargs)
logger.debug("Leaving %s" % func.__name__)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be useful to log "Leaving" in the exception case, i.e. should this be in a finally?

@richafrank
Copy link
Contributor

I was looking for any danger in returning exception tracebacks to endpoint consumers, but since those consumers would have passed authorization already, I think any such danger is mitigated.

except Exception as e:
return ("Computation failed with message:\n%s: %s" % (type(e).__name__, e),
RC.INTERNAL_SERVER_ERROR)
error_msg = "Computation failed with message:\n%s: %s\n%s" % (type(e).__name__, e, traceback.format_exc())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make the format_exc function configurable? The use case that we have is that we run an extension of blaze server which may potentially have sensitive information in the traceback, we would like to filter the information the client sees before sending it over. I was thinking a function from traceback to str.

To pass the traceback to the function in a py2/3 compat way we could do:

    tbmsg = serialize_traceback(sys.exc_info()[2])  # it is important not to store exc_info or the tb in a local

By default it could be toolz.compose(''.join, traceback.format_tb) which will do the same as it is currently doing.

Also, how do you feel about printing the traceback and then the error. Right now the format will look like:

client tb
server  error message
server tb

and I think it may be nicer as:

client tb
server tb
server error message

@kwmsmith kwmsmith modified the milestones: 0.11, 0.11.1 Jul 19, 2016
@coveralls
Copy link

coveralls commented Jul 20, 2016

Coverage Status

Coverage decreased (-0.06%) to 89.532% when pulling 66e6f3f on necaris:brain-dead-server-logging into e601b98 on blaze:master.

@necaris
Copy link
Author

necaris commented Jul 20, 2016

@kwmsmith @llllllllll Added requested configurability in be85e1a

@kwmsmith kwmsmith changed the title Brain dead server logging Improved server logging Jul 26, 2016
@kwmsmith
Copy link
Member

@necaris thoughts on the travis failures? They aren't obvious to me...

@necaris
Copy link
Author

necaris commented Jul 26, 2016

@kwmsmith Thanks for pointing them out! Looking into them now, I'm doing some refactoring to make them pass and adding some tests too.

@coveralls
Copy link

coveralls commented Jul 26, 2016

Coverage Status

Coverage decreased (-0.9%) to 88.733% when pulling aa8f306 on necaris:brain-dead-server-logging into d5f7f5f on blaze:master.

@coveralls
Copy link

coveralls commented Jul 26, 2016

Coverage Status

Coverage decreased (-0.9%) to 88.733% when pulling aa8f306 on necaris:brain-dead-server-logging into d5f7f5f on blaze:master.

@coveralls
Copy link

coveralls commented Jul 26, 2016

Coverage Status

Coverage decreased (-0.9%) to 88.72% when pulling 06799c4 on necaris:brain-dead-server-logging into d5f7f5f on blaze:master.

@coveralls
Copy link

coveralls commented Jul 26, 2016

Coverage Status

Coverage decreased (-0.9%) to 88.733% when pulling 06799c4 on necaris:brain-dead-server-logging into d5f7f5f on blaze:master.

@necaris
Copy link
Author

necaris commented Jul 26, 2016

@kwmsmith Apologies for the half-baked PR. It should be good to go now -- refactored the configurable exception logging and added tests for it. And rebased so each commit should be a logical chunk of work.

@coveralls
Copy link

coveralls commented Jul 26, 2016

Coverage Status

Coverage decreased (-0.06%) to 89.611% when pulling 52aba43 on necaris:brain-dead-server-logging into d5f7f5f on blaze:master.

Rami Chowdhury added 4 commits July 26, 2016 18:47
Ensure that if desired logs can capture server startup and shutdown, as
well as detect when a dataset was added. Note that the compute operation
already has timing log output, and the default Flask logs for the
datashape check operation should contain all the information that was in
the request.
As suggested at
#1521 (diff)

Includes tests for the logged output
@coveralls
Copy link

coveralls commented Jul 26, 2016

Coverage Status

Coverage decreased (-0.06%) to 89.611% when pulling ef1c2f6 on necaris:brain-dead-server-logging into d5f7f5f on blaze:master.

@kwmsmith kwmsmith merged commit bcddeba into blaze:master Jul 27, 2016
@necaris necaris deleted the brain-dead-server-logging branch November 1, 2016 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants