james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benoit Tellier (Jira)" <server-...@james.apache.org>
Subject [jira] [Updated] (JAMES-3587) Deprecate MDCBuild::addContext
Date Wed, 19 May 2021 14:16:00 GMT

     [ https://issues.apache.org/jira/browse/JAMES-3587?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Benoit Tellier updated JAMES-3587:
----------------------------------
    Attachment: Screenshot from 2021-05-19 21-13-46.png

> Deprecate MDCBuild::addContext
> ------------------------------
>
>                 Key: JAMES-3587
>                 URL: https://issues.apache.org/jira/browse/JAMES-3587
>             Project: James Server
>          Issue Type: Improvement
>          Components: James Core
>    Affects Versions: 3.6.0
>            Reporter: Benoit Tellier
>            Priority: Major
>             Fix For: 3.7.0
>
>         Attachments: Screenshot from 2021-05-19 21-13-46.png
>
>
> h3. Why?
> MDCBuilder::addContext does an implicit call to Object::toString
> There are two reasons:
>  - 1. Formatting. For instance `{"user":"btellier@erugerkuf"}` instead of simply `btellier@erugerkuf`.
>  - 2. Performance.
> See the attached flame graphs:  James spends ~1.20% of CPU calling Object::toString which
correlate closely to MDCBuilder::addContext. This crosses the "valuable to optimize" threashold.
Especially calls to MoreObject::toStringHelper(this) are not neglictible.
> h3 How?
> Deprecate the current API and replace it by an API that explicitly requires String or
Optional<String> so that the callers understand that they have to pass a string. 
> If they decide to pass toString then they need to explicitly call it, and be fully aware
of it. Nothing hidden anymore.
> On the philosophy this mimics SLF4J MDC API.
> Adapt all calls made in James code base to use this newer API.
> Also, StructuredLogger API needs to be adapted too.
> I don't think we should remove the deprecated calls



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message