Skip to content

Commit f23f37f

Browse files
committed
Merge branch 'master' into transaction-outcome
2 parents 37ea77d + ce48693 commit f23f37f

File tree

7 files changed

+62
-8
lines changed

7 files changed

+62
-8
lines changed

.ci/.jenkins_framework.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ FRAMEWORK:
2828
- elasticsearch-7
2929
- cassandra-newest
3030
- psutil-newest
31-
- eventlet-newest
31+
#- eventlet-newest
3232
- gevent-newest
3333
- zerorpc-0.4
3434
- mysql_connector-newest

.ci/.jenkins_framework_full.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ FRAMEWORK:
5454
- psutil-newest
5555
- psutil-5.0
5656
- psutil-4.0
57-
- eventlet-newest
57+
#- eventlet-newest
5858
- elasticsearch-2
5959
- elasticsearch-5
6060
- elasticsearch-6

CONTRIBUTING.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@ Once your changes are ready to submit for review:
3636
1. Code style
3737

3838
This project uses several tools to maintain a consistent code style:
39-
39+
4040
* the automatic code formatter [black](https://black.readthedocs.io/en/stable/)
4141
* sorting of imports via [isort](https://isort.readthedocs.io/en/latest/)
4242
* [flake8](http://flake8.pycqa.org/en/latest/)
4343
* License header check via custom script
44-
44+
4545
The easiest way to make sure your pull request adheres to the the code style
4646
is to install [pre-commit](https://pre-commit.com/).
47-
47+
4848
pip install pre-commit # or "brew install pre-commit" if you use Homebrew
49-
49+
5050
pre-commit install
5151

5252
1. Test your changes
@@ -87,6 +87,23 @@ you need to install several databases (Elasticsearch, PostgreSQL, MySQL, Cassand
8787
This can be quite a hassle, so we recommend to use our dockerized test setup.
8888
See [Running tests](https://www.elastic.co/guide/en/apm/agent/python/master/run-tests-locally.html) for detailed instructions.
8989

90+
However, for running local unit tests, you can install the relevant
91+
[requirements files](https://github.com/elastic/apm-agent-python/tree/master/tests/requirements)
92+
and then run `py.test` from the project root.
93+
94+
Pytest will automatically discover all the tests and skip the ones for which
95+
dependencies are not met.
96+
97+
#### Pytest
98+
99+
This project uses [pytest](https://docs.pytest.org/en/latest/) for all of its
100+
testing needs. Note that pytest can be a bit confusing at first, due to its
101+
dynamic discovery features. In particular,
102+
[fixtures](https://docs.pytest.org/en/stable/fixture.html) can be confusing
103+
and hard to discover, due to the fact that they do not need to be imported to
104+
be used. For example, whenever a test has `elasticapm_client` as an argument,
105+
that is a fixture which is defined
106+
[here](https://github.com/elastic/apm-agent-python/blob/ed4ce5fd5db3cc091a54d3328384fbce62635bbb/tests/fixtures.py#L150).
90107

91108
### Workflow
92109

README.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,14 @@ WSGI-compatible web applications via `custom integrations`_.
2323
Your application doesn't live on the web? No problem! Elastic APM is easy to use in
2424
any Python application.
2525

26-
Read the documentation_.
26+
Read the documentation_, including instructions on `running the tests locally`_.
27+
28+
If you're interested in contributing, `start here!`_
2729

2830
.. _documentation: https://www.elastic.co/guide/en/apm/agent/python/current/index.html
2931
.. _`custom integrations`: https://www.elastic.co/blog/creating-custom-framework-integrations-with-the-elastic-apm-python-agent
32+
.. _`running the tests locally`: https://www.elastic.co/guide/en/apm/agent/python/current/run-tests-locally.html
33+
.. _`start here!`: https://github.com/elastic/apm-agent-python/blob/master/CONTRIBUTING.md
3034

3135
License
3236
-------

docs/logging.asciidoc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@ as well as http://www.structlog.org/en/stable/[`structlog`].
99
* <<logging-integrations>>
1010
* <<log-correlation-in-es>>
1111

12+
[float]
13+
[[ecs-logging]]
14+
=== `ecs-logging`
15+
16+
The easiest way to integrate your logs with APM is to use the
17+
https://github.com/elastic/ecs-logging-python[`ecs-logging`] library, which
18+
is also provided by Elastic. This library provides formatters for both `logging`
19+
and `structlog` which create ECS-compatible logs and will include the tracing
20+
information required for log correlation in kibana. Coupled with something like
21+
https://www.elastic.co/beats/filebeat[Filebeat], it is the easiest way to get
22+
logs into Elasticsearch.
23+
24+
1225
[float]
1326
[[logging-integrations]]
1427
=== Logging integrations

docs/run-tests-locally.asciidoc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ $ ./tests/scripts/docker/run_tests.sh python-version framework-version <pip-cach
5858
NOTE: The `python-version` must be of format `python-version`, e.g. `python-3.6` or `pypy-2`.
5959
The `framework` must be of format `framework-version`, e.g. `django-1.10` or `flask-0.12`.
6060

61+
You can also run the unit tests outside of docker, by installing the relevant
62+
https://github.com/elastic/apm-agent-python/tree/master/tests/requirements[requirements file]
63+
and then running `py.test` from the project root.
64+
6165
==== Integration testing
6266

6367
Check out https://github.com/elastic/apm-integration-testing for resources for
@@ -68,5 +72,5 @@ checkout, you might do something like this:
6872

6973
[source,bash]
7074
----
71-
$ ./scripts/compose.py start 7.3 --with-agent-python-django --with-opbeans-python --opbeans-python-agent-local-repo=~/elastic/apm-agent-python
75+
$ ./scripts/compose.py start 7.3 --with-agent-python-django --with-opbeans-python --opbeans-python-agent-local-repo=~/elastic/apm-agent-python
7276
----

docs/troubleshooting.asciidoc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ python agent.
77
* <<easy-fixes>>
88
* <<django-test>>
99
* <<agent-logging>>
10+
* <<disable-agent>>
1011

1112
[float]
1213
[[easy-fixes]]
@@ -154,3 +155,18 @@ logger.addHandler(console_handler)
154155
See the https://docs.python.org/3/library/logging.html[python logging docs]
155156
for more details about Handlers (and information on how to format your logs
156157
using Formatters).
158+
159+
[float]
160+
[[disable-agent]]
161+
=== Disable the Agent
162+
163+
In the unlikely event the agent causes disruptions to a production application,
164+
you can disable the agent while you troubleshoot.
165+
166+
If you have access to <<dynamic-configuration,dynamic configuration>>,
167+
you can disable the recording of events by setting <<config-recording,`recording`>> to `false`.
168+
When changed at runtime from a supported source, there's no need to restart your application.
169+
170+
If that doesn't work, or you don't have access to dynamic configuration, you can disable the agent by setting
171+
<<config-enabled,`enabled`>> to `false`.
172+
You'll need to restart your application for the changes to take effect.

0 commit comments

Comments
 (0)