Skip to content

Commit

Permalink
[Core] Adjust jq mapping log - terminology and counter (#1291)
Browse files Browse the repository at this point in the history
# Description

What -
- Adjusted log teminology
- Faild transformations counter increments for all cases (None (null /
missing), empty)
Why -
the terminology of the log was not clear enough

## Type of change

Please leave one option from the following and delete the rest:

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] New Integration (non-breaking change which adds a new integration)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Non-breaking change (fix of existing functionality that will not
change current behavior)
- [ ] Documentation (added/updated documentation)

---------

Co-authored-by: Arik Gortsunian <[email protected]>
Co-authored-by: Matan <[email protected]>
  • Loading branch information
3 people authored Jan 2, 2025
1 parent 70063e2 commit 4223050
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

<!-- towncrier release notes start -->
## 0.17.4 (2024-12-31)


### Bug Fixes

- Adjusted log terminology
- Failed transformations counter now increments for all cases (None (null / missing), empty)

## 0.17.3 (2024-12-31)


Expand Down
12 changes: 2 additions & 10 deletions port_ocean/core/handlers/entity_processor/jq_entity_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def _notify_mapping_issues(
)
if missing_required_fields:
logger.info(
f"{entity_mapping_fault_counter} transformations of batch failed due to empty values"
f"{entity_mapping_fault_counter} transformations of batch failed due to empty, null or missing values"
)

async def _search(self, data: dict[str, Any], pattern: str) -> Any:
Expand Down Expand Up @@ -286,15 +286,7 @@ async def _parse_items(
failed_entities.append(parsed_entity)
else:
missing_required_fields = True
if (result.entity.get("identifier") == "") or (
result.entity.get("blueprint") == ""
):
entity_mapping_fault_counter += 1
else:
logger.debug(
f"Mapping failed, values verification for identifier: {result.entity.get("identifier")}, \
for blueprint: {result.entity.get("blueprint")}"
)
entity_mapping_fault_counter += 1

self._notify_mapping_issues(
entity_misconfigurations,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,11 @@ async def test_parse_items_empty_required(
logger.remove(sink_id)
logs_captured = stream.getvalue()

assert "2 transformations of batch failed due to empty values" in logs_captured
assert (
"2 transformations of batch failed due to empty, null or missing values"
in logs_captured
)
assert (
"{'blueprint': '.bar', 'identifier': '.foo'} (null, missing, or misconfigured)"
in logs_captured
)
assert "1 transformations of batch failed due to empty values" in logs_captured
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "port-ocean"
version = "0.17.3"
version = "0.17.4"
description = "Port Ocean is a CLI tool for managing your Port projects."
readme = "README.md"
homepage = "https://app.getport.io"
Expand Down

0 comments on commit 4223050

Please sign in to comment.