jbogard / MongoDB.Driver.Core.Extensions.DiagnosticSources

Apache License 2.0
46 stars 18 forks source link

Add filter function to instrumentation options. #9

Closed ylazebnyk closed 3 years ago

ylazebnyk commented 3 years ago

When filter is null or returns true activity is created, when filter returns false activity is not created. Resolves #8

builder.Subscribe(new DiagnosticsActivityEventSubscriber(new InstrumentationOptions
    {
        Filter = e => new[] { "getLastError", "isMaster", "buildinfo" }.All(x => !x.Equals(e.CommandName))
    }));
jbogard commented 3 years ago

Thanks! I'm going to make a slight name change after merge, to match the Activity API.