Skip to content

Commit

Permalink
chore(lib-injection): change the print statements in sitecustomize.py…
Browse files Browse the repository at this point in the history
… to print to stderr (#6243)

Addresses issue that occurs when using ansible to install automatic host
instrumentation.
https://dd.slack.com/archives/C04V0MJL6MA/p1688050478969999

Testing strategy:
- Will run through the ansible build process again, see if the errors go
away

Risks:
None (these are debug statements that should have been written to stderr
from the beginning)

Maintenance:
None 

Documentation: 
None


## Checklist

- [X] Change(s) are motivated and described in the PR description.
- [X] Testing strategy is described if automated tests are not included
in the PR.
- [X] Risk is outlined (performance impact, potential for breakage,
maintainability, etc).
- [X] Change is maintainable (easy to change, telemetry, documentation).
- [X] [Library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
are followed. If no release note is required, add label
`changelog/no-changelog`.
- [X] Documentation is included (in-code, generated user docs, [public
corp docs](https://github.com/DataDog/documentation/)).
- [X] Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))

## Reviewer Checklist

- [x] Title is accurate.
- [x] No unnecessary changes are introduced.
- [x] Description motivates each change.
- [x] Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes unless absolutely necessary.
- [x] Testing strategy adequately addresses listed risk(s).
- [x] Change is maintainable (easy to change, telemetry, documentation).
- [x] Release note makes sense to a user of the library.
- [x] Reviewer has explicitly acknowledged and discussed the performance
implications of this PR as reported in the benchmarks PR comment.
- [x] Backport labels are set in a manner that is consistent with the
[release branch maintenance
policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
  • Loading branch information
jonbodner authored Jun 29, 2023
1 parent fded2a1 commit a346cdd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib-injection/sitecustomize.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def _configure_ddtrace():

# Also insert the bootstrap dir in the path of the current python process.
sys.path.insert(0, bootstrap_dir)
print("datadog autoinstrumentation: successfully configured python package")
print("datadog autoinstrumentation: successfully configured python package", file=sys.stderr)


# Avoid infinite loop when attempting to install ddtrace. This flag is set when
Expand All @@ -28,7 +28,7 @@ def _configure_ddtrace():
except ImportError:
import subprocess

print("datadog autoinstrumentation: installing python package")
print("datadog autoinstrumentation: installing python package", file=sys.stderr)

# Set the flag to avoid an infinite loop.
env = os.environ.copy()
Expand All @@ -43,10 +43,10 @@ def _configure_ddtrace():
check=True,
)
except BaseException as e:
print("datadog autoinstrumentation: failed to install python package %s" % str(e))
print("datadog autoinstrumentation: failed to install python package %s" % str(e), file=sys.stderr)
else:
print("datadog autoinstrumentation: successfully installed python package")
print("datadog autoinstrumentation: successfully installed python package", file=sys.stderr)
_configure_ddtrace()
else:
print("datadog autoinstrumentation: ddtrace already installed, skipping install")
print("datadog autoinstrumentation: ddtrace already installed, skipping install", file=sys.stderr)
_configure_ddtrace()

0 comments on commit a346cdd

Please sign in to comment.