Skip to content

Conversation

glucaci
Copy link
Contributor

@glucaci glucaci commented Mar 18, 2021

In order to register the profiler for Microsoft.Extensions.Caching.StackExchangeRedis we need public access to ElasticApmProfiler because the IConnectionMultiplexer is encapsulated in the RedisCache implementation.

Bellow is an example for which I have also opened a PR in dotnet/aspnetcore#31018 to allow hooking up the ProfilerSession

public static class ServiceCollectionExtensions
{
    public static void RegisterElasticApmRedis(this IServiceCollection services)
    {
        services
            .AddSingleton<IDistributedCache>(sp =>
            {
                var profiler = new ElasticApmProfiler(sp.GetService<IApmAgent>);
                var options = new RedisCacheOptions()
                {
                    Configuration = "localhost",
                    ProfilingSession = profiler.GetProfilingSession
                };

                return new RedisCache(options);
            });
    }
}

@cla-checker-service
Copy link

cla-checker-service bot commented Mar 18, 2021

💚 CLA has been signed

@ghost
Copy link

ghost commented Mar 18, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Started by user Russ Cam

  • Start Time: 2021-03-22T00:19:29.577+0000

  • Duration: 59 min 14 sec

  • Commit: b40a7e6

Test stats 🧪

Test Results
Failed 0
Passed 18759
Skipped 80
Total 18839

Trends 🧪

Image of Build Times

Image of Tests

@glucaci
Copy link
Contributor Author

glucaci commented Mar 18, 2021

I've signed the CLA, must be re-checked

Copy link
Contributor

@russcam russcam left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @glucaci 👍

@russcam russcam merged commit 95ad7d6 into elastic:master Mar 22, 2021
@glucaci glucaci deleted the redisCustomRegistration branch March 22, 2021 08:28
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.43%. Comparing base (88a8d64) to head (b40a7e6).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1229      +/-   ##
==========================================
- Coverage   81.47%   81.43%   -0.05%     
==========================================
  Files         165      165              
  Lines        6850     6850              
==========================================
- Hits         5581     5578       -3     
- Misses       1269     1272       +3     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

3 participants