File tree Expand file tree Collapse file tree 3 files changed +25
-8
lines changed
Expand file tree Collapse file tree 3 files changed +25
-8
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ def main():
8484 pkg_name = pkg .get ("name" )
8585 if pkg_name in packages_to_exclude :
8686 continue
87- if not pkg ["instruments" ]:
87+ if not pkg ["instruments" ] and not pkg [ "instruments_either" ] :
8888 default_instrumentations .elts .append (ast .Str (pkg ["requirement" ]))
8989 for target_pkg in pkg ["instruments" ]:
9090 libraries .elts .append (
@@ -93,6 +93,13 @@ def main():
9393 values = [ast .Str (target_pkg ), ast .Str (pkg ["requirement" ])],
9494 )
9595 )
96+ for target_pkg in pkg ["instruments_either" ]:
97+ libraries .elts .append (
98+ ast .Dict (
99+ keys = [ast .Str ("library" ), ast .Str ("instrumentation" )],
100+ values = [ast .Str (target_pkg ), ast .Str (pkg ["requirement" ])],
101+ )
102+ )
96103
97104 tree = ast .parse (_source_tmpl )
98105 tree .body [0 ].value = libraries
Original file line number Diff line number Diff line change @@ -58,19 +58,23 @@ def main(base_instrumentation_path):
5858 with open (version_filename , encoding = "utf-8" ) as fh :
5959 exec (fh .read (), pkg_info )
6060
61- instruments = pkg_info ["_instruments" ]
61+ instruments_and = pkg_info .get ("_instruments" , ())
62+ instruments_either = pkg_info .get ("_instruments_either" , ())
6263 supports_metrics = pkg_info .get ("_supports_metrics" )
6364 semconv_status = pkg_info .get ("_semconv_status" )
64- if not instruments :
65- instruments = (name ,)
65+ instruments_all = ()
66+ if not instruments_and and not instruments_either :
67+ instruments_all = (name ,)
68+ else :
69+ instruments_all = tuple (instruments_and + instruments_either )
6670
6771 if not semconv_status :
6872 semconv_status = "development"
6973
7074 metric_column = "Yes" if supports_metrics else "No"
7175
7276 table .append (
73- f"| [{ instrumentation } ](./{ instrumentation } ) | { ',' .join (instruments )} | { metric_column } | { semconv_status } "
77+ f"| [{ instrumentation } ](./{ instrumentation } ) | { ',' .join (instruments_all )} | { metric_column } | { semconv_status } "
7478 )
7579
7680 with open (
Original file line number Diff line number Diff line change @@ -60,12 +60,18 @@ def get_instrumentation_packages(
6060 with open (pyproject_toml_path , "rb" ) as file :
6161 pyproject_toml = tomli .load (file )
6262
63+ optional_dependencies = pyproject_toml ["project" ][
64+ "optional-dependencies"
65+ ]
66+ instruments = optional_dependencies .get ("instruments" , [])
67+ instruments_either = optional_dependencies .get (
68+ "instruments_either" , []
69+ )
6370 instrumentation = {
6471 "name" : pyproject_toml ["project" ]["name" ],
6572 "version" : version .strip (),
66- "instruments" : pyproject_toml ["project" ]["optional-dependencies" ][
67- "instruments"
68- ],
73+ "instruments" : instruments ,
74+ "instruments_either" : instruments_either ,
6975 }
7076 if instrumentation ["name" ] in independent_packages :
7177 specifier = independent_packages [instrumentation ["name" ]]
You can’t perform that action at this time.
0 commit comments