Class ObservabilityPlugin
Inherited Members
Namespace: LaunchDarkly.Observability
Assembly: LaunchDarkly.Observability.dll
Syntax
public class ObservabilityPlugin : Plugin
Methods
| Edit this page View SourceBuilder(IServiceCollection)
Create a new builder for ObservabilityPlugin.
When using this builder, LaunchDarkly client must be constructed before your application is built. For example:
var builder = WebApplication.CreateBuilder(args);
var config = Configuration.Builder("your-sdk-key")
.Plugins(new PluginConfigurationBuilder()
.Add(ObservabilityPlugin.Builder(builder.Services)
.WithServiceName("ryan-test-service")
.WithServiceVersion("example-sha")
.Build())).Build();
// Building the LdClient with the Observability plugin. This line will add services to the web application.
var client = new LdClient(config);
// Client must be built before this line.
var app = builder.Build();
Declaration
public static ObservabilityPlugin.ObservabilityPluginBuilder Builder(IServiceCollection services)
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | The service collection for dependency injection. |
Returns
Type | Description |
---|---|
ObservabilityPlugin.ObservabilityPluginBuilder | A new ObservabilityPlugin.ObservabilityPluginBuilder instance for configuring the observability plugin. |
ForExistingServices()
Construct a plugin which is intended to be used with already configured observability services.
In a typical configuration, this method will not need to be used.
This method only needs to be used when observability related functionality must be initialized before it is possible to initialize the LaunchDarkly SDK.
Declaration
public static ObservabilityPlugin ForExistingServices()
Returns
Type | Description |
---|---|
ObservabilityPlugin | an observability plugin instance |
GetHooks(EnvironmentMetadata)
Returns a list of hooks to be registered for the plugin, based on the provided environment metadata.
Declaration
public override IList<Hook> GetHooks(EnvironmentMetadata metadata)
Parameters
Type | Name | Description |
---|---|---|
EnvironmentMetadata | metadata | Metadata about the environment. |
Returns
Type | Description |
---|---|
IList<Hook> | A list of hook instances to be registered. |
Overrides
Register(ILdClient, EnvironmentMetadata)
Registers the plugin with the specified LaunchDarkly client and environment metadata.
Declaration
public override void Register(ILdClient client, EnvironmentMetadata metadata)
Parameters
Type | Name | Description |
---|---|---|
ILdClient | client | An instance of the LaunchDarkly client to register the plugin with. |
EnvironmentMetadata | metadata | Metadata about the environment. |