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

fix(ingest/qlik): improve logging for debug #10659

Merged
merged 1 commit into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ class Constant:
# Personal entity constants
PERSONAL_SPACE_ID = "personal-space-id"
PERSONAL_SPACE_NAME = "personal_space"
# Hypercube
HYPERCUBE = "qHyperCube"


@dataclass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ class Chart(BaseModel):
@root_validator(pre=True)
def update_values(cls, values: Dict) -> Dict:
values[Constant.QID] = values[Constant.QINFO][Constant.QID]
values["qDimension"] = values["qHyperCube"]["qDimensionInfo"]
values["qMeasure"] = values["qHyperCube"]["qMeasureInfo"]
values["qDimension"] = values[Constant.HYPERCUBE]["qDimensionInfo"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use Constans instead of raw strings like what you did with HYPERCUBE?
I would prefer to be consistent in the code.

values["qMeasure"] = values[Constant.HYPERCUBE]["qMeasureInfo"]
return values


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,13 @@ def _get_chart(
method="GetChild", params={"qId": chart_id}
)
response = websocket_connection.websocket_send_request(method="GetLayout")
return Chart.parse_obj(response[Constant.QLAYOUT])
q_layout = response[Constant.QLAYOUT]
if Constant.HYPERCUBE not in q_layout:
logger.warning(
f"Chart with id {chart_id} of sheet {sheet_id} does not have hypercube. q_layout: {q_layout}"
)
return None
return Chart.parse_obj(q_layout)
except Exception as e:
self._log_http_error(
message=f"Unable to fetch chart {chart_id} of sheet {sheet_id}. Exception: {e}"
Expand All @@ -135,6 +141,11 @@ def _get_sheet(
# That means sheet is private sheet
return None
sheet = Sheet.parse_obj(sheet_dict[Constant.QMETA])
if Constant.QCHILDLIST not in sheet_dict:
logger.warning(
f"Sheet {sheet.title} with id {sheet_id} does not have any charts. sheet_dict: {sheet_dict}"
)
return sheet
for i, chart_dict in enumerate(
sheet_dict[Constant.QCHILDLIST][Constant.QITEMS]
):
Expand Down
Loading