Skip to content
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

[chore] Reduce complexity in processorhelper obsreport #10693

Merged
merged 1 commit into from
Jul 22, 2024

Conversation

djaglowski
Copy link
Member

This PR removes the recordData method, which I believe is an unhelpful abstraction for reporting internal processor metrics.

The drawbacks of the function are minor, but briefly:

  1. Recording any metric requires passing in zeros for all other metrics. This is cumbersome to extend because any new metric requires updating the call to recordData for all metrics. It's also fragile because if we have more than a few metrics it is easy to position the intended metric incorrectly.
  2. Every metric describes one data type, which is passed into recordData but then just used as a switch to get back to code that is specific to that data type.
  3. Every call to recordData instantiates N variables, where N is the number of metrics for each data type.

All of this seems unnecessary as we can just report each metric in one unambiguous line of code.

Copy link

codecov bot commented Jul 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.38%. Comparing base (a211cc8) to head (a6e9b96).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10693      +/-   ##
==========================================
- Coverage   92.39%   92.38%   -0.01%     
==========================================
  Files         403      403              
  Lines       18742    18722      -20     
==========================================
- Hits        17316    17296      -20     
  Misses       1066     1066              
  Partials      360      360              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@djaglowski djaglowski marked this pull request as ready for review July 22, 2024 14:43
@djaglowski djaglowski requested a review from a team as a code owner July 22, 2024 14:43
@djaglowski djaglowski requested a review from dmitryax July 22, 2024 14:43
@dmitryax dmitryax merged commit 49339e8 into open-telemetry:main Jul 22, 2024
69 checks passed
@github-actions github-actions bot added this to the next release milestone Jul 22, 2024
@djaglowski djaglowski deleted the proc-obsreport-reduce branch July 22, 2024 20:27
dmitryax added a commit to dmitryax/opentelemetry-collector that referenced this pull request Aug 12, 2024
After open-telemetry#10693, the processor helper only reports metrics if they got any values other than 0.

As a user, I would always prefer seeing 0 data points reported for any data sent through a processor for otelcol_processor_dropped_spans and otelcol_processor_refused_spans metrics.
dmitryax added a commit that referenced this pull request Aug 12, 2024
)

This change reverts
#10693,
which had an unintentional behavior change that made the processor
helper report metrics only if they got values other than `0`.

Fixes
#10855
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants