-
Notifications
You must be signed in to change notification settings - Fork 663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add instrumentation example to logging #3314
base: main
Are you sure you want to change the base?
Conversation
|
||
LoggingInstrumentor().instrument() | ||
|
||
logging.warning('OTel test') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be useful to add an example of the output after the code block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uhm I think we need an export OTEL_PYTHON_LOG_CORRELATION=true
to have the instrumentation do something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In #2904 there are some sentences regarding this I think we can reuse here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks both for pointing that out. I had missed that. @emdneto I borrowed some sentences from the documentation to improve the examples. :)
logging.warning('OTel test') | ||
|
||
When running the above example you will see the following output: | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this syntax works for rst
|
||
.. code-block:: python | ||
|
||
# export OTEL_PYTHON_LOG_CORRELATION=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# export OTEL_PYTHON_LOG_CORRELATION=true |
Description
There's no instrumentation examples inside
logging
. This PR adds one example.Type of change
Please delete options that are not relevant.
How Has This Been Tested?
git clone https://github.com/open-telemetry/opentelemetry-python-contrib
git clone https://github.com/open-telemetry/opentelemetry-python
cd opentelemetry-python-contrib
python3 -m venv otelvenv
source otelvenv/bin/activate
logging
specific requirements:__init__.py
file into different Python files and try to run them.Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.