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

fix: add env and project labels to feature updated metrics. #2043

Merged
merged 5 commits into from
Sep 8, 2022

Conversation

ivarconr
Copy link
Member

@ivarconr ivarconr commented Sep 5, 2022

About the changes

Adds environment and project labels to feature updated metrics. It makes it easier to monitor usage of Unleash in larger deployments.

@github-actions
Copy link

github-actions bot commented Sep 5, 2022

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements
88.75% (-2.62% 🔻)
6850/7718
🟡 Branches 79.23% 1091/1377
🟢 Functions
82.42% (-3.81% 🔻)
1927/2338
🟢 Lines
89.11% (-2.2% 🔻)
6347/7123

⚠️ Details were not displayed: the report size has exceeded the limit.

Test suite run success

1144 tests passing in 188 suites.

Report generated by 🧪jest coverage report action from 7ca517f

Copy link
Contributor

@chriswk chriswk left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@gardleopard gardleopard left a comment

Choose a reason for hiding this comment

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

This doesnt work in my local env. I have tried flipping a kill switch multiple times with no luck
http://localhost:4242/internal-backstage/prometheus


# HELP feature_toggle_update_total Number of times a toggle has  been updated
# TYPE feature_toggle_update_total counter

# HELP feature_toggle_usage_total Number of times a feature toggle has been used
# TYPE feature_toggle_usage_total counter

# HELP feature_toggles_total Number of feature toggles
# TYPE feature_toggles_total gauge
feature_toggles_total{version="4.15.0-beta.9"} 1

# HELP users_total Number of users
# TYPE users_total gauge
users_total 2

# HELP projects_total Number of projects
# TYPE projects_total gauge
projects_total 1

@gardleopard
Copy link
Contributor

Works for normal toggles, but the "n/a" environment is strange as well

# HELP feature_toggle_update_total Number of times a toggle has  been updated
# TYPE feature_toggle_update_total counter
feature_toggle_update_total{toggle="testSwitch",project="default",environment="n/a"} 1
feature_toggle_update_total{toggle="testSwitch",project="default",environment="development"} 1
feature_toggle_update_total{toggle="testSwitch",project="default",environment="production"} 1

@gardleopard
Copy link
Contributor

is feature toggle update total intended to increase for every time we change the status as well? If that is supposed to happen, there is some flaw there as well

@ivarconr
Copy link
Member Author

ivarconr commented Sep 6, 2022

Works for normal toggles, but the "n/a" environment is strange as well

# HELP feature_toggle_update_total Number of times a toggle has  been updated
# TYPE feature_toggle_update_total counter
feature_toggle_update_total{toggle="testSwitch",project="default",environment="n/a"} 1
feature_toggle_update_total{toggle="testSwitch",project="default",environment="development"} 1
feature_toggle_update_total{toggle="testSwitch",project="default",environment="production"} 1

The problem is that some "updates" is not done for an environment (e.g creating a toggle, archiving it, etc). In those scenarios we have no environment to be set as label. The prometheus client fails hard if we do not specify the label value when it is configured.

@ivarconr
Copy link
Member Author

ivarconr commented Sep 6, 2022

This doesnt work in my local env. I have tried flipping a kill switch multiple times with no luck

This does not make sense. A kill switch is not different from a normal toggle. It is just the type.

@ivarconr
Copy link
Member Author

ivarconr commented Sep 7, 2022

Works for normal toggles, but the "n/a" environment is strange as well

would you prefer "undefined"?

@Unleash Unleash deleted a comment from vercel bot Sep 7, 2022
@gardleopard
Copy link
Contributor

I think your explanation is good here, so n/a is a valid case here:)

@vercel
Copy link

vercel bot commented Sep 8, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Ignored Deployments
Name Status Preview Updated
unleash ⬜️ Ignored (Inspect) Sep 8, 2022 at 8:21AM (UTC)
unleash-docs ⬜️ Ignored (Inspect) Sep 8, 2022 at 8:21AM (UTC)
unleash-monorepo-frontend ⬜️ Ignored (Inspect) Sep 8, 2022 at 8:21AM (UTC)

Copy link
Contributor

@gardleopard gardleopard left a comment

Choose a reason for hiding this comment

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

Now it looks good!

feature_toggle_update_total{toggle="dummy",project="default",environment="development"} 4
feature_toggle_update_total{toggle="dummy",project="default",environment="production"} 2
feature_toggle_update_total{toggle="dummy2",project="default",environment="n/a"} 1
feature_toggle_update_total{toggle="dummy2",project="default",environment="development"} 3
feature_toggle_update_total{toggle="dummy2",project="default",environment="production"} 2
feature_toggle_update_total{toggle="testToggle",project="default",environment="production"} 8
feature_toggle_update_total{toggle="testToggle",project="default",environment="development"} 2

@ivarconr ivarconr merged commit a7ed755 into main Sep 8, 2022
@ivarconr ivarconr deleted the fix/labels-to-usage-metrics branch September 8, 2022 09:01
andreas-unleash added a commit that referenced this pull request Sep 14, 2022
* PublicSignupTokens

* bug fix

* bug fixes and test

* bug fixes and test

* bug fixes and test

* Add feature flag

* tests

* tests

* Update 20220908093515-add-public-signup-tokens.js

Bug Fix

* task: use swc instead of ts-jest (#2042)

* Add a counter for total number of environments (#1964)

* add groupId to gradual rollout template (#2045)

* add groupId to gradual rollout template

* FMT

* Improve tabs UI on smaller devices (#2014)

* Improve tabs UI on smaller devices

* Improve tabs UI on smaller devices

* bug fix

* add proper scrollable tabs

* removed centered from Tabs (conflicts with scrollable)

* PR comments

* 4.15.0-beta.10

* Fix broken doc links (#2046)

## What

This PR fixes some broken links that have been hanging around in the
docs for what seems like a very long time.

## Why

As discovered by the link check in #1912, there are a fair few broken
links in the docs. Everyone hates broken links because it makes it
harder to understand what they were supposed to be pointing at.

## How

There are 3 types of links that have been fixed:
- Links that should have been internal but were absolute. E.g.
  `https://docs.getunleash.io/path/article` that should have been
  `./article.md`
- External links that have changed, such as Slack's API description
- GitHub links to files that either no longer exist or that have been
  moved. These links generally pointed to `master`/`main`, meaning
  they are subject to change. They have been replaced with permalinks
  pointing to specific commits.

-----

* docs: fix slack api doc link

* docs: update links in migration guide

* docs: fix broken link to ancient feature schema validation

* docs: update links to v3 auth hooks

* docs: update broken link in the go sdk article

* Fix: use permalink for GitHub link

* docs: fix wrong google auth link

* 4.15.0

* 4.15.1

* docs: update link for symfony sdk (#2048)



The doc link appears to have pointed at an address that is no longer reachable. Instead, let's point to the equivalent GitHub link

Relates to and closes #2047

* docs: test broken links in website (#1912)

The action triggers manually as a first step to test this functionality. In the near future, we might schedule it

* Schedule link checker action (#2050)

Runs at 12:30 UTC on Mon, Tue, Wed, Thu and Fri

* fix: add env and project labels to feature updated metrics. (#2043)

* Revert workflow (#2051)

* update snapshot

* PR comments

* Added Events and tests

* Throw error if token not found

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
Co-authored-by: Gastón Fournier <gaston@getunleash.ai>
Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
Co-authored-by: sjaanus <sellinjaanus@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants