Update the changelog and user docs for the C# experiments API

This commit is contained in:
Alessio Placitelli 2020-08-07 18:37:02 +02:00
Родитель 1263a0b3aa
Коммит 6db50e0411
2 изменённых файлов: 28 добавлений и 1 удалений

Просмотреть файл

@ -14,6 +14,7 @@
* Enable generating the C# APIs using the glean_parser.
* Add support for the `EventMetricType` in C#.
* Add support for the `TimingDistributionMetricType` in C#.
* Implement the experiments API in C#.
* Python
* BUGFIX: Limit the number of retries for 5xx server errors on ping uploads. ([#1120](https://github.com/mozilla/glean/pull/1120))
* This kinds of failures yield a "recoverable error", which means the ping gets re-enqueued. That can cause infinite loops on the ping upload worker. For python we were incorrectly only limiting the number of retries for I/O errors, another type of "recoverable error".

Просмотреть файл

@ -112,7 +112,33 @@ assert (
<div data-lang="C#" class="tab">
TODO. To be implemented in [bug 1648412](https://bugzilla.mozilla.org/show_bug.cgi?id=1648412).
```C#
// Annotate Glean pings with experiments data.
GleanInstance.SetExperimentActive(
experimentId: "blue-button-effective",
branch: "branch-with-blue-button",
extra: new Dictionary<string, string>() {
{ "buttonLabel", "test"}
}
);
// After the experiment terminates, the annotation
// can be removed.
GleanInstance.SetExperimentInactive("blue-button-effective");
```
> **Important**: Experiment IDs and branches don't need to be pre-defined in the Glean SDK registry files.
Please also note that the `extra` map is a non-nested arbitrary `string` to `string` dictionary. It also has limits on the size of the keys and values defined below.
There are test APIs available too:
```C#
// Was the experiment annotated in Glean pings?
Assert.True(GleanInstance.TestIsExperimentActive("blue-button-effective"));
// Was the correct branch reported?
Assert.Equal(
"branch-with-blue-button", GleanInstance.TestGetExperimentData("blue-button-effective").Branch
);
```
</div>