Add "instruments-any" feature: unblock multi-target instrumentations while fixing dependency conflict breakage. (#3610)

This commit is contained in:
Jeremy Voss
2025-07-21 09:24:50 -07:00
committed by GitHub
parent f20fa77ad5
commit 77f3171bd4
20 changed files with 574 additions and 90 deletions

View File

@ -58,11 +58,16 @@ def main(base_instrumentation_path):
with open(version_filename, encoding="utf-8") as fh:
exec(fh.read(), pkg_info)
instruments = pkg_info["_instruments"]
instruments_and = pkg_info.get("_instruments", ())
# _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.
instruments_any = pkg_info.get("_instruments_any", ())
supports_metrics = pkg_info.get("_supports_metrics")
semconv_status = pkg_info.get("_semconv_status")
if not instruments:
instruments = (name,)
instruments_all = ()
if not instruments_and and not instruments_any:
instruments_all = (name,)
else:
instruments_all = tuple(instruments_and + instruments_any)
if not semconv_status:
semconv_status = "development"
@ -70,7 +75,7 @@ def main(base_instrumentation_path):
metric_column = "Yes" if supports_metrics else "No"
table.append(
f"| [{instrumentation}](./{instrumentation}) | {','.join(instruments)} | {metric_column} | {semconv_status}"
f"| [{instrumentation}](./{instrumentation}) | {','.join(instruments_all)} | {metric_column} | {semconv_status}"
)
with open(