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

Add result builders to MultiLogger and MultiTrackers 👷 #265

Merged

Conversation

p4checo
Copy link
Member

@p4checo p4checo commented Apr 7, 2023

Checklist

Motivation and Context

Some of our "multiplexer" instances for logging (Log.MultiLogger), analytics (Analytics.MultiTracker) and performance metrics (PerformanceMetrics.MultiTracker) require type erasure on the child elements to which they forward events, causing the setup to be cumbersome and not intuitive.

By leveraging result builders we can make this a bit smoother to users by abstracting/automating the type erasure "dance". Furthermore, it unlocks control flow (e.g. if/else, for ... in, if #available) which allows more advanced setups to be defined directly in the builder.

Description

  • Add result builders to facilitate instantiating certain "multiplexer" instances, most notably the ones that require type erasure:

    • Log.MultiLogger (requires erasing to AnyMetadataLogDestination)

    • Analytics.MultiTracker (requires erasing to AnyAnalyticsTracker)

    • PerformanceMetrics.MultiTracker (doesn't require erasing)

  • Add relevant UTs.

@p4checo p4checo requested a review from a team April 7, 2023 22:54
@codecov
Copy link

codecov bot commented Apr 7, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.18%. Comparing base (40b1f63) to head (dfd5bdc).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #265      +/-   ##
==========================================
+ Coverage   95.09%   95.18%   +0.08%     
==========================================
  Files         101      101              
  Lines        3384     3445      +61     
==========================================
+ Hits         3218     3279      +61     
  Misses        166      166              

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

@p4checo p4checo force-pushed the add-result-builders-to-multi-logger-and-multi-trackers branch from 7f2295e to bfa103a Compare April 15, 2024 16:34
Some of our "multiplexer" instances for logging (`Log.MultiLogger`),
analytics (`Analytics.MultiTracker`) and performance metrics
(`PerformanceMetrics.MultiTracker`) require type erasure on the child
elements to which they forward events, causing the setup to be
cumbersome and not intuitive.

By leveraging result builders we can make this a bit smoother to users
by abstracting/automating the type erasure "dance". Furthermore, it
unlocks control flow (e.g. `if/else`, `for ... in`, `if #available`)
which allows more advanced setups to be defined directly in the builder.

## Changes

- Add result builders to facilitate instantiating certain "multiplexer"
instances, most notably the ones that require type erasure:

  + `Log.MultiLogger` (requires erasing to `AnyMetadataLogDestination`)

  + `Analytics.MultiTracker` (requires erasing to `AnyAnalyticsTracker`)

  + `PerformanceMetrics.MultiTracker` (doesn't require erasing)

- Add relevant UTs.
@p4checo p4checo force-pushed the add-result-builders-to-multi-logger-and-multi-trackers branch from bfa103a to dfd5bdc Compare April 24, 2024 23:59
@p4checo p4checo merged commit 3f11627 into master Apr 25, 2024
11 checks passed
@p4checo p4checo deleted the add-result-builders-to-multi-logger-and-multi-trackers branch April 25, 2024 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants