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

[Exporter.Geneva] Update scopes #736

Conversation

utpilla
Copy link
Contributor

@utpilla utpilla commented Oct 27, 2022

Exporting scopes in GenevaExporter:

  1. Export scopes which have a non-null key as individual columns (each key-value pair from the scopes is exported as its own column; these columns would also be taken into consideration when the CustomFields option is applied)
  2. When using formatted strings for scopes, the templated string ("{OriginalFormat"}) will not be exported
  3. GenevaExporter would not check for duplicate keys (if the scopes and log message together have any duplicate keys, they would all be exported)

Examples

1. Key is null

using (logger.BeginScope("MyScope"))
{
    logger.LogInformation("Hello from {food} {price}.", "artichoke", 3.99);
}

No scopes are exported in this case as there is no key provided for the scope.

2. Using formatted string in scopes

using (logger.BeginScope("MyInnerInnerScope with {FullName} and {age} of custom", "John Doe", 35))
{
    logger.LogInformation("Hello from {food} {price}.", "artichoke", 3.99);
}

Scopes exported:

FullName age
"John Doe" 35

3. Using IEnumerable<KeyValuePair<string, object>> in scopes

using (logger.BeginScope(new List<KeyValuePair<string, object>>
{
    new KeyValuePair<string, object>("MyKey1", "MyValue1"),
    new KeyValuePair<string, object>("MyKey2", "MyValue2"),
}))
{
    logger.LogInformation("Hello from {food} {price}.", "artichoke", 3.99);
}

Scopes exported:

MyKey1 MyKey2
MyValue1 MyValue2

4. Duplicate Keys in scopes

using (logger.BeginScope(new List<KeyValuePair<string, object>>
{
    new KeyValuePair<string, object>("MyKey1", "MyValue1"),
    new KeyValuePair<string, object>("MyKey1", "MyValue1"),
}))
{
    logger.LogInformation("Hello from {food} {price}.", "artichoke", 3.99);
}

Scopes exported:

MyKey1 MyKey1
MyValue1 MyValue1

Please provide a brief description of the changes here.

For significant contributions please make sure you have completed the following items:

  • Appropriate CHANGELOG.md updated for non-trivial changes

@utpilla utpilla added the comp:exporter.geneva Things related to OpenTelemetry.Exporter.Geneva label Oct 27, 2022
@utpilla utpilla requested a review from a team October 27, 2022 04:16
@utpilla utpilla changed the title Update scopes [Exporter.Geneva] Update scopes Oct 27, 2022
@codecov
Copy link

codecov bot commented Oct 27, 2022

Codecov Report

Merging #736 (bb6700e) into main (7099b6f) will decrease coverage by 0.16%.
The diff coverage is 50.00%.

❗ Current head bb6700e differs from pull request most recent head 8d02885. Consider uploading reports for the commit 8d02885 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #736      +/-   ##
==========================================
- Coverage   77.55%   77.38%   -0.17%     
==========================================
  Files         176      176              
  Lines        5298     5294       -4     
==========================================
- Hits         4109     4097      -12     
- Misses       1189     1197       +8     
Impacted Files Coverage Δ
...orter.Geneva/MsgPackExporter/MsgPackLogExporter.cs 90.51% <50.00%> (-3.56%) ⬇️

@utpilla utpilla merged commit 126cc34 into open-telemetry:main Oct 28, 2022
@utpilla
Copy link
Contributor Author

utpilla commented Oct 28, 2022

Related to #389

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:exporter.geneva Things related to OpenTelemetry.Exporter.Geneva
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants