open-telemetry / opentelemetry-log-collection

OpenTelemetry log collection library
https://opentelemetry.io
Apache License 2.0
92 stars 41 forks source link

Allow field syntax to refer to arbitrary attribute and resource fields #454

Closed djaglowski closed 2 years ago

djaglowski commented 2 years ago

Resolves open-telemetry/opentelemetry-log-collection#190

A couple notes on this implementation:

  1. There's definitely room to refactor/extract logic. This is a verbose implementation but should be fully functional and performant.
  2. This explicitly does not address open-telemetry/opentelemetry-collector-contrib#10280, which will allow resource and attributes to be valid fields in their own right, in some cases. (The retain operator still has its preexisting special case for these.)
  3. Many test cases were updated or added. In some cases, previous level of coverage was not great, so many of these are net new.
codecov[bot] commented 2 years ago

Codecov Report

Merging #454 (ee95502) into main (6c3c01e) will increase coverage by 0.5%. The diff coverage is 98.0%.

Impacted file tree graph

@@           Coverage Diff           @@
##            main    open-telemetry/opentelemetry-log-collection#454     +/-   ##
=======================================
+ Coverage   75.5%   76.0%   +0.5%     
=======================================
  Files         81      83      +2     
  Lines       3852    4020    +168     
=======================================
+ Hits        2911    3059    +148     
- Misses       663     675     +12     
- Partials     278     286      +8     
Impacted Files Coverage Δ
entry/attribute_field.go 97.6% <97.5%> (-2.4%) :arrow_down:
entry/resource_field.go 97.6% <97.5%> (-2.4%) :arrow_down:
entry/body_field.go 100.0% <100.0%> (ø)
entry/field.go 98.1% <100.0%> (+2.9%) :arrow_up:
operator/transformer/recombine/recombine.go 75.6% <0.0%> (-2.1%) :arrow_down:
operator/helper/parser.go 67.5% <0.0%> (-0.5%) :arrow_down:
entry/entry.go 100.0% <0.0%> (ø)
operator/parser/time/time.go 100.0% <0.0%> (ø)
operator/parser/scope/scope_name.go 75.0% <0.0%> (ø)
operator/helper/scope_name.go 56.5% <0.0%> (ø)
... and 1 more