mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-07-27 04:03:09 +08:00
Add instrumentation and distro packages (#738)
Now that SDK does not depend on opentelemetry-instrumentation anymore and opentelemetry-instrumentation has actual build time dependencies on the contrib repo, it makes maintanence a lot easier if we move opentelemetry-instrumentation to contrib repo. opentelemetry-distro depends on opentelemetry-instrumentation and is being moved as well. Neither of the two packages are really part of "core" Otel python anyway.
This commit is contained in:
@ -15,17 +15,18 @@
|
||||
# limitations under the License.
|
||||
|
||||
import ast
|
||||
import filecmp
|
||||
import logging
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import astor
|
||||
import pkg_resources
|
||||
import requests
|
||||
from otel_packaging import get_instrumentation_packages, scripts_path
|
||||
from otel_packaging import (
|
||||
get_instrumentation_packages,
|
||||
root_path,
|
||||
scripts_path,
|
||||
)
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger("instrumentation_list_generator")
|
||||
@ -49,16 +50,14 @@ libraries = {}
|
||||
default_instrumentations = []
|
||||
"""
|
||||
|
||||
tmpdir = tempfile.TemporaryDirectory() # pylint: disable=R1732
|
||||
gen_path = os.path.join(tmpdir.name, "new.py",)
|
||||
|
||||
current_path = os.path.join(tmpdir.name, "current.py",)
|
||||
|
||||
core_repo = os.getenv("CORE_REPO_SHA", "main")
|
||||
url = f"https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/{core_repo}/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py"
|
||||
r = requests.get(url, allow_redirects=True)
|
||||
with open(current_path, "wb") as output:
|
||||
output.write(r.content)
|
||||
gen_path = os.path.join(
|
||||
root_path,
|
||||
"opentelemetry-instrumentation",
|
||||
"src",
|
||||
"opentelemetry",
|
||||
"instrumentation",
|
||||
"bootstrap_gen.py",
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
@ -98,7 +97,7 @@ def main():
|
||||
"scripts/eachdist.py",
|
||||
"format",
|
||||
"--path",
|
||||
tmpdir.name,
|
||||
"opentelemetry-instrumentation/src",
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
@ -106,15 +105,5 @@ def main():
|
||||
logger.info("generated %s", gen_path)
|
||||
|
||||
|
||||
def compare():
|
||||
if not filecmp.cmp(current_path, gen_path):
|
||||
logger.info(
|
||||
'Generated code is out of date, please run "tox -e generate" and commit bootstrap_gen.py to core repo.'
|
||||
)
|
||||
os.replace(gen_path, "bootstrap_gen.py")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
compare()
|
||||
|
Reference in New Issue
Block a user