Giter Club home page Giter Club logo

odoo-elasticapm's Introduction

odoo-elasticapm

License: AGPL-3

odoo-elasticapm integrate the APM tracking from the ELK suite

Contents

Install odoo-elasticapm:

pip install odoo-elasticapm

Then instead of launching odoo with odoo cmd use odoo-elasticapm:

odoo-elasticapm

Configuration

Following environment variable are needed:

ELASTIC_APM_SERVER_URL=http://apm-server:8200

The following one are optionnal:

ELASTIC_APM_SERVICE_NAME=my-customer ELASTIC_APM_TRANSACTION_SAMPLE_RATE=0.1

All environment variable are available on official documentation: https://www.elastic.co/guide/en/apm/agent/python/current/configuration.html

We still have issue on travis regarding verison 12 and 13 (I fail to reproduce them locally) If you want to use it on this version be carefull. Contibution and help is welcome

odoo-elasticapm's People

Contributors

sebastienbeau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

odoo-elasticapm's Issues

APM support Odoo 14

@sebastienbeau thanks for the code for the APM. I would like to know if it is something that you are still maintaining or you stop?
I would like to know why you didn't make this with an Odoo module and maybe some monkey-patch that will allow a simpler installation maybe?
I'll be happy to help to bring the module to support version 14 and next versions.

[14.0][ISSUE] TypeError: 'EndPoint' object is not iterable.

app_1 | 2022-02-14 12:05:31,204 241 ERROR latest werkzeug: Error on request:
app_1 | Traceback (most recent call last):
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
app_1 | result = request.dispatch()
app_1 | File "/usr/lib/python3/dist-packages/odoo/http.py", line 807, in dispatch
app_1 | r = self._call_function(**self.params)
app_1 | File "/usr/lib/python3/dist-packages/odoo/http.py", line 360, in _call_function
app_1 | return checked_call(self.db, *args, **kwargs)
app_1 | File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper
app_1 | return f(dbname, *args, **kwargs)
app_1 | File "/usr/lib/python3/dist-packages/odoo/http.py", line 348, in checked_call
app_1 | result = self.endpoint(*a, **kw)
app_1 | File "/usr/lib/python3/dist-packages/odoo/http.py", line 913, in call
app_1 | return self.method(*args, **kw)
app_1 | File "/usr/lib/python3/dist-packages/odoo/http.py", line 532, in response_wrap
app_1 | response = f(*args, **kw)
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/website/controllers/main.py", line 79, in index
app_1 | website_page = request.env['ir.http']._serve_page()
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/website/models/ir_http.py", line 293, in _serve_page
app_1 | r = response.render()
app_1 | File "/usr/lib/python3/dist-packages/odoo/http.py", line 1244, in render
app_1 | return env["ir.ui.view"]._render_template(self.template, self.qcontext)
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 1708, in _render_template
app_1 | return self.browse(self.get_view_id(template))._render(values, engine)
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/website/models/ir_ui_view.py", line 420, in _render
app_1 | return super(View, self)._render(values, engine=engine, minimal_qcontext=minimal_qcontext)
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/web_editor/models/ir_ui_view.py", line 28, in _render
app_1 | return super(IrUiView, self)._render(values=values, engine=engine, minimal_qcontext=minimal_qcontext)
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 1716, in _render
app_1 | return self.env[engine]._render(self.id, qcontext)
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_qweb.py", line 55, in _render
app_1 | result = super(IrQWeb, self)._render(id_or_xml_id, values=values, **context)
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 258, in _render
app_1 | self.compile(template, options)(self, body.append, values or {})
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 338, in _compiled_fn
app_1 | raise QWebException("Error to render compiling AST", e, path, node and etree.tostring(node[0], encoding='unicode'), name)
app_1 | Exception
app_1 |
app_1 | The above exception was the direct cause of the following exception:
app_1 |
app_1 | Traceback (most recent call last):
app_1 | File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 306, in run_wsgi
app_1 | execute(self.server.app)
app_1 | File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 294, in execute
app_1 | application_iter = app(environ, start_response)
app_1 | File "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py", line 113, in application
app_1 | return application_unproxied(environ, start_response)
app_1 | File "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py", line 88, in application_unproxied
app_1 | result = odoo.http.root(environ, start_response)
app_1 | File "/usr/lib/python3/dist-packages/odoo/http.py", line 1306, in call
app_1 | return self.dispatch(environ, start_response)
app_1 | File "/usr/lib/python3/dist-packages/odoo/http.py", line 1272, in call
app_1 | return self.app(environ, start_wrapped)
app_1 | File "/usr/lib/python3/dist-packages/werkzeug/middleware/shared_data.py", line 220, in call
app_1 | return self.app(environ, start_response)
app_1 | File "/usr/lib/python3/dist-packages/odoo/http.py", line 1478, in dispatch
app_1 | result = ir_http._dispatch()
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/website_sale/models/ir_http.py", line 15, in _dispatch
app_1 | return super(IrHttp, cls)._dispatch()
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/website/models/ir_http.py", line 183, in _dispatch
app_1 | response = super(Http, cls)._dispatch()
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/auth_signup/models/ir_http.py", line 19, in _dispatch
app_1 | return super(Http, cls)._dispatch()
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/web_editor/models/ir_http.py", line 21, in _dispatch
app_1 | return super(IrHttp, cls)._dispatch()
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/utm/models/ir_http.py", line 29, in _dispatch
app_1 | response = super(IrHttp, cls)._dispatch()
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/http_routing/models/ir_http.py", line 491, in _dispatch
app_1 | return cls.reroute('/'.join(path) or '/')
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/http_routing/models/ir_http.py", line 530, in reroute
app_1 | return cls._dispatch()
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/website_sale/models/ir_http.py", line 15, in _dispatch
app_1 | return super(IrHttp, cls)._dispatch()
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/website/models/ir_http.py", line 183, in _dispatch
app_1 | response = super(Http, cls)._dispatch()
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/auth_signup/models/ir_http.py", line 19, in _dispatch
app_1 | return super(Http, cls)._dispatch()
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/web_editor/models/ir_http.py", line 21, in _dispatch
app_1 | return super(IrHttp, cls)._dispatch()
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/utm/models/ir_http.py", line 29, in _dispatch
app_1 | response = super(IrHttp, cls)._dispatch()
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/http_routing/models/ir_http.py", line 508, in _dispatch
app_1 | result = super(IrHttp, cls)._dispatch()
app_1 | File "/usr/local/lib/python3.8/dist-packages/odoo_elasticapm/ir_http.py", line 77, in _dispatch
app_1 | response = ori_dispatch()
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 241, in _dispatch
app_1 | return cls._handle_exception(e)
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 209, in _handle_exception
app_1 | return request._handle_exception(exception)
app_1 | File "/usr/lib/python3/dist-packages/odoo/http.py", line 745, in _handle_exception
app_1 | return super(HttpRequest, self)._handle_exception(exception)
app_1 | File "/usr/local/lib/python3.8/dist-packages/odoo_elasticapm/http.py", line 76, in _handle_exception
app_1 | return ori_handle_exception(self, exception)
app_1 | File "/usr/lib/python3/dist-packages/odoo/http.py", line 316, in _handle_exception
app_1 | raise exception.with_traceback(None) from new_cause
app_1 | odoo.addons.base.models.qweb.QWebException: 'EndPoint' object is not iterable
app_1 | Traceback (most recent call last):
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 331, in _compiled_fn
app_1 | return compiled(self, append, new, options, log)
app_1 | File "", line 1, in template_web_frontend_layout_89
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/website/models/website.py", line 527, in _get_alternate_languages
app_1 | if not self._is_canonical_url(canonical_params=canonical_params):
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/website/models/website.py", line 1008, in _is_canonical_url
app_1 | canonical_url = self._get_canonical_url_localized(lang=request.lang, canonical_params=None)
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/website/models/website.py", line 982, in _get_canonical_url_localized
app_1 | path = router.build(request.endpoint, arguments)
app_1 | File "/usr/lib/python3/dist-packages/werkzeug/routing.py", line 2020, in build
app_1 | raise BuildError(endpoint, values, method, self)
app_1 | werkzeug.routing.BuildError:
app_1 |
app_1 | During handling of the above exception, another exception occurred:
app_1 |
app_1 | Traceback (most recent call last):
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 331, in _compiled_fn
app_1 | return compiled(self, append, new, options, log)
app_1 | File "", line 1, in template_website_homepage1_4
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 338, in _compiled_fn
app_1 | raise QWebException("Error to render compiling AST", e, path, node and etree.tostring(node[0], encoding='unicode'), name)
app_1 | File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 144, in init
app_1 | self.message = "%s\n%s: %s" % (self.message, self.error.class.name, self.error)
app_1 | File "/usr/lib/python3/dist-packages/werkzeug/routing.py", line 307, in str
app_1 | if self.suggested:
app_1 | File "/usr/lib/python3/dist-packages/werkzeug/utils.py", line 90, in get
app_1 | value = self.func(obj)
app_1 | File "/usr/lib/python3/dist-packages/werkzeug/routing.py", line 281, in suggested
app_1 | return self.closest_rule(self.adapter)
app_1 | File "/usr/lib/python3/dist-packages/werkzeug/routing.py", line 297, in closest_rule
app_1 | return max(adapter.map._rules, key=_score_rule)
app_1 | File "/usr/lib/python3/dist-packages/werkzeug/routing.py", line 288, in _score_rule
app_1 | * difflib.SequenceMatcher(
app_1 | File "/usr/lib/python3.8/difflib.py", line 213, in init
app_1 | self.set_seqs(a, b)
app_1 | File "/usr/lib/python3.8/difflib.py", line 225, in set_seqs
app_1 | self.set_seq2(b)
app_1 | File "/usr/lib/python3.8/difflib.py", line 279, in set_seq2
app_1 | self.__chain_b()
app_1 | File "/usr/lib/python3.8/difflib.py", line 311, in __chain_b
app_1 | for i, elt in enumerate(b):
app_1 | TypeError: 'EndPoint' object is not iterable
app_1 |
app_1 | Error to render compiling AST
app_1 | TypeError: 'EndPoint' object is not iterable
app_1 | Template: website.homepage1
app_1 | Path: /t/t/t
app_1 | Node: - - -
app_1 | 2022-02-14 12:05:31,800 241 INFO ? elasticapm.transport.http: Fetched APM Server version 7.8.0

Configure Odoo-elasticapm and try to open the login page or home page Odoo.
Get this error for TypeError: 'EndPoint' object is not iterable.
Without elasticapm it works Fine.

TypeError: an integer is required (got type bytes)

Using Python 3.8 and Odoo 14, I get the following error when starting Odoo with odoo-elasticapm:

app_1   | 2021-11-26 18:42:08,014 103 ERROR ? elasticapm.utils.threading: Exception in interval timer function 
app_1   | Traceback (most recent call last):
app_1   |   File "/usr/local/lib/python3.8/dist-packages/elasticapm/utils/threading.py", line 84, in run
app_1   |     rval = self._function(*self._args, **self._kwargs)
app_1   |   File "/usr/local/lib/python3.8/dist-packages/elasticapm/conf/__init__.py", line 742, in update_config
app_1   |     new_version, new_config, next_run = self.transport.get_config(self.config_version, keys)
app_1   |   File "/usr/local/lib/python3.8/dist-packages/elasticapm/transport/http.py", line 154, in get_config
app_1   |     response = self.http.urlopen(
app_1   |   File "/usr/lib/python3/dist-packages/urllib3/poolmanager.py", line 330, in urlopen
app_1   |     response = conn.urlopen(method, u.request_uri, **kw)
app_1   |   File "/usr/local/lib/python3.8/dist-packages/elasticapm/instrumentation/packages/base.py", line 205, in call_if_sampling
app_1   |     return wrapped(*args, **kwargs)
app_1   |   File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 665, in urlopen
app_1   |     httplib_response = self._make_request(
app_1   |   File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 387, in _make_request
app_1   |     conn.request(method, url, **httplib_request_kw)
app_1   |   File "/usr/lib/python3.8/http/client.py", line 1252, in request
app_1   |     self._send_request(method, url, body, headers, encode_chunked)
app_1   |   File "/usr/lib/python3.8/http/client.py", line 1298, in _send_request
app_1   |     self.endheaders(body, encode_chunked=encode_chunked)
app_1   |   File "/usr/lib/python3.8/http/client.py", line 1247, in endheaders
app_1   |     self._send_output(message_body, encode_chunked=encode_chunked)
app_1   |   File "/usr/lib/python3.8/http/client.py", line 1007, in _send_output
app_1   |     self.send(msg)
app_1   |   File "/usr/lib/python3.8/http/client.py", line 947, in send
app_1   |     self.connect()
app_1   |   File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 187, in connect
app_1   |     conn = self._new_conn()
app_1   |   File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 159, in _new_conn
app_1   |     conn = connection.create_connection(
app_1   |   File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 61, in create_connection
app_1   |     for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
app_1   |   File "/usr/lib/python3/dist-packages/gevent/_socketcommon.py", line 212, in getaddrinfo
app_1   |     addrlist = get_hub().resolver.getaddrinfo(host, port, family, type, proto, flags)
app_1   |   File "/usr/lib/python3/dist-packages/gevent/resolver/thread.py", line 65, in getaddrinfo
app_1   |     return self.pool.apply(_socket.getaddrinfo, args, kwargs)
app_1   |   File "/usr/lib/python3/dist-packages/gevent/pool.py", line 159, in apply
app_1   |     return self.spawn(func, *args, **kwds).get()
app_1   |   File "src/gevent/event.py", line 268, in gevent._event.AsyncResult.get
app_1   |   File "src/gevent/event.py", line 296, in gevent._event.AsyncResult.get
app_1   |   File "src/gevent/event.py", line 286, in gevent._event.AsyncResult.get
app_1   |   File "src/gevent/event.py", line 266, in gevent._event.AsyncResult._raise_exception
app_1   |   File "src/gevent/event.py", line 211, in gevent._event.AsyncResult.exc_info.__get__
app_1   |   File "/usr/lib/python3/dist-packages/gevent/_tblib.py", line 371, in g
app_1   |     return f(a)
app_1   |   File "/usr/lib/python3/dist-packages/gevent/_tblib.py", line 432, in load_traceback
app_1   |     return loads(s)
app_1   |   File "/usr/lib/python3/dist-packages/gevent/_tblib.py", line 337, in unpickle_traceback
app_1   |     return ret.as_traceback()
app_1   |   File "/usr/lib/python3/dist-packages/gevent/_tblib.py", line 202, in as_traceback
app_1   |     code = CodeType(
app_1   | TypeError: an integer is required (got type bytes)

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.