Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ofep for metric hooks #62

Merged
merged 19 commits into from
May 31, 2023

Conversation

Kavindu-Dodan
Copy link
Contributor

@Kavindu-Dodan Kavindu-Dodan commented May 19, 2023

This PR

Introduce an enhancement proposal to introduce OpenTelemetry metric hooks.

Consider checking PR [1] for a POC implementation in Go sdk.

Besides, see below Prometheus samples for metrics,

feature_flag.evaluation_requests_total
image

feature_flag.evaluation_success_total
image

feature_flag.evaluation_error_total
image

feature_flag.evaluation_requests_total
image

[1] - open-feature/go-sdk-contrib#217

Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
OFEP-metric-hooks.md Outdated Show resolved Hide resolved
Copy link
Member

@thisthat thisthat left a comment

Choose a reason for hiding this comment

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

Should we define the naming of the exposed metrics as part of this OFEP or would be this covered in the following up spec change?

OFEP-metric-hooks.md Outdated Show resolved Hide resolved
OFEP-metric-hooks.md Outdated Show resolved Hide resolved
OFEP-metric-hooks.md Outdated Show resolved Hide resolved
OFEP-metric-hooks.md Outdated Show resolved Hide resolved
Kavindu-Dodan and others added 4 commits May 22, 2023 07:30
Co-authored-by: Giovanni Liva <giovanni.liva@dynatrace.com>
Signed-off-by: Kavindu Dodanduwa <Kavindu-Dodan@users.noreply.github.com>
Co-authored-by: Giovanni Liva <giovanni.liva@dynatrace.com>
Signed-off-by: Kavindu Dodanduwa <Kavindu-Dodan@users.noreply.github.com>
Co-authored-by: Giovanni Liva <giovanni.liva@dynatrace.com>
Signed-off-by: Kavindu Dodanduwa <Kavindu-Dodan@users.noreply.github.com>
Co-authored-by: Giovanni Liva <giovanni.liva@dynatrace.com>
Signed-off-by: Kavindu Dodanduwa <Kavindu-Dodan@users.noreply.github.com>
@Kavindu-Dodan
Copy link
Contributor Author

Kavindu-Dodan commented May 22, 2023

Should we define the naming of the exposed metrics as part of this OFEP or would be this covered in the following up spec change?

Right now there's no OpenFeature spec section defining semantic conventions. So if we see the need, we will need to introduce this first (And also include span names that we already have).

Another option is to define and adhere to the names of the metrics through this OFEP and adhere to that.

@beeme1mr
Copy link
Member

I think we need an additional dimension that represents the configuration of the feature flag being evaluated. The terminology varies depending on the implementation, but many have concepts like project, workspace, namespace, or app. Within that collection, there tend to be environment-specific configurations (e.g. dev, hardening, production). Depending on the provider, you would want to split impressions based on those concepts. Perhaps we could call it a scope, and it would be up to the provider to decide what the scope looks like. This currently isn't covered by the OTel spec but should be included if we can define what the property should be called.

@Kavindu-Dodan
Copy link
Contributor Author

Kavindu-Dodan commented May 22, 2023

I think we need an additional dimension that represents the configuration of the feature flag being evaluated. The terminology varies depending on the implementation, but many have concepts like project, workspace, namespace, or app. Within that collection, there tend to be environment-specific configurations (e.g. dev, hardening, production). Depending on the provider, you would want to split impressions based on those concepts. Perhaps we could call it a scope, and it would be up to the provider to decide what the scope looks like. This currently isn't covered by the OTel spec but should be included if we can define what the property should be called.

Isn't this already covered by Evaluation Context [1], which is available through hook context [2] ? Probably the intended identifier maps to the targeting key [3] 🤔

If so, I think we can include this as a dimension of evaluationRequests metric.

[1] - https://openfeature.dev/specification/sections/evaluation-context
[2] - https://openfeature.dev/specification/sections/hooks/#41-hook-context
[3] - https://openfeature.dev/specification/sections/evaluation-context/#requirement-311

OFEP-metric-hooks.md Outdated Show resolved Hide resolved
@beeme1mr
Copy link
Member

Isn't this already covered by Evaluation Context [1], which is available through hook context [2] ? Probably the intended identifier maps to the targeting key [3] 🤔

Yes, capturing that information as flag metadata is possible but I'm wondering if we can figure out what we want to call that property.

Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
@weyert
Copy link
Contributor

weyert commented May 22, 2023

Nice, I am having some metrics: https://github.com/Tapico/node-posthog-openfeature/blob/main/src/hooks/OpenTelemetryHook.ts

Works pretty well

@Kavindu-Dodan
Copy link
Contributor Author

Kavindu-Dodan commented May 22, 2023

Isn't this already covered by Evaluation Context [1], which is available through hook context [2] ? Probably the intended identifier maps to the targeting key [3] 🤔

Yes, capturing that information as flag metadata is possible but I'm wondering if we can figure out what we want to call that property.

scope is a good enough naming. We can also use something likeevaluation_contextor targeting_key.

Anyway, we should consider about privacy into account when using context data for metric dimensions, as these identifiers may include personal information such as user emails.

@Kavindu-Dodan
Copy link
Contributor Author

Nice, I am having some metrics: https://github.com/Tapico/node-posthog-openfeature/blob/main/src/hooks/OpenTelemetryHook.ts

Works pretty well

That's nice :) If OFEP goes well, we will soon have official OpenFeature metrics hook for JS

@toddbaert
Copy link
Member

toddbaert commented May 23, 2023

Isn't this already covered by Evaluation Context [1], which is available through hook context [2] ? Probably the intended identifier maps to the targeting key [3] 🤔

Yes, capturing that information as flag metadata is possible but I'm wondering if we can figure out what we want to call that property.

scope is a good enough naming. We can also use something likeevaluation_contextor `targeting_key.

Anyway, we should consider about privacy into account when using context data for metric dimensions, as these identifiers may include personal information such as user emails.

scope is something I think we may want to consider bringing into our glossary. I think we should loosely define it as a "namespace" for flags. It could be used to logically segment environment, project, tenant, etc, since it's very possible to have flag name collisions between these.

If we think it's not too far out of scope (no pun indented) for this OFEP I'd like to agree on that here as well.

OFEP-metric-hooks.md Outdated Show resolved Hide resolved
OFEP-metric-hooks.md Outdated Show resolved Hide resolved
@Kavindu-Dodan
Copy link
Contributor Author

Isn't this already covered by Evaluation Context [1], which is available through hook context [2] ? Probably the intended identifier maps to the targeting key [3] 🤔

Yes, capturing that information as flag metadata is possible but I'm wondering if we can figure out what we want to call that property.

scope is a good enough naming. We can also use something likeevaluation_contextor `targeting_key.
Anyway, we should consider about privacy into account when using context data for metric dimensions, as these identifiers may include personal information such as user emails.

scope is something I think we may want to consider bringing into our glossary. I think we should loosely define it as a "namespace" for flags. It could be used to logically segment environment, project, tenant, etc, since it's very possible to have flag name collisions between these.

If we think it's not too far out of scope (no pun indented) for this OFEP I'd like to agree on that here as well.

Agree with the explanation & +1 for scope. And as suggested in our offline discussion, this could be pushed from the provider through flag metadata [1].

This dimension can be optional and if present will benefit drill-downs when analyzing metrics (ex:- project scoped flag evaluation dashboard)

[1] - https://github.com/open-feature/spec/blob/main/specification/types.md#flag-metadata

Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
@Kavindu-Dodan
Copy link
Contributor Author

Kavindu-Dodan commented May 23, 2023

@thisthat @beeme1mr I updated metrics names proposed through this OFEP. They now have feature_flag prefix similar to sematic convention of feature flags [1] and meaningful suffixes.

  • feature_flag.evaluation_active_count
  • feature_flag.evaluation_requests_total
  • feature_flag.evaluation_success_total
  • feature_flag.evaluation_error_total

Let me know your thoughts on this

[1] - https://opentelemetry.io/docs/specs/otel/logs/semantic_conventions/feature-flags/

Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
@toddbaert
Copy link
Member

toddbaert commented May 24, 2023

@thisthat @beeme1mr I updated metrics names proposed through this OFEP. They now have feature_flag prefix similar to sematic convention of feature flags [1] and meaningful suffixes.

  • feature_flag.evaluation_active_count
  • feature_flag.evaluation_requests_total
  • feature_flag.evaluation_success_total
  • feature_flag.evaluation_error_total

Let me know your thoughts on this

[1] - https://opentelemetry.io/docs/specs/otel/logs/semantic_conventions/feature-flags/

This looks good to me.

Copy link
Member

@toddbaert toddbaert left a comment

Choose a reason for hiding this comment

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

I'm personally of the opinion this is clear enough to merge, and can be a basis for creating issues in the various contrib repos.

I'd love to hear once more from @thisthat or @beeme1mr as well.

I also think creating a PR to our spec glossary to define scope would be nice.

OFEP-metric-hooks.md Outdated Show resolved Hide resolved
Copy link
Member

@beeme1mr beeme1mr left a comment

Choose a reason for hiding this comment

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

You should include a section on scope as a possible dimension. I think that will be required to use these metrics in a vendor-agnostic way. Once that's in place, I'm happy with the OFEP.

I'll mention this in the community meeting. If we have the approvals and no blockers, let's aim for merging this on Friday.

beeme1mr

This comment was marked as duplicate.

Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
OFEP-metric-hooks.md Outdated Show resolved Hide resolved
OFEP-metric-hooks.md Outdated Show resolved Hide resolved
OFEP-metric-hooks.md Outdated Show resolved Hide resolved
OFEP-metric-hooks.md Outdated Show resolved Hide resolved
OFEP-metric-hooks.md Outdated Show resolved Hide resolved
OFEP-metric-hooks.md Outdated Show resolved Hide resolved
OFEP-metric-hooks.md Outdated Show resolved Hide resolved
OFEP-metric-hooks.md Outdated Show resolved Hide resolved
Kavindu-Dodan and others added 7 commits May 26, 2023 08:11
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Signed-off-by: Kavindu Dodanduwa <Kavindu-Dodan@users.noreply.github.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Signed-off-by: Kavindu Dodanduwa <Kavindu-Dodan@users.noreply.github.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Signed-off-by: Kavindu Dodanduwa <Kavindu-Dodan@users.noreply.github.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Signed-off-by: Kavindu Dodanduwa <Kavindu-Dodan@users.noreply.github.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Signed-off-by: Kavindu Dodanduwa <Kavindu-Dodan@users.noreply.github.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Signed-off-by: Kavindu Dodanduwa <Kavindu-Dodan@users.noreply.github.com>
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
@toddbaert
Copy link
Member

I think we have sufficient consensus for this one. This is not a spec change, it just establishes some consistency around some of the OTel-related extensions/hooks. Merging.

OFEP-metric-hooks.md Outdated Show resolved Hide resolved
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
@toddbaert toddbaert merged commit eba37a8 into open-feature:main May 31, 2023
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.

6 participants