Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Commit

Permalink
addressed pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
PietroPasotti committed Aug 16, 2024
1 parent 8334fe4 commit 0ac2125
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion lib/charms/tempo_k8s/v1/charm_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,11 @@ def _get_tracer() -> Optional[Tracer]:
if context_tracer := _get_tracer_from_context(ctx):
logger.warning(
"Tracer not found in `tracer` context var. "
"Verify that you're importing all `charm_tracing` symbols from the same module path."
"Verify that you're importing all `charm_tracing` symbols from the same module path. \n"
"For example, DO: `from charms.lib...charm_tracing import foo, bar`. \n"
"DONT: \n"
" \t - `from charms.lib...charm_tracing import foo` \n"
" \t - `from lib...charm_tracing import bar` \n"
"For more info: https://python-notes.curiousefficiency.org/en/latest/python"
"_concepts/import_traps.html#the-double-import-trap"
)
Expand Down
4 changes: 2 additions & 2 deletions tests/scenario/test_a_charm_tracer_multi_import_warning.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# WARNING keep this test module on top of the scenario tests, else the
# WARNING ensure that this test module runs before any other scenario test file, else the
# imports from previous tests will pollute the sys.modules and cause this test to fail.
# I know this is horrible but yea, couldn't find a better way to fix the issue. Tried:
# - delete from sys.modules all modules containing 'charms.tempo_k8s'
Expand All @@ -8,7 +8,7 @@
from unittest.mock import patch

# this test file is intentionally quite broken, don't modify the imports
# import autoinstrument and get_current_span from charms.[...]
# import autoinstrument from charms.[...]
from charms.tempo_k8s.v1.charm_tracing import _autoinstrument as autoinstrument
from ops import CharmBase
from scenario import Context, State
Expand Down

0 comments on commit 0ac2125

Please sign in to comment.