Skip to content

feat!: telemetry utils (#206)#238

Open
mstepien wants to merge 1 commit into
open-feature:mainfrom
mstepien:206-telemetry-utils
Open

feat!: telemetry utils (#206)#238
mstepien wants to merge 1 commit into
open-feature:mainfrom
mstepien:206-telemetry-utils

Conversation

@mstepien
Copy link
Copy Markdown

@mstepien mstepien commented Apr 17, 2026

Signed-off-by: Marcin Stepien marcin.stepien@fluxon.com

Add Telemetry Utils #206

Adds Appendix D (Observability/Telemetry) mapping utilities to the Kotlin SDK.

  • Adds dev.openfeature.kotlin.sdk.telemetry.EvaluationEvent data construct mapped to OpenTelemetry
  • Adds dev.openfeature.kotlin.sdk.telemetry.Telemetry static mapping object exposing the createEvaluationEvent() bridging utility.
  • Implements parsing logic translating HookContext and FlagEvaluationDetails payloads, accounting for Error state mutations, Context evaluations, and natively unwrapping SDK Value objects iteratively down to pure primitives/Maps.
  • Adds unit and integration testing

Related Issues

Fixes #206

Breaking changes

EvaluationEvent and createEvaluationEvent() moved from dev.openfeature.kotlin.sdk to dev.openfeature.kotlin.sdk.telemetry.Telemetry. The old top-level function is replaced by Telemetry.createEvaluationEvent().

Notes

  • Value Parsing: OpenFeature Value definitions natively wrap structures (Value.Structure, Value.List, etc). Because downstream standard OTEL loggers require primitives, createEvaluationEvent employs a robust recursive unwrapping mechanic natively translating custom dev.openfeature.kotlin.sdk.Value elements gracefully down to decoupled Kotlin Map<String, Any?> interfaces to prevent logging friction.
  • This implementation relies on zero external dependencies.

How to test

./gradlew :kotlin-sdk:testDebugUnitTest --tests "dev.openfeature.kotlin.sdk.telemetry.*"

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a telemetry module to the Kotlin SDK, enabling the creation of OpenTelemetry-compliant evaluation events based on the OpenFeature specification. It includes a new EvaluationEvent data class and a Telemetry utility that maps evaluation details to standard OTel semantic conventions. The review feedback identifies a potential issue with case-sensitive string comparisons when detecting error states and suggests converting Instant values to strings to ensure compatibility with downstream OTel exporters.

mstepien added a commit to mstepien/kotlin-sdk that referenced this pull request Apr 20, 2026
Signed-off-by: Marcin Stepien <marcin.stepien@fluxon.com>
@mstepien mstepien force-pushed the 206-telemetry-utils branch from 5ea87a9 to c63876a Compare April 20, 2026 11:37
@mstepien mstepien marked this pull request as ready for review April 20, 2026 13:57
Signed-off-by: Marcin Stepien <marcin.stepien@fluxon.com>
@mstepien mstepien force-pushed the 206-telemetry-utils branch from c63876a to 081a04e Compare April 27, 2026 12:21
@mstepien mstepien requested a review from typotter April 27, 2026 12:23
@mstepien mstepien changed the title feat: telemetry utils feat: telemetry utils (#206) Apr 27, 2026
@typotter
Copy link
Copy Markdown
Contributor

typotter commented May 5, 2026

This PR removes dev.openfeature.kotlin.sdk.EvaluationEvent and dev.openfeature.kotlin.sdk.TelemetryKt (the top-level createEvaluationEvent function) from the binary API and replaces them with dev.openfeature.kotlin.sdk.telemetry.*. Binary breaking change for any consumer importing the old symbols.

Pre-1.0 SDK so this is fine, but worth noting in the PR description so it shows up in release notes. Something like:

Breaking: EvaluationEvent and createEvaluationEvent() moved from dev.openfeature.kotlin.sdk to dev.openfeature.kotlin.sdk.telemetry.Telemetry. The old top-level function is replaced by Telemetry.createEvaluationEvent().

@mstepien mstepien changed the title feat: telemetry utils (#206) feat!: telemetry utils (#206) May 8, 2026
@mstepien mstepien requested a review from typotter May 8, 2026 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Telemetry Utils

2 participants