Skip to content

Commit

Permalink
add pdf template instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-mchok committed Sep 19, 2024
1 parent 4470cd6 commit b6101ab
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/snowflake/cli/api/utils/definition_rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@

from jinja2 import Environment, TemplateSyntaxError, nodes
from packaging.version import Version
from snowflake.cli.api.cli_global_context import get_cli_context
from snowflake.cli.api.console import cli_console as cc
from snowflake.cli.api.exceptions import CycleDetectedError, InvalidTemplate
from snowflake.cli.api.metrics import CLICounterField
from snowflake.cli.api.project.schemas.project_definition import (
ProjectProperties,
build_project_definition,
Expand Down Expand Up @@ -340,6 +342,13 @@ def render_definition_template(
project_context[CONTEXT_KEY]["env"] = environment_overrides
return ProjectProperties(project_definition, project_context)

has_user_referenced_vars = (
len(_get_referenced_vars_in_definition(template_env, definition)) > 0
)
get_cli_context().metrics.set_counter(
CLICounterField.PDF_TEMPLATES, int(has_user_referenced_vars)
)

definition = _add_defaults_to_definition(definition)
project_context = {CONTEXT_KEY: definition}

Expand Down

0 comments on commit b6101ab

Please sign in to comment.