Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ele 3008 project name #1506

Merged
merged 7 commits into from
May 27, 2024
2 changes: 2 additions & 0 deletions elementary/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,15 @@ def __init__(
teams_webhook: Optional[str] = None,
env: str = "dev",
run_dbt_deps_if_needed: Optional[bool] = None,
project_name: Optional[str] = None,
):
self.config_dir = config_dir
self.profiles_dir = profiles_dir
self.project_dir = project_dir
self.profile_target = profile_target
self.project_profile_target = project_profile_target
self.env = env
self.project_name = project_name

# Additional env vars supplied to dbt invocations
self.env_vars = dict()
Expand Down
1 change: 1 addition & 0 deletions elementary/monitor/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,7 @@ def send_report(
gcs_timeout_limit=gcs_timeout_limit,
report_url=report_url,
env=env,
project_name=project_name,
)
anonymous_tracking = AnonymousCommandLineTracking(config)
anonymous_tracking.set_env("use_select", bool(select))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ def send_test_results_summary(
include_description=include_description,
filter=self.selector_filter.to_selector_filter_schema(),
days_back=days_back,
env=self.config.env,
project_name=self.config.project_name,
),
)
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ def get_slack_message(
self,
test_results: List[TestResultSummarySchema],
days_back: int,
env: str,
bucket_website_url: Optional[str] = None,
filter: SelectorFilterSchema = SelectorFilterSchema(),
include_description: bool = False,
project_name: Optional[str] = None,
) -> SlackMessageSchema:
self.add_title_to_slack_alert()
self.add_title_to_slack_alert(env, project_name)
self.add_preview_to_slack_alert(
test_results,
days_back=days_back,
Expand All @@ -34,9 +36,10 @@ def get_slack_message(
)
return super().get_slack_message()

def add_title_to_slack_alert(self):
def add_title_to_slack_alert(self, env: str, project_name: Optional[str] = None):
context = f"- {project_name} ({env})" if project_name else f"({env})"
title_blocks = [
self.create_header_block(":mag: Monitoring summary"),
self.create_header_block(f":mag: Monitoring summary {context}"),
self.create_divider_block(),
]
self._add_always_displayed_blocks(title_blocks)
Expand Down