Coder Social home page Coder Social logo

yelp_clog's Introduction

yelp_clog's People

Contributors

asottile avatar ealter avatar ecanzonieri avatar fede1024 avatar flavray avatar jdb8 avatar ketanyelp avatar kkellyy avatar kmosher avatar lsheng avatar mango-j avatar nhandler avatar ny2ko avatar patricklucas avatar prat0318 avatar rsarvaria avatar tomelm avatar vkhromov avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yelp_clog's Issues

log_line() python 3.6 incompatibility with file logging enabled

With python3.6, yelp-clog 2.6.0, and clog_enable_file_logging: true a clog.log_line() call generates the following traceback:

  File "/code/virtualenv_run/lib/python3.6/site-packages/clog/global_state.py", line 79, in log_line
    logger.log_line(stream, line)
  File "/code/virtualenv_run/lib/python3.6/site-packages/clog/loggers.py", line 252, in log_line
    self.stream_files[stream] = self._create_file(stream)
  File "/code/virtualenv_run/lib/python3.6/site-packages/clog/loggers.py", line 272, in _create_file
    return open(os.path.join(config.log_dir, stream + '.log'), 'ab', 0)
  File "/code/virtualenv_run/lib/python3.6/posixpath.py", line 78, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not ValueProxy

yelp_clog silently fails for all future logs if called once before being configured

If log_line is called before logging is configured, check_create_default_loggers will not add any loggers to the global list, but will change it's value from None. Then, every subsequent time log_line is called, we'll skip adding loggers because the global variable is no longer None, but won't log anything because there are no loggers. This produces no errors and is very difficult to identify and track down when it occurs.

eliot@ proposed a rough solution seen here: https://i.fluffy.cc/zqpqGxDBv8Rd5Mb99b2p9xZg83fCSt8J.html. Something along these lines would make an early call to log_line fail loudly and prevent us from getting into a silently failing logging situation in the future.

Uwsgi Plugin serialization format

RE: My recent PR we know that marshal is dangerous but fast. However doing some rudimentary testing I think using struct + simple byte concat is faster on pre-Python3.5 (apparently someone decided to overhaul the marshal serialization I suppose). Here's a rudimentary test script I used to run some very basic timings. Using this approach means we have to deal with unicode vs. bytes ourselves, but since clog converts lines into UTF-8 anyways I don't think that will be much of an issue. How about stream names? It doesn't look like the ScribeLogger converts that to UTF-8, so we might need to reconstitute the unicode format by storing the encoding somehow.

Anyways, struct + raw bytes would be safer than marshal and would work in this case since we can make some strong assumptions about the arguments. I'll look into changing it but I think we should get the current PR in first just to fix the marshal.loads problem.

Read the Docs Builds Fail

Currently the docs fail to build on Read the Docs with the follow error on this step:

python /home/docs/checkouts/readthedocs.org/user_builds/yelp-clog/envs/latest/bin/sphinx-build -T -E -b readthedocs -d _build/doctrees-readthedocs -D language=en . _build/html

Running Sphinx v1.3.1
making output directory...

Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/yelp-clog/envs/latest/local/lib/python2.7/site-packages/sphinx/cmdline.py", line 244, in main
opts.warningiserror, opts.tags, opts.verbosity, opts.jobs)
File "/home/docs/checkouts/readthedocs.org/user_builds/yelp-clog/envs/latest/local/lib/python2.7/site-packages/sphinx/application.py", line 126, in init
confoverrides or {}, self.tags)
File "/home/docs/checkouts/readthedocs.org/user_builds/yelp-clog/envs/latest/local/lib/python2.7/site-packages/sphinx/config.py", line 277, in init
execfile_(filename, config)
File "/home/docs/checkouts/readthedocs.org/user_builds/yelp-clog/envs/latest/local/lib/python2.7/site-packages/sphinx/util/pycompat.py", line 128, in execfile_
exec_(code, globals)
File "/home/docs/checkouts/readthedocs.org/user_builds/yelp-clog/envs/latest/local/lib/python2.7/site-packages/six.py", line 699, in exec

exec("""exec code in globs, locs""")
File "", line 1, in
File "conf.py", line 43, in
from clog import version as version
File "/home/docs/checkouts/readthedocs.org/user_builds/yelp-clog/checkouts/latest/clog/init.py", line 34, in
from clog.loggers import ScribeLogger, ScribeIsNotForkSafeError
File "/home/docs/checkouts/readthedocs.org/user_builds/yelp-clog/checkouts/latest/clog/loggers.py", line 62, in
scribe_thrift = _load_thrift()
File "/home/docs/checkouts/readthedocs.org/user_builds/yelp-clog/checkouts/latest/clog/loggers.py", line 59, in _load_thrift
fn, module_name='scribe_thrift', include_dirs=[include_dir])
File "/home/docs/checkouts/readthedocs.org/user_builds/yelp-clog/envs/latest/local/lib/python2.7/site-packages/thriftpy-0.3.2-py2.7-linux-x86_64.egg/thriftpy/parser/init.py", line 30, in load
include_dir=include_dir)
File "/home/docs/checkouts/readthedocs.org/user_builds/yelp-clog/envs/latest/local/lib/python2.7/site-packages/thriftpy-0.3.2-py2.7-linux-x86_64.egg/thriftpy/parser/parser.py", line 484, in parse
with open(path) as fh:
IOError: [Errno 2] No such file or directory: 'scribe.thrift'

Exception occurred:
File "/home/docs/checkouts/readthedocs.org/user_builds/yelp-clog/envs/latest/local/lib/python2.7/site-packages/thriftpy-0.3.2-py2.7-linux-x86_64.egg/thriftpy/parser/parser.py", line 484, in parse
with open(path) as fh:
IOError: [Errno 2] No such file or directory: 'scribe.thrift'
The full traceback has been saved in /tmp/sphinx-err-LNhokb.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at https://github.com/sphinx-doc/sphinx/issues. Thanks!

yelp_clog should acquire the logging lock with a timeout

If we have been asked to log lines with a timeout, we probably shouldn't block forever waiting to acquire the RLock in the _log_line_no_size_limit method. Instead we probably want to just fail to log the line.
Basically we need to change this code to not block forever on the lock.

Remove hard-dep of thriftpy==0.1.15

Currently it forces all other packages depping on thriftpy to also hard-pin 0.1.15, otherwise any service which uses both breaks with version conflict. This should be removed.

Tests Require testifycompat Module

Our tests currently rely on the testifycompat module. However, we have only open sourced testify. We should either fallback to testify or fully migrate to pytest (preferred).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.