The initializator is a singleton, we should release driver after each
setUp.
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@industrialdiscipline.com>
Change-Id: If6728f792609d1dc59d86954a767afe802c435e3
This patch fixes the index and module index for the osprofiler documentation
home page.
It also updates the documents tox environments to use a docs requirements.txt
Change-Id: I880f1c28232a299f50ea9ccc2178f1444efb9a41
Introduced changes:
- pre-commit config and rules
- Add pre-commit to pep8 gate, Flake8 is covered in the pre-commit hooks.
- Applying fixes for pre-commit compliance in all code.
Also commit hash will be used instead of version tags in pre-commit to
prevend arbitrary code from running in developer's machines.
pre-commit will be used to:
- trailing whitespace;
- Replaces or checks mixed line ending (mixed-line-ending);
- Forbid files which have a UTF-8 byte-order marker (check-byte-order-marker);
- Checks that non-binary executables have a proper
shebang (check-executables-have-shebangs);
- Check for files that contain merge conflict strings (check-merge-conflict);
- Check for debugger imports and py37+ breakpoint()
calls in python source (debug-statements);
- Attempts to load all yaml files to verify syntax (check-yaml);
- Run flake8 checks (flake8) (local)
For further details about tests please refer to:
https://github.com/pre-commit/pre-commit-hooks
Change-Id: If4bd505d6bf73d06ce2f6080cedb3b5576c881d9
Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
As per victoria cycle testing runtime and community goal,
we need to migrate upstream CI/CD to Ubuntu Focal(20.04).
StopIteration error happening in pep8 job when running on Focal.
we can see the failure in https://review.opendev.org/#/c/744331/
Change-Id: Iecdd3bfddb95adec77f8581f844cfc74ca59fc73
Story: #2007865
Task: #402207
Importing pkg_resources has a side-effect of reading all of the
metadata for every installed python package. The newer
importlib.metadata module can load the metadata for one package at a
time, which makes this library load more quickly and improves the
startup-time performance of applications that use it such as
python-openstackclient.
importlib.metadata is part of the python 3.8 standard library and is
distributed separately for other versions of python.
Change-Id: Ib1870a3d102116f84c7677601fd44fdac41a13a6
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
When 'hide_args=True' is used in @profiler.trace() decorator
along with Jaeger driver, trace 'args' and 'kwargs' function
parameters are empty, which leads to a key error.
This change introduces a key check before adding those parameters to
tags.
Change-Id: I312da1b175a04d4ddee7f823111b8320dd4777d6
With an updated flake8, we get some new warnings. Update hacking
directly to version 3.1.0 and fix the problems found.
Note that before this change, flake8 used the default "ignore" list,
this now adds a new ignore list.
Change-Id: Iccbf4f30eb4e542d3824b7782f43eacda29c5a90
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.
Change-Id: I76e01d55ff4d9095a6dbf520752042824225de73
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.
Fix problems found.
Update local hacking checks for new flake8.
Change-Id: I8ba89483c8e6b76011833cfc5080eab3fd269c8b
This patch fixes the issue when failed osprofiler driver brings
the whole service down. With this patch the default no-op behaviour
is used in case of initialization failure.
Change-Id: I6ebc393576f4fc3f8b4134164bafc2e09f102ebd
The --connection-string is marked required, and parse_args()
assumes the flag invalid if it's not supplied as command line
argument, even if env OSPROFILER_CONNECTION_STRING is setted.
We should not rely on the required=True of argparse module,
but check the required args on our own to take env arguments
into consideration.
Change-Id: I50f5f369ec41ddc82f9b66f5910b7805940fb387
This patch adds a new type of collector "sqlalchemy".
To enable it, add the following line into DevStack local.conf:
OSPROFILER_COLLECTOR=sqlalchemy
OSProfiler DevStack plugin creates database for traces and
configures all services to use it.
SQLAlchemy driver is extend to be able to list traces.
Zuul job is added to run Tempest tests with sqlalchemy driver enabled.
Change-Id: Ia943d311d78f6dfd2e6bb884c8dca725b3b2a36b
osprofiler fails when it is configed with mongon.
the minimum version of pymongo osprofile requires is 3.0.2
and in this version and after when function list_traces is
is invoked error will show described in the bug issue.
Change-Id: I2510660c36aaa89117a97c67b4cb61fa3dade14d
Closes-Bug: 1827480
The original Redis driver stored each tracing event under its own key,
as result both list and get operations required a full scan of the database.
With this patch traces are stored as Redis lists under a key equal
to trace id. So list operation iterates only over unique trace ids
and get operation retrieves the content of a specified list. Note that
list operation still needs to retrieve at least 1 event from the trace
in order to get a timestamp.
Performance test is executed with 1000 traces each consisting 1000 events:
* existing driver:
* write: 48 sec
* list: 41 sec
* get: 3.6 sec
* optimized driver:
* write: 44 sec
* list: 4.1 sec
* get: 0.01 sec
Change-Id: I09a122f91e3d26531965fe53d6df7c66f502de4c
Given that the driver is initialized during the service
startup (eg. like Keystone, Nova, ...) a osprofiler driver failure has
a huge impact on the service (when the driver fails, the whole service
is not usable).
We want to avoid that and just log error/exceptions but keep the
services running.
Change-Id: I5688f10364884a74b7eb44c0c8bda15730ccd424
Closes-Bug: 1819433
Beside the already available collectors, add a sqlalchemy based
collector. This is useful if you don't want to maintain another DB
solution and just use the (usually) already available database.
The driver currently implements the notify() and get_report() methods
so it is possible to store trace points and to get a single trace.
Change-Id: If91b35d4b97862c0ecf6677f4c6b95a09d411195
The Jaeger driver counts on this message to be in the error description.
It fails if the message is not present
Closes-Bug: 1804218
Change-Id: I08f8328700049d9a0d791b12375fe9a6e8a3948a
If you're given an int, there's nothing to do, just return it
Change-Id: I289dab8cfabaecf243fdc16b972695e83c83c3e4
Closes-Bug: 1795664
Signed-off-by: Shoham Peller <shohamp@gmail.com>
Horizon dashboard has a profiler plugin which calls profiler.init
method at
openstack_dashboard/contrib/developer/profiler/middleware.py
line 64. This creates a profiler and picks a new base_id. The only
way to remove this profiler and stop using this base_id is to call
profiler._clean() method. So this patch changes _clean() to clean()
so it becomes a public method.
Change-Id: Idec7ee240bc7f508aeebcba374a9673652b1cc72
Related-Bug: #1777486
Resolve the following warnings issue when the opts are included in
documentation with 'oslo_config.sphinxext'.
WARNING: Bullet list ends without a blank line; unexpected unindent.
Some other minor issues are addressed in the process.
Change-Id: I6cb2da083b1051c9aa39f72352cbc0c35e5592bb
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
The parameter should have been deprecated before its removal to give
callers a chance to adjust their calls to the new argument list.
This patchset follows Ben Nemec's comment in commit
https://review.openstack.org/#/c/569078/
Change-Id: I606796a33f6304276fe78b9868239a0ee5b9f46a
Support full schema for connection to Redis: make port number
optional, allow password and database number. The schema is following:
`redis://[:password]@host[:port][/db]`
Change-Id: I0f8be615aa95409653211b24e114d8b0870b2afa
Closes-Bug: #1768742
1. Remove `filter` parameter from `list_traces` function, since
filtering is heavily depends on a backend and cannot be (easily)
made uniform.
2. Unify the output of `list_traces` - the function returns a list
of `traces`, where each trace is a dictionary with at least `base_id`
and `timestamp` fields.
3. Fix `list_traces` in Redis driver, so it returns only traces, instead
of events.
4. Add functional test for `list_traces` in Redis driver.
Change-Id: Ia81540288fe98fd9b8e256c62cc372fa33fcbea3
This is an initial trace list command, which acts both as a
starting-point, as well as an immediate solution for anyone
who needs the basic functionality of this feature.
Change-Id: I99ad62103914b047cfc3c33e50ae98b6a0d01d6d
Related-Bug: #1733232
Our current Ceilometer driver relies on old version of ceilometer client,
which is in deprecated state and not compatible with the latest Telemetry
projects (Panko, Gnocchi). The functionality of the driver is not tested
automatically and most probably broken. So it's time to let it go and
clean the code.
This patch leaves "messaging" driver as default for notification and
makes "connection-string" a required parameter in CLI. In the future
we may consider to change default notification driver, though it
requires proper release note handling in all affected projects.
Change-Id: Id8442c4ff13c5cc33fd909b4757757cc5f396f50
Add a small check for this to an prevent issue in Nova [1]
that causes some commands not working.
[1] http://paste.openstack.org/show/641262/
Change-Id: I685386695e13bf5034a1008dbdcff4539eb482d2
Closes-Bug: #1743586
Add kwargs to this __init__ method is a way
to avoid some extra keyword arguments in local_conf [1].
@classmethod
def factory(cls, global_conf, **local_conf):
def filter_(app):
return cls(app, **local_conf)
return filter_
These extra keyword arguments
can cause this exception (in case of ceilometer):
`__init__() got an unexpected keyword argument`
[1] https://git.openstack.org/cgit/openstack/osprofiler/tree/osprofiler/web.py#n91
Change-Id: I82e0db75ef9f84075289e360428c09ec68fb72d9