Skip to content

[FEATURE] Refactor telemetry packageΒ #407

@sahidvelji

Description

@sahidvelji

Requirements

I would like to improve the telemetry package:

  • Omit the value from the returned attributes. The value is of type any and this results in the loss of type safety (use of map[string]any). Instead, by omitting the value, the attributes map can be of type map[string]string, which is much easier to work with. The value is otherwise very easy to obtain via details.Value anyways.
  • The "Name" of the evaluation event should not be returned. Instead, since that is already a const in the package, users can just use that const wherever it is needed. Ideally, this event name const feature_flag.evaluation should eventually make its way into the OTel semconv (as a const). Currently it is in the spec but not in the semconv package.
  • Refactor the CreateEvaluationEvent function to make it work for ALL stages of a hook, rather than just after and finally. To do that, we could modify the details openfeature.InterfaceEvaluationDetails parameter to be a pointer so that a nil check can be performed before adding additional attributes derived from the details. This allows the package to be a bit more useful. This is not a huge deal though, given that there are only two attributes in the hookContext.

I think the goal should be for this package to be used in both the existing logging hook and the OTel hook in go-sdk-contrib.

Related issue: #393

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions