-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: report attributes as fields #874
Conversation
72ca7c7
to
1c9bf0c
Compare
This shouldn't happen in the exporter, as exporters shouldn't modify data. I think this should be a feature in the schema processor, if anything, and should probably be configurable. |
I agree that this should be in a processor. It also seems to be totally independent from what I'm doing right now in |
Thx. Agree, that it should be configurable |
A few nits. Please modify |
pkg/processor/sumologicschemaprocessor/log_fields_conversion_processor.go
Outdated
Show resolved
Hide resolved
pkg/processor/sumologicschemaprocessor/log_fields_conversion_processor.go
Outdated
Show resolved
Hide resolved
pkg/processor/sumologicschemaprocessor/log_fields_conversion_processor.go
Outdated
Show resolved
Hide resolved
edc8148
to
f5996e8
Compare
f5996e8
to
d670949
Compare
c33469d
to
e1ad3dd
Compare
e1ad3dd
to
73ea417
Compare
|
||
# Defines whether `severity` attribute should be added to record attributes. | ||
# default = true | ||
add_severity_level_attribute: {true, false} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose the following configuration, or something similar:
add_severity_attribute:
enabled: true
attribute_name: loglevel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed configuration and extended to use other fields as well, eg. severity text
span id
and trace id
. That was asked by our customer support, however I'm still waiting for confirmation if client needs that. Anyway, we can always leave it or remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be updated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @astencel-sumo that the configuration added by this PR should be grouped in one major key, instead of producing 4 new config options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sumo-drosiek I don't think @astencel-sumo suggested grouping, but maybe I'm wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @pdelewski any update on this? The customer is inquiring for updates and I don't see any recent movement. Thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @bnartiff , I will update PR tomorrow. It still requires aprovals. I was also waiting for confirmation regarding fields that customer expects (as originally there were mentioned only severity, recently I updated that to spanid
and traceid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update, I am going to check w/ the customer to confirm the desired fields. Thank you for adding spanid and traceid as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per customer, "I think severity, spanID, and traceID are a good start. I don’t have any other suggestions/needs at this point. " @pdelewski
6dbd3a5
to
5f8a0e1
Compare
|
||
In order to report one of them as field, following configuration is needed: | ||
|
||
```json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
```json | |
```yaml |
@astencel-sumo @sumo-drosiek @aboguszewski-sumo Could you look at this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some problems with understanding how should this work in general. As I understand - there are some OTLP fields in logs that are not shown in Sumo, and to fix that, we transform them into regular attributes. Should every of these fields be translated, or only one, selected in the config? The implementation suggests that all of them are translated, but the config suggests that only one of them.
|
||
### Severity Attribute | ||
|
||
Some fields that log entries consist are not displayed as fields in Sumo Logic out of the box. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some fields that log entries consist are not displayed as fields in Sumo Logic out of the box. | |
Some fields that log entries consist of are not displayed as fields in Sumo Logic out of the box. |
|
||
# Defines whether `severity` attribute should be added to record attributes. | ||
add_severity_number_attribute: | ||
enabled: true | ||
attribute_name: "loglevel" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep it consistent with other examples above in this file, eg.:
add_severity_number_attribute:
# if enabled, then XYZ
# default = true
enabled: {true, false}
# The name that is something
# default = "loglevel"
attribute_name: "loglevel"
In order to report one of them as field, following configuration is needed: | ||
|
||
```yaml | ||
add_severity_number_attribute: | ||
enabled: true | ||
attribute_name: "loglevel" | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can all of them be enabled or only one at one time? Maybe it's better to squash this into one attribute and disable it by selecting none
, empty string or something like that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My idea was to be able to enable one by one, however I have not seen requirements regarding this from customer side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I've read the discussion above. In my opinion, the best thing would be to define something like this (the name should probably be different, I'm not sure how to call all these attributes):
add_log_metadata_attributes:
metadata: ["severity_no", "severity_text", "span_id", "trace_id"]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I can update implementation according to your suggestion, @astencel-sumo @sumo-drosiek What's your opinion on that? I would like to avoid yet another round of changes regarding configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not convinced that squashing all configurations into a single property is any better than the current solution. We can discuss in a meeting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not convinced that squashing all configurations into a single property is any better than the current solution. We can discuss in a meeting.
same as we skip attribute_name
name: "addSeverity", | ||
addSeverity: true, | ||
createLogs: func() plog.Logs { | ||
logs := plog.NewLogs() | ||
log := logs.ResourceLogs().AppendEmpty().ScopeLogs().AppendEmpty().LogRecords().AppendEmpty() | ||
log.SetSeverityNumber(plog.SeverityNumberInfo) | ||
log.SetSeverityText("severity") | ||
var spanIDBytes [8]byte = [8]byte{1, 1, 1, 1, 1, 1, 1, 1} | ||
log.SetSpanID(spanIDBytes) | ||
var traceIDBytes [16]byte = [16]byte{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} | ||
log.SetTraceID(traceIDBytes) | ||
return logs | ||
}, | ||
test: func(outputLogs plog.Logs) { | ||
attribute1, found := outputLogs.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0).Attributes().Get("loglevel") | ||
assert.True(t, found) | ||
assert.Equal(t, "INFO", attribute1.Str()) | ||
attribute2, found := outputLogs.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0).Attributes().Get("severitytext") | ||
assert.True(t, found) | ||
assert.Equal(t, "severity", attribute2.Str()) | ||
attribute3, found := outputLogs.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0).Attributes().Get("spanid") | ||
assert.True(t, found) | ||
assert.Equal(t, "0101010101010101", attribute3.Str()) | ||
attribute4, found := outputLogs.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0).Attributes().Get("traceid") | ||
assert.True(t, found) | ||
assert.Equal(t, "01010101010101010101010101010101", attribute4.Str()) | ||
|
||
}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how this works.
In the config (lines 1356+), you set only SeverityNumberAttributeName
to be transformed, but here everything is transformed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will check that
|
||
`add_severity_number_attribute` | ||
`add_severity_text_attribute` | ||
`add_space_id_attribute` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`add_space_id_attribute` | |
`add_span_id_attribute` |
@@ -1298,3 +1353,15 @@ func newAggregateAttributesConfig(aggregations []aggregationPair) *Config { | |||
config.AggregateAttributes = aggregations | |||
return config | |||
} | |||
|
|||
func newLogFieldsConversionConfig(logFieldsConversion bool) *Config { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter logFieldsConversion
does not seem to be used? Which probably indicates that the test coverage is not good enough 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sumo-drosiek @astencel-sumo @aboguszewski-sumo I updated PR according to our today discussion as well as fixed some bugs. Current configuration looks as suggested by @sumo-drosiek, however I have not changed main key field_attributes
yet. (I'm looking for better alternative and inspiration )
field_attributes:
trace_id:
enabled: true
name: traceid
span_id:
enabled: true
name: spanid
If you have suggestion regarding replacing fieldd_attributes
with better name, just let me know
843581b
to
a04f125
Compare
a04f125
to
6b88312
Compare
enabled: true | ||
name: "loglevel" | ||
|
||
- ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line (79) seems redundant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
field_attributes: | ||
severity_number: | ||
enabled: true | ||
name: "loglevel" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Info about defaults is missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a test that checks if this is correct?
field_attributes:
severity_number:
enabled: true
name: "definitely_not_default_name"
@aboguszewski-sumo I updated current test using suggested name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I overlooked one thing when I asked for that, sorry for inconvienience.
There is opened bug https://jira.kumoroku.com/jira/browse/SUMO-207676, which is about reporting severity as a field. This PR does similar thing as LokiExporter, adding severity into set of attributes. It's preliminary solution, showing only possible way, not necessarily final solution and question is how do we want to tackle it.