From e3ff6396fdbb71137a0aee691289269c3acf0026 Mon Sep 17 00:00:00 2001 From: Todd Baert Date: Mon, 13 Jan 2025 14:00:20 -0500 Subject: [PATCH] fixup: add type, value Signed-off-by: Todd Baert --- specification/appendix-d-observability.md | 39 ++++++++++++++--------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/specification/appendix-d-observability.md b/specification/appendix-d-observability.md index ca31f7a1..2c6f8d2b 100644 --- a/specification/appendix-d-observability.md +++ b/specification/appendix-d-observability.md @@ -19,33 +19,42 @@ This is particularly relevant to telemetry-related [hooks](./sections/04-hooks.m The following describes how fields on the [evaluation details](types.md#evaluation-details) are mapped to feature flag log records: -| Evaluation Details Field | Log Record Attribute | Notes | -| ------------------------ | --------------------------------------- | ---------------------------------------------------- | -| `flag key` | `feature_flag.key` | See: [flag key](./glossary.md#flag-key) | -| `error code` | `error.type` | See: [error code](./types.md#error-code) | -| `variant` | `feature_flag.variant` | See: [variant](./glossary.md#variant) | -| `error message` | `feature_flag.evaluation.error.message` | An error message associated with a failed evaluation | -| `reason` | `feature_flag.evaluation.reason` | See: [reason](./types.md#resolution-reason) | +| Log Record Attribute | Source Field or Derived Value from Evaluation Details | Notes | +| --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | +| `feature_flag.key` | `flag key` | See: [flag key](./glossary.md#flag-key) | +| `error.type` | `error code` | See: [error code](./types.md#error-code) | +| `feature_flag.variant` | `variant` | See: [variant](./glossary.md#variant) | +| `feature_flag.evaluation.error.message` | `error message` | An error message associated with a failed evaluation | +| `feature_flag.evaluation.reason` | `reason` | See: [reason](./types.md#resolution-reason) | +| `feature_flag.evaluation.value.type` | one of `"array"`, `"boolean"`, `"byte_array"`, `"float"`, `"int"`, `"map"`, `"null"`, `"string"` or `"unknown"`, representing the type of the `evaluation details'` `value` field | See: [reason](./types.md#resolution-reason) | > [!NOTE] > The `error.type` and `feature_flag.evaluation.reason` enumerations use a lowercase "snake_case" convention (see [OpenTelemetry feature-flag log records](https://opentelemetry.io/docs/specs/semconv/feature-flags/feature-flags-logs/)). > OpenFeature [error codes](types.md#error-code) and [resolution reasons](./types.md#resolution-reason) should be transformed accordingly by integrations which include this data. +#### Flag Value + +The flag value is required if the `feature_flag.variant` is not set (and optional otherwise), and is defined in a the event body: + +| Body Field | Source Field from Evaluation Details | +| ---------- | ------------------------------------ | +| `value` | `value` | + ### Flag Metadata The following describes how keys in [flag metadata](types.md#flag-metadata) are mapped to feature flag log records: -| Flag Metadata Key | Log Record Attribute | Notes | -| ----------------- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `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. | -| `flagSetId` | `feature_flag.set.id` | A logical identifier for the [flag set](./glossary.md#flag-set). | -| `flagSetVersion` | `feature_flag.version` | A version string (format unspecified) for the [flag set](./glossary.md#flag-set). | +| Log Record Attribute | Flag Metadata Key | Notes | +| ------------------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `feature_flag.context.id` | `contextId` | 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. | +| `feature_flag.set.id` | `flagSetId` | A logical identifier for the [flag set](./glossary.md#flag-set). | +| `feature_flag.version` | `flagSetVersion` | A version string (format unspecified) for the [flag set](./glossary.md#flag-set). | > [!NOTE] > Keys in flag metadata use the "camelCase" casing convention, while the OpenTelemetry standard uses a namespaced "snake_case" convention. ### Provider Metadata -| Provider Metadata Field | Log Record Attribute | Notes | -| ----------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------ | -| `name` | `feature_flag.provider_name` | The name of the provider as defined in the `provider metadata`, available in the `hook context`. | +| Log Record Attribute | Provider Metadata Field | Notes | +| ---------------------------- | ----------------------- | ------------------------------------------------------------------------------------------------ | +| `feature_flag.provider_name` | `name` | The name of the provider as defined in the `provider metadata`, available in the `hook context`. |