mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-07-27 04:03:09 +08:00
Add "instruments-any" feature: unblock multi-target instrumentations while fixing dependency conflict breakage. (#3610)
This commit is contained in:
@ -84,7 +84,7 @@ def main():
|
||||
pkg_name = pkg.get("name")
|
||||
if pkg_name in packages_to_exclude:
|
||||
continue
|
||||
if not pkg["instruments"]:
|
||||
if not pkg["instruments"] and not pkg["instruments-any"]:
|
||||
default_instrumentations.elts.append(ast.Str(pkg["requirement"]))
|
||||
for target_pkg in pkg["instruments"]:
|
||||
libraries.elts.append(
|
||||
@ -93,6 +93,14 @@ def main():
|
||||
values=[ast.Str(target_pkg), ast.Str(pkg["requirement"])],
|
||||
)
|
||||
)
|
||||
# instruments-any is an optional field that can be used instead of or in addition to _instruments. While _instruments is a list of dependencies, all of which are expected by the instrumentation, instruments-any is a list any of which but not all are expected.
|
||||
for target_pkg in pkg["instruments-any"]:
|
||||
libraries.elts.append(
|
||||
ast.Dict(
|
||||
keys=[ast.Str("library"), ast.Str("instrumentation")],
|
||||
values=[ast.Str(target_pkg), ast.Str(pkg["requirement"])],
|
||||
)
|
||||
)
|
||||
|
||||
tree = ast.parse(_source_tmpl)
|
||||
tree.body[0].value = libraries
|
||||
|
Reference in New Issue
Block a user