Skip to content

Commit

Permalink
allowing multiple only flags to generate multiple conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
lmolkova committed Mar 10, 2023
1 parent 94f4ec9 commit 43e722b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions semantic-conventions/src/opentelemetry/semconv/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ def exclude_file_list(folder: str, pattern: str) -> List[str]:
return file_names


def filter_semconv(semconv, type_filter):
if type_filter:
def filter_semconv(semconv, types_filter):
if types_filter:
semconv.models = {
id: model
for id, model in semconv.models.items()
if model.GROUP_TYPE_NAME == type_filter
if model.GROUP_TYPE_NAME in types_filter
}


Expand All @@ -65,6 +65,7 @@ def main():
args = parser.parse_args()
check_args(args, parser)
semconv = parse_semconv(args, parser)

filter_semconv(semconv, args.only)
if len(semconv.models) == 0:
parser.error("No semantic convention model found!")
Expand Down Expand Up @@ -211,7 +212,9 @@ def setup_parser():
parser.add_argument(
"--only",
choices=list(CONVENTION_CLS_BY_GROUP_TYPE.keys()),
help="Process only semantic conventions of the specified type.",
type=str,
nargs="+",
help="Process only semantic conventions of the specified types.",
)
parser.add_argument(
"--yaml-root",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class MetricGroupSemanticConvention(BaseSemanticConvention):
GROUP_TYPE_NAME = "metric_group"


class MetricSemanticConvention(MetricGroupSemanticConvention):
class gitMetricSemanticConvention(MetricGroupSemanticConvention):
GROUP_TYPE_NAME = "metric"

allowed_keys: Tuple[str, ...] = BaseSemanticConvention.allowed_keys + (
Expand Down

0 comments on commit 43e722b

Please sign in to comment.