go-sdk icon indicating copy to clipboard operation
go-sdk copied to clipboard

refactor: use `attribute.KeyValue` instead of map

Open sahidvelji opened this issue 5 months ago • 10 comments

This PR

I still need to fix the tests and also add more doc comments, but I wanted to get alignment from others before going ahead with those changes.

Related Issues

close #393 close #407

Notes

Follow-up Tasks

How to test

sahidvelji avatar Jul 26 '25 19:07 sahidvelji

to make sure I understand how users will get the a specific value they will do like this correct?

Yes that's right.

sahidvelji avatar Jul 28 '25 20:07 sahidvelji

I'm in favour of adding a telemetry package in contrib and just deprecating the telemetry package in this repo.

I'd recommend we just cut the v1 maintenance branch now

There are a couple more things I want to address before doing this

sahidvelji avatar Jul 31 '25 17:07 sahidvelji

@beeme1mr @toddbaert Just following up here. Are we OK with deprecating the telemetry package here and creating it in contrib? I think that makes more sense given that the OTel hooks package also lives in contrib.

sahidvelji avatar Aug 15 '25 01:08 sahidvelji

@beeme1mr @toddbaert Just following up here. Are we OK with deprecating the telemetry package here and creating it in contrib? I think that makes more sense given that the OTel hooks package also lives in contrib.

@beeme1mr @toddbaert @aepfli @erka @bbland1 I'd like to pick up this discussion again. Please comment.

sahidvelji avatar Oct 06 '25 21:10 sahidvelji

@sahidvelji rereading and refreshing myself, I would say that I agree with what felt like the previous consensus to deprecate the telemetry package here and have it in the contrib. It stays consistent with what other SDKs and with the Otel hook package there it kind of keeps those concepts in similar areas to look for info on when contributing to the dev or using it in their projects.

bbland1 avatar Oct 06 '25 22:10 bbland1

I support your proposal @sahidvelji. Since semconv has already provides the majority of necessary attributes, I don’t think the telemetry package adds significant value to go-sdk. Even the otel hook doesn’t rely on it.

erka avatar Oct 06 '25 22:10 erka

Whatever we decide here, we should be consistent across all the sdk repos. @beeme1mr Let me know if there is a better place to discuss proposals that affect all SDKs.

sahidvelji avatar Oct 06 '25 23:10 sahidvelji

Hey @sahidvelji, we added the telemetry method to the SDKs because I thought it would be generally useful (even outside of OTel) and would be dependency-free. If we bring in the OTel semcon dependency, that does change the equation slightly. Arguably, we don't need the dependency because the semcon shouldn't change much. I'm also one of the approvers in OTel, so hopefully changes won't go unnoticed.

Having said that, I don't really have an issue with moving the logic entirely to a hook. Nothing in the OpenFeature spec requires the telemetry function to live in the SDK. The opposite extreme is .NET, where OTel is built into the runtime, and we're considering adding OTel support natively in the SDK itself. I believe end users won't care where this logic works as long as there's an easy way to capture spec-compliant and consistent telemetry signals.

I was working with @lukas-reining on the JavaScript OTel hook last week. Pulling him in to see if he has a strong opinion. If not, I'll defer to @sahidvelji and @erka to decide what makes the most sense in the Go SDK.

beeme1mr avatar Oct 07 '25 20:10 beeme1mr

Any updates here? @beeme1mr @lukas-reining

sahidvelji avatar Oct 23 '25 13:10 sahidvelji

Any updates here? @beeme1mr @lukas-reining

I still don't have a strong opinion on where this logic should live, as long as the functionality is spec-compliant. I'm hoping either today or tomorrow to expand on the observability appendix in the OpenFeature docs to capture the requirements of the telemetry hook. You can see the PR @lukas-reining wrote here. The docs I'm planning on writing will be based on the discussions we had while building that.

beeme1mr avatar Oct 23 '25 18:10 beeme1mr