Giter VIP home page Giter VIP logo

nameko-sentry's Introduction

Nameko

[nah-meh-koh]

A microservices framework for Python that lets service developers concentrate on application logic and encourages testability.

A nameko service is just a class:

# helloworld.py

from nameko.rpc import rpc

class GreetingService:
    name = "greeting_service"

    @rpc
    def hello(self, name):
        return "Hello, {}!".format(name)

You can run it in a shell:

$ nameko run helloworld
starting services: greeting_service
...

And play with it from another:

$ nameko shell
>>> n.rpc.greeting_service.hello(name="ナメコ")
'Hello, ナメコ!'

Features

  • AMQP RPC and Events (pub-sub)
  • HTTP GET, POST & websockets
  • CLI for easy and rapid development
  • Utilities for unit and integration testing

Getting Started

Support

For help, comments or questions, please go to https://discourse.nameko.io/.

For enterprise

Available as part of the Tidelift Subscription.

The maintainers of Nameko and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

Security contact information

To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.

Contribute

  • Fork the repository
  • Raise an issue or make a feature request

License

Apache 2.0. See LICENSE for details.

nameko-sentry's People

Contributors

mattbennett avatar mrlokans avatar

Stargazers

 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nameko-sentry's Issues

ClusterRpcProxy support?

Hello,

I noticed that when I do:

        with ClusterRpcProxy(CONFIG) as rpc:
            some_results = rpc.some_service_name.some_method()

and when an exception occurs on this peice of code (such as some_service_name cannot be found with a stack trace provided below), that Sentry doesn't get the exception.

Does nameko-sentry support ClusterRpcProxy exception handling? Thanks!

celery |   File "/usr/local/lib/python3.7/site-packages/nameko/amqp/publish.py", line 210, in publish
celery |     **publish_kwargs
celery |   File "/usr/local/lib/python3.7/site-packages/kombu/messaging.py", line 181, in publish
celery |     exchange_name, declare,
celery |   File "/usr/local/lib/python3.7/site-packages/kombu/connection.py", line 518, in _ensured
celery |     return fun(*args, **kwargs)
celery |   File "/usr/local/lib/python3.7/site-packages/kombu/messaging.py", line 203, in _publish
celery |     mandatory=mandatory, immediate=immediate,
celery |   File "/usr/local/lib/python3.7/site-packages/amqp/channel.py", line 1784, in basic_publish_confirm
celery |     self.wait([spec.Basic.Ack, spec.Basic.Nack], callback=confirm_handler)
celery |   File "/usr/local/lib/python3.7/site-packages/amqp/abstract_channel.py", line 88, in wait
celery |     self.connection.drain_events(timeout=timeout)
celery |   File "/usr/local/lib/python3.7/site-packages/amqp/connection.py", line 505, in drain_events
celery |     while not self.blocking_read(timeout):
celery |   File "/usr/local/lib/python3.7/site-packages/amqp/connection.py", line 511, in blocking_read
celery |     return self.on_inbound_frame(frame)
celery |   File "/usr/local/lib/python3.7/site-packages/amqp/method_framing.py", line 79, in on_frame
celery |     callback(channel, msg.frame_method, msg.frame_args, msg)
celery |   File "/usr/local/lib/python3.7/site-packages/amqp/connection.py", line 518, in on_inbound_method
celery |     method_sig, payload, content,
celery |   File "/usr/local/lib/python3.7/site-packages/amqp/abstract_channel.py", line 145, in dispatch_method
celery |     listener(*args)
celery |   File "/usr/local/lib/python3.7/site-packages/amqp/channel.py", line 2001, in _on_basic_return
celery |     raise exc
celery | amqp.exceptions.ChannelError: Basic.return: (312) NO_ROUTE
celery |
celery | During handling of the above exception, another exception occurred:
celery |
celery | Traceback (most recent call last):
celery |   File "/usr/local/lib/python3.7/site-packages/nameko/rpc.py", line 445, in _call
celery |     extra_headers=extra_headers
celery |   File "/usr/local/lib/python3.7/site-packages/nameko/amqp/publish.py", line 214, in publish
celery |     raise UndeliverableMessage()
celery | nameko.amqp.publish.UndeliverableMessage
celery |
celery | During handling of the above exception, another exception occurred:
celery |
celery | Traceback (most recent call last):
celery |   File "/source/reader/services.py", line 132, in _some_function
celery |     some_piece_of_code
celery |   File "/usr/local/lib/python3.7/site-packages/my_code/some_folder/my_file.py", line 585, in some_function_i_call
celery |     some_results = rpc.some_service_name.some_method()
celery |   File "/usr/local/lib/python3.7/site-packages/nameko/rpc.py", line 372, in __call__
celery |     reply = self._call(*args, **kwargs)
celery |   File "/usr/local/lib/python3.7/site-packages/nameko/rpc.py", line 448, in _call
celery |     raise UnknownService(self.service_name)
celery | nameko.exceptions.UnknownService: Unknown service `some_service`

get_dependency

Would it be possible to add a get_dependency method to return the raven client? For times when you want to send a non exception message.

client.captureMessage('Somebody did something sorta strange.')

Capture exception without raising

Hi,

How would I go about capturing an exception without actually raising?

Example:

def do_thing():
    try:
        raise Exception
    except:
        # send the exception to Sentry
        return False

I have some code that "fails" cleanly (i.e. it is OK for it to throw the exception), but I'd like to see the full trace for some specific exceptions, without it failing the whole process.

Many thanks for any pointers,

Geoff

Memory leak when breadcrumbs contain worker thread references

By default, Raven will monkey patch all loggers and transmit logged messages as breadcrumbs.

Breadcrumbs are stored in a thread-local buffer which should be released when the thread exits. But if you log anything inside the worker thread (e.g. a traceback object) that holds a reference to its thread, the thread's refcount never goes to zero and the thread-locals are not garbage collected.

Raven 6.3.0 "'Queue' object has no attribute 'all_tasks_done'"

I'm seeing these errors/warnings in the logs using Raven 6.3.0

Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/opt/io/storage/.env/lib/python3.5/site-packages/raven/transport/threaded.py", line 65, in main_thread_terminated
if not self._timed_queue_join(initial_timeout):
File "/opt/io/storage/.env/lib/python3.5/site-packages/raven/transport/threaded.py", line 96, in _timed_queue_join
queue.all_tasks_done.acquire()
AttributeError: 'Queue' object has no attribute 'all_tasks_done'

Is this a bug in the current release of Raven?

Proper way to disable sentry log aggregation on different environments?

Hello there. I have a case when I have a set of configs to be used in different environments (e.g. dev/prod) and I don't want any sentry error handling in the development environment, but if I simply do not fill the required settings in the config - my service will fail to be loaded failing with the following error:

   File "/usr/local/lib/python3.5/site-packages/eventlet/greenthread.py", line 214, in main
     result = function(*args, **kwargs)
   File "/usr/local/lib/python3.5/site-packages/nameko/utils.py", line 176, in call
     return getattr(item, name)(*args, **kwargs)
   File "/usr/local/lib/python3.5/site-packages/nameko_sentry.py", line 13, in setup
     dsn = sentry_config['DSN']
TypeError: 'NoneType' object is not subscriptable

So what is the correct way to enable the Sentry logging only on the specific environemnt? Thank you

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.