|
| 1 | +--- |
| 2 | +id: appendix-d |
| 3 | +title: "Appendix D: Observability" |
| 4 | +description: Conventions for OpenFeature telemetry signals |
| 5 | +sidebar_position: 5 |
| 6 | +--- |
| 7 | + |
| 8 | +# Appendix D: Observability |
| 9 | + |
| 10 | +This document describes conventions for extracting data from the OpenFeature SDK for use in telemetry signals. |
| 11 | +It primarily focuses on providing recommendations for mapping well-known fields in OpenFeature to [OpenTelemetry feature-flag log records](https://opentelemetry.io/docs/specs/semconv/feature-flags/feature-flags-logs/) and other semantic conventions. |
| 12 | + |
| 13 | +## Evaluations |
| 14 | + |
| 15 | +Flag evaluation telemetry comprises data resolved from the provider resolution (evaluation details and flag metadata) as well as metadata about the provider itself. |
| 16 | +This is particularly relevant to telemetry-related [hooks](./sections/04-hooks.md). |
| 17 | + |
| 18 | +### Evaluation Details |
| 19 | + |
| 20 | +The following describes how fields on the [evaluation details](types.md#evaluation-details) are mapped to feature flag log records: |
| 21 | + |
| 22 | +| Evaluation Details Field | Log Record Attribute | Notes | |
| 23 | +| ------------------------ | --------------------------------------- | ---------------------------------------------------- | |
| 24 | +| `flag key` | `feature_flag.key` | See: [flag key](./glossary.md#flag-key) | |
| 25 | +| `error code` | `error.type` | See: [error code](./types.md#error-code) | |
| 26 | +| `variant`, `value` | `feature_flag.variant` | See: [variant](./glossary.md#variant) | |
| 27 | +| `error message` | `feature_flag.evaluation.error.message` | An error message associated with a failed evaluation | |
| 28 | +| `reason` | `feature_flag.evaluation.reason` | See: [reason](./types.md#reason) | |
| 29 | + |
| 30 | +> [!NOTE] |
| 31 | +> If the provider in question doesn't supply a `variant`, the a string representation of the `value` is used. |
| 32 | +
|
| 33 | +### Flag Metadata |
| 34 | + |
| 35 | +The following describes how keys in [flag metadata](types.md#flag-metadata) are mapped to feature flag log records: |
| 36 | + |
| 37 | +| Flag Metadata Key | Log Record Attribute | Notes | |
| 38 | +| ----------------- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 39 | +| `contextId` | `feature_flag.context.id` | The context identifier returned in the flag metadata uniquely identifies the subject of the flag evaluation. If not available, the [targeting key](./glossary.md#targeting-key) should be used. | |
| 40 | +| `flagSetId` | `feature_flag.set.id` | A logical identifier for the [flag set](./glossary.md#flag-set). | |
| 41 | +| `flagSetVersion` | `feature_flag.version` | A version string (format unspecified) for the [flag set](./glossary.md#flag-set). | |
| 42 | + |
| 43 | +> [!NOTE] |
| 44 | +> Keys in flag metadata use the "camelCase" casing convention, while the OpenTelemetry standard uses a namespaced "snake_case" convention. |
| 45 | +
|
| 46 | +### Provider Metadata |
| 47 | + |
| 48 | +| Provider Metadata Field | Log Record Attribute | Notes | |
| 49 | +| ----------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------ | |
| 50 | +| `name` | `feature_flag.provider_name` | The name of the provider as defined in the `provider metadata`, available in the `hook context`. | |
0 commit comments