1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +01:00
Commit Graph

366 Commits

Author SHA1 Message Date
Mateusz Kwasniewski
7996f12974
docs: seam explanation (#3147) 2023-02-20 07:51:44 +01:00
Mateusz Kwasniewski
f0c9f8b08b
feat: oss import (#3123) 2023-02-16 08:08:51 +01:00
Gastón Fournier
f8d30850e5
Network view not experimental (#3124)
## About the changes
Promoted experimental networkView flag into a configuration that relies
on prometheusApi being configured.

Also, a follow-up on https://github.com/Unleash/unleash/pull/3054 moving
this code to enterprise because it doesn't make sense to maintain this
code in OSS where it's not being used.
2023-02-15 16:24:57 +01:00
Jaanus Sellin
5574d27861
feat: Instance stats for export/import (#3121)
feat: instance stats for export/import
2023-02-15 14:39:16 +02:00
Mateusz Kwasniewski
e06ecab642
feat: extract custom context fields from all possible locations (#3118) 2023-02-15 10:26:19 +01:00
Gastón Fournier
7a242ecf2a
chore: add bulk endpoint for metrics and app registration for edge (#3079)
## About the changes
Implementation of bulk metrics and registration endpoint. This will be
used by edge nodes to send all collected information.

Types around metrics were improved and `IClientApp.bucket` with type
`any` is no longer needed

---------

Co-authored-by: sighphyre <liquidwicked64@gmail.com>
2023-02-15 09:13:32 +01:00
Jaanus Sellin
8e38ebf1a7
fix: also export context fields used for stickiness (#3106) 2023-02-15 08:44:59 +01:00
Mateusz Kwasniewski
b1728c5fe2
feat: Export segments limited info (#3109) 2023-02-14 15:35:10 +01:00
Nuno Góis
8729f082d2
refactor: remove variants per environment feature flag (#3102)
https://linear.app/unleash/issue/2-428/clean-up-feature-flag-once-were-done-with-the-migration

Cleans up the variants per environment feature flag due to GA.
2023-02-14 14:02:02 +00:00
Fredrik Strand Oseberg
9cc7b8fdeb
fix: replace assert with error (#3074)
This PR changes the behavior of checking the incoming token on the
`/api/frontend` path. Instead of using assert resulting in a 500 error
we are throwing an error that is caught by the default controller and
emitted back to the user as JSON.

This should be the correct behaviour, since the endpoint can not give
you any meaningful data without the environment that the API token
holds.
2023-02-13 08:40:04 +01:00
renovate[bot]
6e44a65c58
fix(deps): update dependency unleash-client to v3.18.0 (#2956)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [unleash-client](https://togithub.com/Unleash/unleash-client-node) |
[`3.16.1` ->
`3.18.0`](https://renovatebot.com/diffs/npm/unleash-client/3.16.1/3.18.0)
|
[![age](https://badges.renovateapi.com/packages/npm/unleash-client/3.18.0/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/npm/unleash-client/3.18.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/npm/unleash-client/3.18.0/compatibility-slim/3.16.1)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/npm/unleash-client/3.18.0/confidence-slim/3.16.1)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>Unleash/unleash-client-node</summary>

###
[`v3.18.0`](https://togithub.com/Unleash/unleash-client-node/blob/HEAD/CHANGELOG.md#&#8203;3180)

[Compare
Source](https://togithub.com/Unleash/unleash-client-node/compare/v3.17.0...v3.18.0)

feat: gracefully handle unsuccessful metrics post
([#&#8203;414](https://togithub.com/Unleash/unleash-client-node/issues/414))
feat/flush metrics
([#&#8203;415](https://togithub.com/Unleash/unleash-client-node/issues/415))
feat: add metrics jitter support
([#&#8203;412](https://togithub.com/Unleash/unleash-client-node/issues/412))
fix: Allow SDK to startup when backup data is corrupt
([#&#8203;418](https://togithub.com/Unleash/unleash-client-node/issues/418))
fix: flexible-rollout random stickiness is not random enough
([#&#8203;417](https://togithub.com/Unleash/unleash-client-node/issues/417))
fix: build correct version on npm version
chore(deps): update dependency eslint-plugin-import to v2.27.5
([#&#8203;416](https://togithub.com/Unleash/unleash-client-node/issues/416))
chore(deps): update dependency
[@&#8203;typescript-eslint/eslint-plugin](https://togithub.com/typescript-eslint/eslint-plugin)
to v5.48.2
([#&#8203;413](https://togithub.com/Unleash/unleash-client-node/issues/413))
chore(deps): update dependency eslint to v8.32.0
([#&#8203;410](https://togithub.com/Unleash/unleash-client-node/issues/410))
chore(deps): update dependency prettier to v2.8.3
([#&#8203;406](https://togithub.com/Unleash/unleash-client-node/issues/406))
chore(deps): update dependency eslint-plugin-import to v2.27.4
([#&#8203;404](https://togithub.com/Unleash/unleash-client-node/issues/404))

###
[`v3.17.0`](https://togithub.com/Unleash/unleash-client-node/blob/HEAD/CHANGELOG.md#&#8203;3170)

[Compare
Source](https://togithub.com/Unleash/unleash-client-node/compare/v3.16.1...v3.17.0)

- feat: Only initialize the SDK once.
([#&#8203;368](https://togithub.com/Unleash/unleash-client-node/issues/368))
-   fix: upgrade semver to 7.3.8
-   fix: add resolution for debug
-   fix: add resolution for minimatch
-   fix: add resolution for qs
-   fix: add resolution for json5
-   fix: update yarn.lock
- docs: Update the readme with info from docs.getunleash
([#&#8203;399](https://togithub.com/Unleash/unleash-client-node/issues/399))
-   docs: minor fix in README
- chore(deps): update dependency debug to v4
([#&#8203;402](https://togithub.com/Unleash/unleash-client-node/issues/402))
- chore(deps): update dependency json5 to v2
([#&#8203;401](https://togithub.com/Unleash/unleash-client-node/issues/401))
- chore(deps): update dependency eslint to v8.31.0
([#&#8203;394](https://togithub.com/Unleash/unleash-client-node/issues/394))
- chore(deps): update dependency nock to v13.3.0
([#&#8203;400](https://togithub.com/Unleash/unleash-client-node/issues/400))
- chore(deps): update dependency
[@&#8203;typescript-eslint/eslint-plugin](https://togithub.com/typescript-eslint/eslint-plugin)
to v5.48.1
([#&#8203;395](https://togithub.com/Unleash/unleash-client-node/issues/395))
- chore(deps): update dependency eslint-config-prettier to v8.6.0
([#&#8203;396](https://togithub.com/Unleash/unleash-client-node/issues/396))
- chore(deps): update dependency prettier to v2.8.2
([#&#8203;398](https://togithub.com/Unleash/unleash-client-node/issues/398))
- chore(deps): update dependency
[@&#8203;typescript-eslint/eslint-plugin](https://togithub.com/typescript-eslint/eslint-plugin)
to v5.47.1
([#&#8203;346](https://togithub.com/Unleash/unleash-client-node/issues/346))
- chore(deps): update dependency typescript to v4.9.4
([#&#8203;386](https://togithub.com/Unleash/unleash-client-node/issues/386))
- chore(deps): update dependency sinon to v15
([#&#8203;391](https://togithub.com/Unleash/unleash-client-node/issues/391))
- chore(deps): update dependency
[@&#8203;types/node](https://togithub.com/types/node) to v18
([#&#8203;380](https://togithub.com/Unleash/unleash-client-node/issues/380))
- chore(deps): update dependency
[@&#8203;types/node](https://togithub.com/types/node) to v14.18.36
([#&#8203;382](https://togithub.com/Unleash/unleash-client-node/issues/382))
- chore(deps): update dependency eslint to v8.30.0
([#&#8203;367](https://togithub.com/Unleash/unleash-client-node/issues/367))
- chore(deps): update dependency prettier to v2.8.1
([#&#8203;387](https://togithub.com/Unleash/unleash-client-node/issues/387))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/Unleash/unleash).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xMDUuNCIsInVwZGF0ZWRJblZlciI6IjM0LjExNy4xIn0=-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Ivar Conradi Østhus <ivar@getunleash.ai>
2023-02-10 10:51:53 +01:00
Jaanus Sellin
8ee9b75e48
Add option to run unleash in strict schema validation (#3073)
feat: strict schema validation
2023-02-09 15:21:03 +02:00
Gastón Fournier
b76e66fc1d
fix: make sure we have a user in event store (#3072)
## About the changes
Spotted some issues in logs:
```json
{
  "level":"warn",
  "message":"Failed to store \"feature-environment-variants-updated\" event: error: insert into \"events\" (\"created_by\", \"data\", \"environment\", \"feature_name\", \"pre_data\", \"project\", \"tags\", \"type\") values (DEFAULT, $1, $2, $3, $4, $5, $6, $7) returning \"id\", \"type\", \"created_by\", \"created_at\", \"data\", \"pre_data\", \"tags\", \"feature_name\", \"project\", \"environment\" - null value in column \"created_by\" violates not-null constraint",
  "name":"lib/db/event-store.ts"
}
```

In all other events we're doing the following:
b7fdcd36c0/src/lib/services/segment-service.ts (L80)

So this is just mimicking that to quickly release a patch, but I'll look
into a safer (type-checked) solution so this problem does not happen
again
2023-02-09 11:01:39 +01:00
Ivar Conradi Østhus
07e8a351bb
Fix/show tag events (#3064)
This PR fixes two issues with events today:

1. Feature toggles "Event log" must include all events, regardless of
the project. This is important as feature toggles may move between
2. Add/remove tags on a feature toggle events should include project id
in order to show up in the project specific event log.
2023-02-08 19:57:21 +01:00
Thu Vo
3387e6fc39
JSON stringify errors to view more info of params (#3033) 2023-02-07 09:21:09 +01:00
Tymoteusz Czech
0656fddbc4
Refactor: Project Overview fetching (#3035) 2023-02-07 08:57:28 +01:00
Tymoteusz Czech
ab9712812a
Project health tests (#3028) 2023-02-02 12:01:16 +01:00
Ivar Conradi Østhus
627958d30f
feat/enable_batch_metrics_for_all (#3027)
Batch Metrics as a capability developed to support the frontend API to
handle more metrics from SDKs without overloading the DB to much. It has
been running in Unleash Cloud for months and has proven to work quite
nice.

This PR simply removes the flag to make the capability GA, also for
self-hosted users.
2023-02-01 20:50:17 +01:00
sjaanus
daa4041d03
Export tag types (#3026)
Adds a simple functionality to export also tag types.
2023-02-01 13:14:49 +02:00
Mateusz Kwasniewski
dc8c95702f
Schedule health report (#3025) 2023-01-31 13:35:16 +01:00
Tymoteusz Czech
59e8e2b1ed
refactor: project health domain (#3024) 2023-01-31 13:08:20 +01:00
sjaanus
ab5da2116a
Remove timeout from store (#3018) 2023-01-30 12:01:44 +01:00
Mateusz Kwasniewski
d9110b6ce5
refactor: separate scheduling from DI (#3017) 2023-01-30 11:13:17 +01:00
Fredrik Strand Oseberg
1c4ba4cc97
Feat/project stats types (#3012)
Update type for project stats
2023-01-27 17:19:27 +01:00
Fredrik Strand Oseberg
897e97330a
Feat/project stats members (#3009)
This PR adds project members to the project stats and connects the stats
to the UI.
2023-01-27 13:13:41 +01:00
Mateusz Kwasniewski
f8473a243f
exclude tags for other features (#3007) 2023-01-27 11:34:20 +01:00
Fredrik Strand Oseberg
d8a250dc9c
Feat/project status monthly (#2986)
This PR takes the project status API a step further by adding the
capability of providing a date to control the selection. We are
currently making calculations based on a gliding 30 day window, updated
once a day. The initial database structure and method for updating the
UI is outlined in this PR.
2023-01-26 16:13:15 +01:00
Mateusz Kwasniewski
6b9a242be5
upload limit and import ui tweaks (#2998) 2023-01-26 12:36:45 +01:00
Mateusz Kwasniewski
527ed5feaf
filter out unused fields as they fail import validation (#2997) 2023-01-26 09:48:10 +01:00
Mateusz Kwasniewski
decb7f320d
feat: import stage (#2985) 2023-01-25 12:34:28 +01:00
Mateusz Kwasniewski
80c444aa99
cleanup in export and import (#2973) 2023-01-24 14:29:59 +01:00
Christopher Kolstad
c961374b24
task: changing variants blocked by cr (#2966)
## About the changes
This PR adds two new functions that is protected by CR. When used
instead of the current setVariantOnEnv and setVariantsOnEnv if the flag
UNLEASH_EXPERIMENTAL_CR_ON_VARIANTS is set, the call is blocked. This
leaves the old functions, which is used from the CR flow in place, and
adds new methods protected by CR.

Also adds e2e tests verifying that the methods will block requests if CR
is enabled for project:environment pair, as well as not block if CR is
not enabled. Tests already in place should confirm that the default
flow, without the flag enabled just works.
2023-01-24 10:43:10 +01:00
Nuno Góis
ccfc046937
feat: adds the PAT_DELETE event (#2965)
<img width="973" alt="image"
src="https://user-images.githubusercontent.com/14320932/214047789-830adae4-daf1-4761-9b77-a49c9b92d0d8.png">

Adds the `PAT_DELETE` event so we can log the relevant information when
a PAT is deleted.

Should cover the following scenarios:

- User deletes their own PAT;
- Admin deletes another user's PAT;
- Admin deletes a Service Account token;
2023-01-23 15:11:16 +02:00
Gastón Fournier
96c65fc10d
feat: Add ability to push variants to multiple environments (#2914)
## About the changes
This PR adds the ability to push variants to multiple environments
overriding the existing variants.

Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#2254

**Note:** This won't fail if there are variants in other environments, because the operation wouldn't be idempotent. It should have that property because setting variants to 1 or more environments once or twice should not make a difference
2023-01-20 10:30:20 +01:00
Fredrik Strand Oseberg
f4d857285b
feat: status API (#2931)
Initial status API
2023-01-19 13:27:50 +01:00
Nuno Góis
7d73d772df
feat: add the account abstraction logic (#2918)
https://linear.app/unleash/issue/2-579/improve-user-like-behaviour-for-service-accounts-accounts-concept

Builds on top of https://github.com/Unleash/unleash/pull/2917 by moving
the responsibility of handling both account types from `users` to
`accounts`.

Ideally:
 - `users` - Should only handle users;
 - `service-accounts` - Should only handle service accounts;
 - `accounts` - Should handle any type of account;

This should hopefully also provide a good building block in case we
later decide to refactor this further down the `accounts` path.
2023-01-18 16:08:07 +00:00
Fredrik Strand Oseberg
89163b8719
refactor/clean-up-get-project (#2925)
This PR moves the getProjectOverview method out from the project health
controller. It doesn't make sense that this method lives here anymore,
as over time it has grown into method that relays all information about
a single project. It makes more sense that this now lives on the root of
the project api. Also removes unwanted duplication of getProjectOverview
from the project-service and the project-health-service.
2023-01-18 13:22:58 +01:00
Nuno Góis
d63b3c69fe
feat: adapt user logic to better adapt to SAs (#2917)
https://linear.app/unleash/issue/2-579/improve-user-like-behaviour-for-service-accounts-accounts-concept

<img width="803" alt="image"
src="https://user-images.githubusercontent.com/14320932/213011584-75870595-988d-49bc-a7bf-cd1ffd146bca.png">

Makes SAs behave more like users. 

Even though they share the same `users` database table, the `is_service`
column distinguishes them. This PR makes the distinction a bit less
obvious by not filtering out SAs for some methods in the user store,
returning both account types and their respective account type
information so we can handle them properly on the UI.

We felt like this was a good enough approach for now, and a decent
compromise to move SAs forward. In the future, we may want to make a
full refactor with the `accounts` concept in mind, which we've
experimented with in the
[accounts-refactoring](https://github.com/Unleash/unleash/tree/accounts-refactoring)
branches (both OSS and Enterprise).
 
https://github.com/Unleash/unleash/pull/2918 - Moves this a bit further,
by introducing the account service and store.
2023-01-18 12:12:44 +00:00
sjaanus
16bca1260c
Segment export (#2922)
Segment export
2023-01-18 10:41:22 +02:00
sjaanus
b895c99743
Export features (#2905) 2023-01-17 13:10:20 +02:00
Gastón Fournier
005e5b1d15
fix: found an edge case exporting variants (#2900)
## About the changes
When exporting v3, for variants backward compatibility, we need to find
one featureEnvironment and fetch variants from there.
In cases where the default environment is disabled (therefore does not
get variants per environment when added), it can be still be selected
for the export process. Therefore variants don't appear in the feature
when they should be there.

An e2e test that fails with the previous implementation was added to
validate the behavior

This comes from our support ticket 404
2023-01-13 14:55:57 +01:00
Mateusz Kwasniewski
5569101f30
feat: import feature strategies (#2885) 2023-01-12 15:24:34 +01:00
Gastón Fournier
ce815e5f29
feat: report app names only if below a threshold (#2737)
## About the changes
Introduce a snapshot version of instanceStats inside
instance-stats-service to provide a cached state of the statistics
without compromising the DB.

### Important notes
Some rule-of-thumb applied in the PR that can be changed:
1. The snapshot refresh time
2. The threshold to report appName with the metrics

## Discussion points
1. The snapshot could be limited to just the information needed (things
like `hasOIDC` don't change until there's a restart), to optimize the memory usage
3. metrics.ts (used to expose Prometheus metrics) has a [refresh
interval of
2hs](2d16730cc2/src/lib/metrics.ts (L189-L195)),
but with this implementation, we could remove that background task and
rely on the snapshot
4. We could additionally update the snapshot every time someone queries
the DB to fetch stats (`getStats()` method), but it may increase
complexity without a significant benefit

Co-authored-by: Mateusz Kwasniewski <kwasniewski.mateusz@gmail.com>
Co-authored-by: Simon Hornby <liquidwicked64@gmail.com>
2023-01-12 11:26:59 +01:00
Mateusz Kwasniewski
be1762d33f
Scheduler abstraction (#2829) 2023-01-11 16:15:53 +01:00
sjaanus
eb7e82dff2
Export with strategies (#2877) 2023-01-11 15:00:20 +00:00
Mateusz Kwasniewski
afdcd45042
feat: first skeleton of the batch import (#2868)
First skeleton of batch import:
* injecting feature toggle service because I want to reuse logic and not
just the store
2023-01-11 15:19:16 +01:00
sjaanus
f3f3a59e5e
Import export (#2865) 2023-01-10 15:59:02 +02:00
Gastón Fournier
58dd09f3e1
fix: export features with variants event when feature is disabled (#2824)
## About the changes
When exporting features one is normally also interested in disabled
features, so they are also included in the export file, while the
variants are not. I do not see a good reason for that, so this PR
removes the check and exports the variants then as well.
I could also add an option as well, but as long as there is no good
reason for ignoring the variants I would just export them with the
features.

This PR adds tests on #2719

Closes #2719

Co-authored-by: Martin Joehren <martin.joehren@esailors.de>
2023-01-05 12:30:07 +02:00
Ivar Conradi Østhus
3a8107ce6e
fix: state-service should always keep api keys (#2552)
We have experienced side-effects where the import was unexpected and
resulted in environments thought to be removed. This had the unexpected
side-effect of also deleting API keys for some environments not part of
the import file.

This commit removes the ability of the state-service to mutate api keys
directly. There is no compelling reasons why we should remove API keys
as part of an import query.

Co-authored-by: Gastón Fournier <gaston@getunleash.ai>
Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2023-01-04 11:24:34 +00:00
Gastón Fournier
bf77182ca7
feat: limit the amount of results coming from Prometheus (#2776)
## About the changes
To avoid showing too much data in the traffic screen, limit the number
of results to `topk`.

## Discussion points
Top 10 is a rule of thumb, but maybe we could do top 25. Until we gather
more data, I believe this should be good enough
2023-01-04 11:00:04 +01:00