fluent / fluent/fluent-logger-python

FluentRecordFormatter._structuring may raise AttributeError

Open
#45 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
457
Forks
138
PR merge metrics
No merged PRs in 30d

Description

`json.loads(str(msg))` may not return a dict, it can return:
- int if `msg` is a json dumped from an int, for example `msg = '123'`
- list if `msg` is a json dumped from a list, for example `msg = '["s", "1"]'`

Only dict have items() method.

So if you get a logger and add a fluent.handler to it, then you execute
`logger.info('1')`
you will get an AttributeError

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at FluentRecordFormatter._structuring and reproduce the failure by attaching a fluent handler, then calling logger.info('1'). Confirm the behavior for JSON scalars and lists, and consider the issue done when these messages no longer raise AttributeError while dictionary messages continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
observability
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.