Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

Inconsistent field type conversion #61

Open
jfachal opened this issue Oct 7, 2015 · 1 comment
Open

Inconsistent field type conversion #61

jfachal opened this issue Oct 7, 2015 · 1 comment

Comments

@jfachal
Copy link

jfachal commented Oct 7, 2015

Hi,

In my humble opinion, there is an inconsistent within the treatment of the field type conversion.

The doc says:
"You can configure a specific field to be converted to a numeric type. Key is the additional field key (and should thus begin with an underscore), value is the type to convert to. Currently supported types are int, long, float and double."

But this is only true when you set the flag "includeFullMDC" to true.

If you don't set the explicit flag, and you create explicit mapping for additional fields, then the field type conversion is in the form:

requestId:_request_id
requestId:long

I think that this could be easily changed with a minimun change in the file GelfConverter.java to unified criteria:
Proposed change (line 202)
Replace:
map.put(additionalFields.get(key), convertFieldType(field, key));
With:
map.put(additionalFields.get(key), convertFieldType(field, additionalFields.get(key)));

Another aproach could be:

Replace (line 193 and line 195)
map.put(additionalFields.get(e.getKey()), convertFieldType(e.getValue(), additionalFields.get(e.getKey())));
map.put("" + e.getKey(), convertFieldType(e.getValue(), "" + e.getKey()));

With
map.put(additionalFields.get(e.getKey()), convertFieldType(e.getValue(), e.getKey()));
map.put("_" + e.getKey(), convertFieldType(e.getValue(), e.getKey()));

But this impies also changing the main doc page.

@exet3150
Copy link

exet3150 commented Oct 7, 2015

Hi,

by the flag you meant true

cheers,
P.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants