Skip to content

Commit

Permalink
feat: BI-5472 is_embedded flag for reporting (#552)
Browse files Browse the repository at this point in the history
  • Loading branch information
ForrestGump authored Jul 25, 2024
1 parent 00cbefe commit 3aef8d9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/dl_api_commons/dl_api_commons/base_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,18 @@ def forwarder_for(self) -> Optional[str]:
def workbook_id(self) -> Optional[str]:
return self.plain_headers.get(DLHeadersCommon.WORKBOOK_ID.value)

@property
def is_embedded(self) -> bool:
if self.user_id is None:
return False
return "EMBEDDED" in self.user_id

@property
def is_public(self) -> bool:
if self.user_id is None:
return False
return "PUBLIC" in self.user_id

@property
def client_ip(self) -> Optional[str]:
if self.forwarder_for is not None:
Expand Down
1 change: 1 addition & 0 deletions lib/dl_api_commons/dl_api_commons/reporting/profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def flush_query_report(self, query_id: str) -> None:
query_type=(start_record.query_type.name if start_record.query_type is not None else None),
# TODO FIX: Use value from RCI when become done
is_public=int(self._is_public_env),
is_embedded=int(self.rci.is_embedded),
dash_id=x_dl_context.get(DLContextKey.DASH_ID),
dash_tab_id=x_dl_context.get(DLContextKey.DASH_TAB_ID),
chart_id=x_dl_context.get(DLContextKey.CHART_ID),
Expand Down

0 comments on commit 3aef8d9

Please sign in to comment.