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

Console log measurement name with conversion fun name #109

Merged
merged 3 commits into from
Mar 24, 2024

Conversation

03juan
Copy link
Contributor

@03juan 03juan commented Mar 24, 2024

Hi there.

I noticed a discrepancy in the console logger:

The event logs the measurement name when there is no function

Metric measurement: :response_time (summary)

but only the inspected function name otherwise

Metric measurement: &Telemetry.Metrics.ConsoleReporterTest.metadata_measurement/2 (sum)

This fix proposes to always print the measurement name and include the function inspection as necessary.


This is especially problematic with the multiple recommended ecto repo summaries in the documentation:

# Database Time Metrics
summary("my_app.repo.query.total_time", unit: {:native, :millisecond}),
summary("my_app.repo.query.decode_time", unit: {:native, :millisecond}),
summary("my_app.repo.query.query_time", unit: {:native, :millisecond}),
summary("my_app.repo.query.idle_time", unit: {:native, :millisecond}),
summary("my_app.repo.query.queue_time", unit: {:native, :millisecond}),

Where all the events are logged as:

Metric measurement: #Function<... in Telemetry.Metrics.maybe_convert_measurement/2> (summary)
With value: ... millisecond
Tag values: %{}

Metric measurement: #Function<... in Telemetry.Metrics.maybe_convert_measurement/2> (summary)
With value: ... millisecond
Tag values: %{}

... etc. x3 more

Thanks for the consideration

@03juan 03juan changed the title Console log functions Console log measurement name with conversion fun name Mar 24, 2024
Pull out the first actual function in case of duplicate measurements
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (182dbd7) to head (6b30fdf).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #109   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines          142       145    +3     
=========================================
+ Hits           142       145    +3     
Files Coverage Δ
lib/telemetry_metrics/console_reporter.ex 100.00% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 182dbd7...6b30fdf. Read the comment docs.

@josevalim josevalim merged commit ab86164 into beam-telemetry:main Mar 24, 2024
2 checks passed
@josevalim
Copy link
Contributor

💚 💙 💜 💛 ❤️

@03juan 03juan deleted the console-log-functions branch March 24, 2024 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants