Skip to content

Commit 304437f

Browse files
authored
[Framework] Fix raw results are not sent when raw results are not being parsed into entities (#782)
1 parent 006d20f commit 304437f

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
77

88
<!-- towncrier release notes start -->
99

10+
## 0.9.2 (2024-07-05)
11+
12+
### Improvements
13+
14+
- Added log of the used integration mapping for each resync event
15+
- Added log when failed on processing jq mapping for raw result
16+
17+
### Bug Fixes
18+
19+
- Fixed an issue where raw results were not being sent if raw data didn't map to any entity
20+
21+
1022
## 0.9.1 (2024-06-23)
1123

1224

port_ocean/core/handlers/entity_processor/jq_entity_processor.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ async def _search(self, data: dict[str, Any], pattern: str) -> Any:
5252
compiled_pattern = self._compile(pattern)
5353
first_value_callable = functools.partial(compiled_pattern.first, data)
5454
return await loop.run_in_executor(None, first_value_callable)
55-
except Exception:
55+
except Exception as exc:
56+
logger.debug(
57+
f"Failed to search for pattern {pattern} in data {data}, {exc}"
58+
)
5659
return None
5760

5861
async def _search_as_bool(self, data: dict[str, Any], pattern: str) -> bool:
@@ -207,6 +210,15 @@ async def _parse_items(
207210
examples_to_send.append(result.raw_data)
208211
else:
209212
failed_entities.append(parsed_entity)
213+
if (
214+
not calculated_entities_results
215+
and raw_results
216+
and send_raw_data_examples_amount > 0
217+
):
218+
logger.warning(
219+
f"No entities were parsed from {len(raw_results)} raw results, sending raw data examples"
220+
)
221+
examples_to_send = raw_results[:send_raw_data_examples_amount]
210222

211223
await self._send_examples(examples_to_send, mapping.kind)
212224

port_ocean/core/integrations/mixins/sync_raw.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ async def _execute_resync_tasks(
9090
) -> tuple[RESYNC_RESULT, list[RAW_RESULT | Exception]]:
9191
tasks = []
9292
results = []
93-
9493
for task in fns:
9594
if inspect.isasyncgenfunction(task):
9695
results.append(resync_generator_wrapper(task, resource_config.kind))
@@ -415,7 +414,7 @@ async def sync_raw_all(
415414
app_config = await self.port_app_config_handler.get_port_app_config(
416415
use_cache=False
417416
)
418-
417+
logger.info(f"Resync will use the following mappings: {app_config.dict()}")
419418
try:
420419
entities_at_port = await ocean.port_client.search_entities(
421420
user_agent_type

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "port-ocean"
3-
version = "0.9.1"
3+
version = "0.9.2"
44
description = "Port Ocean is a CLI tool for managing your Port projects."
55
readme = "README.md"
66
homepage = "https://app.getport.io"

0 commit comments

Comments
 (0)