Skip to content

feat: expose Impression metric#556

Merged
toddbaert merged 3 commits intoopen-feature:mainfrom
thisthat:feat/501/impressions
Mar 24, 2023
Merged

feat: expose Impression metric#556
toddbaert merged 3 commits intoopen-feature:mainfrom
thisthat:feat/501/impressions

Conversation

@thisthat
Copy link
Copy Markdown
Member

This PR

  • Introduces Impressions split by Flag Key and Variant as a Prometheus Metric exposed via OpenTelemetry

Related Issues

Fixes #501

How to test

Run flagd via make run
Run

curl -X POST "localhost:8013/schema.v1.Service/ResolveString" -d '{"flagKey":"fibAlgo","context":{}}' -H "Content-Type: application/json"
curl -X POST "localhost:8013/schema.v1.Service/ResolveString" -d '{"flagKey":"myStringFlag","context":{}}' -H "Content-Type: application/json"

Open http://localhost:8014/metrics and see something like the following

# HELP impressions_total The number of evaluation for a given flag
# TYPE impressions_total counter
impressions_total{feature_flag_key="fibAlgo",feature_flag_provider_name="flagd",feature_flag_variant="recursive",otel_scope_name="openfeature/flagd",otel_scope_version=""} 3
impressions_total{feature_flag_key="myString",feature_flag_provider_name="flagd",feature_flag_variant="",otel_scope_name="openfeature/flagd",otel_scope_version=""} 1
impressions_total{feature_flag_key="myStringFlag",feature_flag_provider_name="flagd",feature_flag_variant="key1",otel_scope_name="openfeature/flagd",otel_scope_version=""} 3

@thisthat thisthat requested a review from a team March 24, 2023 08:02
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 24, 2023

Codecov Report

Merging #556 (eaa0be3) into main (78adb81) will increase coverage by 0.63%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #556      +/-   ##
==========================================
+ Coverage   69.77%   70.40%   +0.63%     
==========================================
  Files          19       19              
  Lines        2111     2156      +45     
==========================================
+ Hits         1473     1518      +45     
  Misses        578      578              
  Partials       60       60              
Impacted Files Coverage Δ
core/pkg/otel/metrics.go 100.00% <100.00%> (ø)
core/pkg/service/flag-evaluation/flag_evaluator.go 68.34% <100.00%> (+6.52%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Copy Markdown
Contributor

@james-milligan james-milligan left a comment

Choose a reason for hiding this comment

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

LGTM, just needs the linting fix 👍

@beeme1mr beeme1mr self-requested a review March 24, 2023 13:07
Comment thread core/pkg/service/flag-evaluation/flag_evaluator.go
Comment thread core/pkg/service/flag-evaluation/flag_evaluator_test.go
@toddbaert toddbaert self-requested a review March 24, 2023 16:09
Copy link
Copy Markdown
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.

Approved.

@thisthat please let me know your thoughts about this.

Comment thread core/pkg/service/flag-evaluation/flag_evaluator.go
Signed-off-by: Giovanni Liva <giovanni.liva@dynatrace.com>
Signed-off-by: Giovanni Liva <giovanni.liva@dynatrace.com>
Signed-off-by: Giovanni Liva <giovanni.liva@dynatrace.com>
@toddbaert toddbaert force-pushed the feat/501/impressions branch from 4d09d6c to eaa0be3 Compare March 24, 2023 16:22
@toddbaert toddbaert merged commit 77e0a33 into open-feature:main Mar 24, 2023
@github-actions github-actions Bot mentioned this pull request Mar 24, 2023
toddbaert added a commit that referenced this pull request Mar 30, 2023
🤖 I have created a release *beep* *boop*
---


<details><summary>flagd: 0.5.0</summary>

##
[0.5.0](flagd/v0.4.5...flagd/v0.5.0)
(2023-03-30)


### ⚠ BREAKING CHANGES

* unify sources configuration handling
([#560](#560))

### 🐛 Bug Fixes

* benchmark pipeline
([#538](#538))
([62cc0fc](62cc0fc))
* **deps:** update module github.com/open-feature/flagd/core to v0.4.5
([#552](#552))
([41799f6](41799f6))


### 🧹 Chore

* refactor configuration handling for startup
([#551](#551))
([8dfbde5](8dfbde5))
</details>

<details><summary>flagd-proxy: 0.2.0</summary>

##
[0.2.0](flagd-proxy-v0.1.2...flagd-proxy/v0.2.0)
(2023-03-30)


### ⚠ BREAKING CHANGES

* rename `kube-flagd-proxy` to `flagd-proxy`
([#576](#576))

### ✨ New Features

* rename `kube-flagd-proxy` to `flagd-proxy`
([#576](#576))
([223de99](223de99))
</details>

<details><summary>core: 0.5.0</summary>

##
[0.5.0](core/v0.4.5...core/v0.5.0)
(2023-03-30)


### ⚠ BREAKING CHANGES

* rename `kube-flagd-proxy` to `flagd-proxy`
([#576](#576))
* unify sources configuration handling
([#560](#560))

### 🧹 Chore

* move credential builder for grpc sync into seperate component
([#536](#536))
([7314fee](7314fee))
* refactor configuration handling for startup
([#551](#551))
([8dfbde5](8dfbde5))
* refactor middleware setup in server
([#554](#554))
([01016c7](01016c7))
* refactor service configuration objects
([#545](#545))
([c7b29ed](c7b29ed)),
closes [#524](#524)
* unify sources configuration handling
([#560](#560))
([7f4888a](7f4888a))


### 🐛 Bug Fixes

* **deps:** update module google.golang.org/grpc to v1.54.0
([#548](#548))
([99ba5ec](99ba5ec))
* **deps:** update module sigs.k8s.io/controller-runtime to v0.14.6
([#572](#572))
([bed9458](bed9458))
* fixing silent lint failures
([#550](#550))
([30c8022](30c8022))
* nil pointer fix + export constructors
([#555](#555))
([78adb81](78adb81))


### ✨ New Features

* expose Impression metric
([#556](#556))
([77e0a33](77e0a33))
* Introduce kube-proxy-metrics
([#558](#558))
([ad0baeb](ad0baeb))
* rename `kube-flagd-proxy` to `flagd-proxy`
([#576](#576))
([223de99](223de99))
* refactor core module into multiple packages
([#530](#530))
([9d68d0b](9d68d0b))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Signed-off-by: Todd Baert <toddbaert@gmail.com>
Co-authored-by: Todd Baert <toddbaert@gmail.com>
@github-actions github-actions Bot mentioned this pull request Dec 2, 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.

Expose "impressions" as OTel Metric

5 participants