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

ConsoleLogRecordExporter modified to support Message and StateValues #1871

Merged
merged 4 commits into from
Mar 8, 2021

Conversation

cijothomas
Copy link
Member

#1869 expanded LogRecord to have formatted message and higher-perf StateValues.
This PR is modifying ConsoleExporter to support these additional fields.

When right options are enabled, the following output is produced.
image

@cijothomas cijothomas requested a review from a team March 6, 2021 15:56
@codecov
Copy link

codecov bot commented Mar 6, 2021

Codecov Report

Merging #1871 (128a792) into main (cb066cb) will decrease coverage by 0.45%.
The diff coverage is 78.36%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1871      +/-   ##
==========================================
- Coverage   83.77%   83.32%   -0.46%     
==========================================
  Files         187      189       +2     
  Lines        5967     6123     +156     
==========================================
+ Hits         4999     5102     +103     
- Misses        968     1021      +53     
Impacted Files Coverage Δ
src/OpenTelemetry/Logs/OpenTelemetryLogger.cs 26.82% <20.54%> (-44.60%) ⬇️
src/OpenTelemetry/Logs/LogRecord.cs 82.50% <77.77%> (-5.00%) ⬇️
.../OpenTelemetry/Logs/OpenTelemetryLoggerProvider.cs 77.55% <88.23%> (+7.09%) ⬆️
...rc/OpenTelemetry/Trace/TracerProviderBuilderSdk.cs 88.46% <88.88%> (-2.28%) ⬇️
src/OpenTelemetry/Trace/ExceptionProcessor.cs 90.90% <90.90%> (ø)
src/OpenTelemetry/Trace/TracerProviderSdk.cs 95.16% <98.64%> (+4.38%) ⬆️
...metryProtocol/Implementation/ActivityExtensions.cs 86.89% <100.00%> (+0.05%) ⬆️
...ry.Instrumentation.AspNet/AspNetInstrumentation.cs 100.00% <100.00%> (ø)
...umentation.AspNet/Implementation/HttpInListener.cs 89.10% <100.00%> (ø)
...entation.AspNet/TracerProviderBuilderExtensions.cs 100.00% <100.00%> (ø)
... and 24 more

this.WriteLine($"{"LogRecord.State:".PadRight(rightPaddingLength)}{logRecord.State}");
if (logRecord.Message != null)
{
this.WriteLine($"{"LogRecord.Message:".PadRight(rightPaddingLength)}{logRecord.Message}");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, I am wondering if we could output a markdown table, similar like what Benchmark.Net did?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me try to get that! would make the getting-started readme looks nicer.

Copy link
Member

@reyang reyang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

this.WriteLine("LogRecord.StateValues (Key:Value):");
for (int i = 0; i < logRecord.StateValues.Count; i++)
{
this.WriteLine($"{logRecord.StateValues[i].Key.PadRight(rightPaddingLength)}:{logRecord.StateValues[i].Value}");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This padding would leave : on the right, a bit weird.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can see it in the picture in the description, it does look a bit odd.

Copy link
Member

@CodeBlanch CodeBlanch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cijothomas cijothomas merged commit f252428 into main Mar 8, 2021
@cijothomas cijothomas deleted the cijothomas/consolelogexporter branch March 8, 2021 16:28
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.

3 participants