Share via


Azure Online Experimentation client library for .NET - version 1.0.0-beta.1

Azure Online Experimentation is a managed service that enables developers to create and manage experiment metrics for evaluating online A/B tests.

Source code | API reference documentation | Product documentation | Samples

Getting started

Install the package

Install the Azure Online Experimentation client library for .NET with NuGet:

dotnet add package Azure.Analytics.OnlineExperimentation --prerelease

Prerequisites

You need an Azure subscription with an Azure Online Experimentation workspace resource.

Authenticate the client

The Azure Online Experimentation client library initialization requires two parameters:

var endpoint = new Uri(Environment.GetEnvironmentVariable("AZURE_ONLINEEXPERIMENTATION_ENDPOINT"));
var client = new OnlineExperimentationClient(endpoint, new DefaultAzureCredential());

Select a service API version

You can explicitly select a supported service API version when instantiating a client:

var endpoint = new Uri(Environment.GetEnvironmentVariable("AZURE_ONLINEEXPERIMENTATION_ENDPOINT"));
var options = new OnlineExperimentationClientOptions(OnlineExperimentationClientOptions.ServiceVersion.V2025_05_31_Preview);
var client = new OnlineExperimentationClient(endpoint, new DefaultAzureCredential(), options);

Always ensure that the chosen API version is fully supported and operational for your specific use case and aligns with the service's versioning policy.

Key concepts

The Azure Online Experimentation client library provides the following key classes:

  • OnlineExperimentationClient: Main client class for interacting with the service.
  • DiagnosticDetail: Represents diagnostic details for experiment metrics.

Thread safety

All client instances are thread-safe. It's recommended to reuse client instances across threads.

Additional concepts

Client options | Accessing the response | Handling failures | Diagnostics

Examples

Explore common scenarios using the samples:

Troubleshooting

Common exceptions include:

  • RequestFailedException: Indicates a failure in the request. Inspect the exception message and status code for details.

Enable logging and diagnostics to debug issues:

var endpoint = new Uri(Environment.GetEnvironmentVariable("AZURE_ONLINEEXPERIMENTATION_ENDPOINT"));
var options = new OnlineExperimentationClientOptions()
{
    Diagnostics =
    {
        IsLoggingContentEnabled = true
    }
};
var client = new OnlineExperimentationClient(endpoint, new DefaultAzureCredential(), options);

Next steps

Contributing

See CONTRIBUTING.md for details on contributing to this library.

Impressions