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

467 Commits

Author SHA1 Message Date
Fredrik Strand Oseberg
354e54a356
fix: count events instead of loading them in memory (#3382)
Refactor project events to use count instead of loading the events in
memory
2023-03-27 11:24:01 +02:00
Christopher Kolstad
49fbf4a635
task: enclose ETag in double quotes. (#3385)
According to the
[RFC](https://www.rfc-editor.org/rfc/rfc7232#section-2.3) Etags should
be enclosed in double quotes. This PR makes sure we do actually wrap it
in double quotes
2023-03-24 16:11:42 +01:00
Mateusz Kwasniewski
ab913228ca
refactor: read model for change request access checking (#3380) 2023-03-24 14:31:43 +01:00
Gastón Fournier
a79a76f497
refactor: test composition and other error codes (#3348)
## About the changes
Small refactor to showcase how to use [composition to validate different
aspects of the
response](https://github.com/Unleash/unleash/pull/3348/files#diff-ee4c1bd501b1195162b7a85ed6be348a665288f871abc8e74f64d94361213f9eR361-R367)
and checking [different status
codes](https://github.com/Unleash/unleash/pull/3348/files#diff-4044a5da3280ef76960bbffd5f36eccb395ac319fe58c4d59ef68a878cbb1a5dR95)
2023-03-23 16:31:05 +01:00
Mateusz Kwasniewski
57f42b5629
feat: collaboration mode API cleanup (#3357) 2023-03-23 14:13:34 +01:00
Nuno Góis
27d48b3437
Feat segments project safeguards (#3359)
https://linear.app/unleash/issue/2-811/ability-to-move-project-specific-segments


![image](https://user-images.githubusercontent.com/14320932/226572047-19ed225c-13d5-4f2e-b10f-e17a7f7e6ae7.png)

Provides some safeguards to project-specific segments when managing them
on a global level (segments page):
- You can always promote a segment to global;
- You can't specify a project if the segment is currently in use in
multiple projects;
- You can't specify a different project if the segment is currently
already in use in a project;
2023-03-21 20:28:43 +00:00
Mateusz Kwasniewski
902ebefe7e
feat: support updating existing projects without existing settings (#3358) 2023-03-21 10:32:09 +01:00
Gastón Fournier
af42347a7b
chore: PoC test API helper (DRY) (#3342)
## About the changes
New way of centralizing API calls while doing E2E tests to avoid repeating ourselves.
2023-03-20 10:27:19 +01:00
Jaanus Sellin
d28e65b94c
feat: revive features (#3344) 2023-03-17 18:21:13 +00:00
Ivar Conradi Østhus
dc5b53fa4d
Poc: calculate etag based on query and latest revison id (#3062)
This is very much POC and WIP
2023-03-17 14:10:21 +01:00
andreas-unleash
32e1ad44ed
Feat/add cypress tests for project scoped stickiness (#3340)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->


## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-03-17 14:41:59 +02:00
Gastón Fournier
7a9ea22eed
feat: project-specific segments tests and fixes (#3339)
## About the changes
- Refactored some E2E tests to use our APIs
- Added test cases for project-specific segments
- Added validation to check a project can access a specific segment
- Fixed an OpenAPI schema that was missing segments

## Discussion points
https://github.com/Unleash/unleash/pull/3339/files#r1140008992
2023-03-17 12:43:34 +01:00
Fredrik Strand Oseberg
e2ad0cae45
fix: refactor calculate time to prod (#3333)
This PR changes how we calculate average time to production. Instead of
calculating fleeting 30 day windows and calculating the past and current
window, we now calculate a flat average across the entire project life.
This is less error prone as each feature will be tied to the earliest
time it was turned on in a production environment.
2023-03-16 15:45:24 +01:00
Mateusz Kwasniewski
1064dfa40c
feat: project mode (#3334) 2023-03-16 15:29:52 +01:00
andreas-unleash
edd12709ef
fix: remove proxy return all toggles functionality (#3331)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->
This PR removes the return all toggles functionality. Removes the flag
as well
## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #
[1-778](https://linear.app/unleash/issue/1-778/remove-proxyalltoggles-functionality)

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-03-16 14:00:18 +02:00
Jaanus Sellin
d94dd31677
feat: refactor archive (#3330) 2023-03-16 10:26:02 +02:00
Jaanus Sellin
138ac98094
feat: bulk revive features (#3321) 2023-03-16 09:51:18 +02:00
andreas-unleash
933455e308
feat: use api instead of localStorage (#3305)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->
This PR replaces localStorage with api calls for getting/setting project
scoped stickiness
## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-03-15 16:06:25 +02:00
Gastón Fournier
1d0bc833b3
chore: refactor segments to stop depending on the implementation (#3315)
## About the changes
- Introducing ISegmentService interface to decouple from the actual
implementation
- Moving UpsertSegmentSchema to OSS to be able to use types
- Added comments where our code is coupled with segments just to
highlight and have a conversation about some use cases if needed, but
they can be removed before merging
- Removed segment service from some project features as it was not used
2023-03-15 14:58:19 +01:00
Mateusz Kwasniewski
d9e3ff9cd4
refactor: move project membership check from access to project (#3322) 2023-03-15 14:44:08 +01:00
Jaanus Sellin
a5f1b89b4a
feat: bulk delete features (#3314) 2023-03-15 15:08:08 +02:00
Mateusz Kwasniewski
9fd84abaa5
feat: Default project mode open (#3316) 2023-03-15 12:28:06 +01:00
Jaanus Sellin
6c813ab066
feat: bulk stale features (#3311) 2023-03-15 08:37:06 +02:00
Mateusz Kwasniewski
7753082660
feat: expose project members (#3310) 2023-03-14 16:27:57 +01:00
Jaanus Sellin
1746a951c2
feat: bulk archive features (#3286)
Bulk archiving features logic.
2023-03-14 10:48:29 +02:00
andreas-unleash
de73fd3554
feat: default stickiness per project in settings (#3299)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->

Introduces 2 new endpoints (behind flag `projectScopedStickiness` to set
and get the setting

## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-03-13 14:22:47 +02:00
Mateusz Kwasniewski
8fdb263d64
feat: disable verbosity from db-migrate (#3301) 2023-03-13 10:12:43 +01:00
Simon Hornby
5088409c4d
fix: polling in proxy repository now stops correctly (#3268)
### What

This patches two very subtle bugs in the proxy repository that cause it
to never actually stop polling the db in the background

## Details - Issue 1

We've recently started to get the following output when running `yarn
test`:

` Attempted to log "Error: Unable to acquire a connection
at Object.queryBuilder
(/home/simon/dev/unleash/node_modules/knex/lib/knex-builder/make-knex.js:111:26)`
        
This seems to occur for every test suite after running the proxy tests
and the full stack trace doesn't point to anything related to the
running tests that produce this output. Running a `git bisect` points to
this commit:
6e44a65c58
being the culprit but I believe that this may have surfaced the bug
rather than causing it.

Layering in a few console logs and running Unleash, seems to point to
the proxy repository setting up data polling but never actually
terminating it when `stop` was called, which is inline with the output
here - effectively the tests were continuing to run the polling in the
background after the suite had exited and jest freaks out that an async
task is running when it shouldn't be. This is easy to reproduce once the
console logs are in place in the `dataPolling` function, by running
Unleash - creating and deleting a front end token never terminates the
poll cycle.

I believe the cause here is some subtlety around using async functions
with timers - stop was being called, which results in the timer being
cleared but a scheduled async call was already on the stack, causing the
recursive call to resolve after stop, resurrecting the timer and
reinitializing the poll cycle.

I've moved the terminating code into the async callback. Which seems to
solve the problem here.

## Details - Issue 2

Related to the first issue, when the proxy service stops the underlying
Unleash Client, it never actually calls destroy on the client, it only
removes it from its internal map. That in turn means that the Client
never calls stop on the injected repository, it only removes it from
memory. However, the scheduled task is `async` and `unref`, meaning it
continues to spin in the background until every other process also
exits. This is patched by simply calling destroy on the client when
cleaning up

## The Ugly

This is really hard to test effectively, mostly because this is an issue
caused by internals within NodeJS and async. I've added a test that
reads the output from the debug log (and also placed a debug log in the
termination code). This also requires the test code to wait until the
async task completes. This is horribly fragile so if someone has a
better idea on how to prove this I would be a very happy human.

The second ugly part is that this is a subtle issue in complex code that
really, really needs to work correctly. I'm nervous about making changes
here without lots of eyes on this
2023-03-10 10:03:32 +02:00
Simon Hornby
035daf675f
makes the 'Should update last seen for known toggles test' no longer … (#3293)
The patched test is currently depending on runtime to take more than a
millisecond to update the tested property. That's not always true and
more so on a fast machine, which makes this test flakey. This forces the
old timestamp to be 100 ms in the past so that the checked property must be at least 100 ms different if the update occurred
2023-03-10 09:58:43 +02:00
Mateusz Kwasniewski
b05b075ac8
feat: filter out all data fields other than explicit openapi fields (#3284)
Co-authored-by: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com>
2023-03-09 14:45:03 +01:00
Jaanus Sellin
a52dd10cf8
feat: bulk update tags (#3274) 2023-03-09 11:58:06 +02:00
Mateusz Kwasniewski
352ace1e6e
fix: exclude favorites from the client api (#3276) 2023-03-08 14:56:51 +01:00
Jaanus Sellin
0819d64448
feat: bulk tag features (#3258) 2023-03-08 10:07:06 +02:00
andreas-unleash
5f41b51b10
feat: creates a PUT endpoint for updating tags (#3265)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->
- Create UpdateTagsSchema
- Create PUT endpoint
## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Relates to#
https://linear.app/unleash/issue/1-767/refactor-existing-tag-component-to-also-allow-removing-tags

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-03-07 14:50:01 +00:00
Gastón Fournier
98d462db27
chore: add a new project column to segments table (#3263)
## About the changes
Adds a migration and persistence layer with a new column
`segment_project_id` to bind a segment to a project.
2023-03-07 14:56:20 +01:00
Gastón Fournier
37ce81a727
chore: re-use the same client schema for proxy (#3251)
## About the changes
client-metrics-schema is less strict than proxy-metrics-schema because
the former allows empty `instanceId` and also supports dates as
timestamps as well as date-formatted strings.

Using the same schema makes sense to reduce maintainability costs and
it's less error-prone if we need to modify the schema because underlying
the schema they both use the same code.

The reasoning is that proxy metrics should align with our client
metrics. Alternatively, we have new endpoints for edge metrics that will
aggregate and bucket by client.


![image](https://user-images.githubusercontent.com/455064/222738911-4c443e02-3072-4042-bfde-327da8dd46fe.png)


## Discussion points
Will we ever want to evolve proxy-metrics differently than
client-metrics? I'm under the assumption that the answer is no
2023-03-03 16:36:23 +01:00
Nuno Góis
322af1e54f
feat: update rate-limit (#3248)
https://linear.app/unleash/issue/2-732/rate-limit-auth-endpoints-in-enterprise

Updates the rate-limit to reflect the [recent rate-limiting in
Enterprise](https://github.com/ivarconr/unleash-enterprise/pull/381).
2023-03-03 12:09:28 +00:00
Mateusz Kwasniewski
e15aa9795a
feat: shared event emitter (#3241) 2023-03-02 09:52:19 +01:00
Christopher Kolstad
f4bdd89a1c
fix: Change format for bulk metrics. (#3229)
### What
Change /edge/metrics endpoint to accept list of ClientMetricsEnv

### Rationale
We originally made the assumption that we probably didn't need to keep
splitting from a map of features into ClientMetricsEnv for bulk, instead
the bulk poster could post ClientMetricsEnv directly. However, Unleash
still expected the old client metrics format with a dictionary of
featurename -> metricsForFeature. This PR changes that to now accept the
list of ClientMetricsEnv (preprocessed data from downstream) instead of
expecting metrics to be in the old single application metric format.
2023-03-01 13:08:08 +01:00
Gastón Fournier
0916402abf
chore: Improve bulk metrics endpoint (#3213)
## About the changes
This adds support for connectVia the way we intend to use it and start
now supports also a string
2023-02-28 13:36:25 +00:00
Christopher Kolstad
0a67cfed67
chore: Renames login_events to sign_on_log (#3203)
This makes the distinction from the event services clearer.

In enterprise we'll also rename LoginEventService etc to reflect this
rename.

In addition this adds a setting for how long of a retention one should have, defaulting to 336 hours (2 weeks)
2023-02-27 14:42:13 +00:00
Jaanus Sellin
af82202ada
feat: remove maintenance feature flag (#3199) 2023-02-27 15:36:56 +02:00
Gastón Fournier
291bcb4a0f
docs: new variants per environment (#2590)
## About the changes
Documentation about feature toggle variants per environment

## Discussion points
The version when this will be available is still to be defined.

---------

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2023-02-24 15:25:03 +01:00
Mateusz Kwasniewski
3800877be1
feat: drop full- for import/validate (#3168) 2023-02-21 10:15:57 +01:00
Jaanus Sellin
996fb1c104
feat: Permissions update import (#3141) 2023-02-17 11:58:55 +01:00
andreas-unleash
350b55644a
Feat/project api token permissions (#3065)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->

## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->
Define and implements Project api token permissions
Assign permissions to existing roles
Adjust UI to support them 
Adjust BE to implement

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>
2023-02-17 12:15:36 +02: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