Skip to content

Commit

Permalink
fix requester documentation (#702)
Browse files Browse the repository at this point in the history
* fix example and check it in a test

* add entry to CHANGELOG.md

---------

Co-authored-by: dtrai2 <d.trai282@gmail.com>
  • Loading branch information
ekneg54 and dtrai2 authored Nov 14, 2024
1 parent 9c9b877 commit 132ebaa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
### Features
### Improvements

* fix `requester` documentation
* replace `BaseException` with `Exception` for custom errors
* refactor `generic_resolver` to validate rules on startup instead of application of each rule
* rewrite the helper method `add_field_to` such that it always raises an `FieldExistsWarning` instead of return a bool.
* add new helper method `add_fields_to` to directly add multiple fields to one event
* refactored some processors to make use of the new helper methods


### Bugfix

- fix `confluent_kafka.store_offsets` if `last_valid_record` is `None`, can happen if a rebalancing happens
* fix `confluent_kafka.store_offsets` if `last_valid_record` is `None`, can happen if a rebalancing happens
before the first message was pulled.
- fix pseudonymizer cache metrics not updated

Expand Down
3 changes: 1 addition & 2 deletions logprep/processor/requester/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
requester:
url: https://internal.cmdb.local/api/v1/locations
method: POST
content_type: application/json
target_field: cmdb.location
header:
headers:
Authorization: Bearer askdfjpiowejf283u9r
json:
hostname: ${message.hostname}
Expand Down
16 changes: 16 additions & 0 deletions tests/unit/processor/requester/test_requester_rule.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# pylint: disable=protected-access
# pylint: disable=missing-docstring
import pytest

from logprep.processor.requester.rule import RequesterRule


Expand All @@ -16,6 +17,21 @@ def test_create_from_dict_returns_requester_rule(self):
@pytest.mark.parametrize(
["rule", "error", "message"],
[
(
{
"filter": "domain",
"requester": {
"url": "https://internal.cmdb.local/api/v1/locations",
"method": "POST",
"target_field": "cmdb.location",
"headers": {"Authorization": "Bearer askdfjpiowejf283u9r"},
"json": {"hostname": "${message.hostname}"},
},
"description": "...",
},
None,
None,
),
(
{
"filter": "message",
Expand Down

0 comments on commit 132ebaa

Please sign in to comment.