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

StackExchange Redis: Provide 'db.system' on Span creation #1984

Merged
merged 3 commits into from
Apr 16, 2021

Conversation

Austin-Tan
Copy link
Member

Fixes #1971 for Redis -- The issue was fixed for SQL instrumentation library by @johnduhart in #1979 , and this PR is largely based on his work.

Changes

Since we always attach the tag KeyVal ("db.system", "redis"), statically instantiating it is worth the small cost, and allows samplers to check for this tag when deciding to sample or not

@Austin-Tan Austin-Tan requested a review from a team April 15, 2021 08:47
@codecov
Copy link

codecov bot commented Apr 15, 2021

Codecov Report

❗ No coverage uploaded for pull request base (main@30b7dcf). Click here to learn what that means.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1984   +/-   ##
=======================================
  Coverage        ?   83.83%           
=======================================
  Files           ?      192           
  Lines           ?     6179           
  Branches        ?        0           
=======================================
  Hits            ?     5180           
  Misses          ?      999           
  Partials        ?        0           
Impacted Files Coverage Δ
...mentation/RedisProfilerEntryToActivityConverter.cs 94.59% <100.00%> (ø)
...ngeRedis/StackExchangeRedisCallsInstrumentation.cs 96.82% <100.00%> (ø)

@@ -35,6 +37,10 @@ internal class StackExchangeRedisCallsInstrumentation : IDisposable
internal const string ActivityName = ActivitySourceName + ".Execute";
internal static readonly Version Version = typeof(StackExchangeRedisCallsInstrumentation).Assembly.GetName().Version;
internal static readonly ActivitySource ActivitySource = new ActivitySource(ActivitySourceName, Version.ToString());
internal static readonly IEnumerable<KeyValuePair<string, object>> CreationTags = new[]
Copy link
Member Author

Choose a reason for hiding this comment

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

This collection is in the main RedisInstrumentation.cs file, as this is where we stored other static variables,
but I believe those were all only used in the class itself. We could alternatively put it in the Converter class where it's used, which is static (Does having it in static save memory? Most people are only instantiating one copy of the RedisInstrumentation.cs class anyway)

@cijothomas cijothomas merged commit 459cb6a into open-telemetry:main Apr 16, 2021
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.

Provide db.system attribute when activity is created for use with sampling
3 participants