1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
Commit Graph

2351 Commits

Author SHA1 Message Date
Thomas Heartman
3db1159304
feat: allow you to gradually scale back constraint usage (#7622)
This PR updates the limit validation for constraint numbers on a single
strategy. In cases where you're already above the limit, it allows you
to still update the strategy as long as you don't add any **new**
constraints (that is: the number of constraints doesn't increase).

A discussion point: I've only tested this with unit tests of the method
directly. I haven't tested that the right parameters are passed in from
calling functions. The main reason being that that would involve
updating the fake strategy and feature stores to sync their flag lists
(or just checking that the thrown error isn't a limit exceeded error),
because right now the fake strategy store throws an error when it
doesn't find the flag I want to update.
2024-07-19 08:40:45 +00:00
Mateusz Kwasniewski
a0ba44d9f4
chore: feature collaborators flag (#7623) 2024-07-19 10:11:39 +02:00
Nuno Góis
5a2b48687e
chore: integration events service (#7614)
https://linear.app/unleash/issue/2-2438/create-new-integration-event-service

https://linear.app/unleash/issue/2-2442/automatically-clean-up-old-integration-events

Adds a new `IntegrationEventsService`.
2024-07-18 16:54:31 +01:00
Nuno Góis
0ae6af13e9
chore: integration events store (#7613)
https://linear.app/unleash/issue/2-2437/create-new-integration-event-store

Adds a new `IntegrationEventsStore`.
2024-07-18 15:20:35 +01:00
Nuno Góis
0d3dee0e96
fix: validate patched data with schema (#7616)
https://linear.app/unleash/issue/2-2453/validate-patched-data-against-schema

This adds schema validation to patched data, fixing potential issues of
patching data to an invalid state.

This can be easily reproduced by patching a strategy constraints to be
an object (invalid), instead of an array (valid):

```sh
curl -X 'PATCH' \
  'http://localhost:4242/api/admin/projects/default/features/test/environments/development/strategies/8cb3fec6-c40a-45f7-8be0-138c5aaa5263' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '[
  {
    "path": "/constraints",
    "op": "replace",
    "from": "/constraints",
    "value": {}
  }
]'
```

Unleash will accept this because there's no validation that the patched
data actually looks like a proper strategy, and we'll start seeing
Unleash errors due to the invalid state.

This PR adapts some of our existing logic in the way we handle
validation errors to support any dynamic object. This way we can perform
schema validation with any object and still get the benefits of our
existing validation error handling.

This PR also takes the liberty to expose the full instancePath as
propertyName, instead of only the path's last section. We believe this
has more upsides than downsides, especially now that we support the
validation of any type of object.


![image](https://github.com/user-attachments/assets/f6503261-f6b5-4e1d-9ec3-66547d0d061f)
2024-07-18 13:26:50 +01:00
Thomas Heartman
f15bcdc2a6
chore: send prometheus metrics when someone tries to exceed resource limits (#7617)
This PR adds prometheus metrics for when users attempt to exceed the
limits for a given resource.

The implementation sets up a second function exported from the
ExceedsLimitError file that records metrics and then throws the error.
This could also be a static method on the class, but I'm not sure that'd
be better.
2024-07-18 13:35:45 +02:00
Thomas Heartman
949a5f0109
fix: Update OpenAPI error converter to handle query param errors too (#7609)
This PR updates the OpenAPI error converter to also work for errors with
query parameters.
We previously only sent the body of the request along with the error,
which meant that query parameter errors would show up incorrectly.

For instance given a query param with the date format and the invalid
value `01-2020-01`, you'd previously get the message:
> The `from` value must match format "date". You sent undefined

With this change, you'll get this instead:
> The `from` value must match format "date". You sent "01-2020-01". 

The important changes here are two things:
- passing both request body and query params
- the 3 lines in `fromOpenApiValidationError` that check where we should
get the value you sent from.

The rest of it is primarily updating tests to send the right arguments
and some slight rewording to more accurately reflect that this can be
either request body or query params.
2024-07-17 12:47:32 +02:00
Nuno Góis
13d02685d8
chore: db migration for integration events (#7604)
https://linear.app/unleash/issue/2-2435/create-migration-for-a-new-integration-events-table

Adds a DB migration that creates the `integration_events` table:
 - `id`: Auto-incrementing primary key;
- `integration_id`: The id of the respective integration (i.e.
integration configuration);
 - `created_at`: Date of insertion;
- `state`: Integration event state, as text. Can be anything we'd like,
but I'm thinking this will be something like:
   - Success 
   - Failed 
   - SuccessWithErrors ⚠️
- `state_details`: Expands on the previous column with more details, as
text. Examples:
   - OK. Status code: 200
   - Status code: 429 - Rate limit reached
   - No access token provided
 - `event`: The whole event object, stored as a JSON blob;
- `details`: JSON blob with details about the integration execution.
Will depend on the integration itself, but for example:
   - Webhook: Request body
- Slack App: Message text and an array with all the channels we're
posting to

I think this gives us enough flexibility to cover all present and
(possibly) future integrations, but I'd like to hear your thoughts.

I'm also really torn on what to call this table:
- `integration_events`: Consistent with the feature name. Addons are now
called integrations, so this would be consistent with the new thing;
 - `addon_events`: Consistent with the existing `addons` table.
2024-07-17 10:02:04 +01:00
Nuno Góis
4fb5469cb5
chore: add integrationEvents feature flag (#7602)
https://linear.app/unleash/issue/2-2434/add-a-new-integrationevents-feature-flag

Adds a new `integrationEvents` feature flag.
2024-07-17 08:25:47 +01:00
Tymoteusz Czech
7b2532ea4f
New insights layout - feature flag (#7598)
Preparing insights component for refactoring and enhancements.
2024-07-16 12:24:30 +00:00
Tymoteusz Czech
b9c3d101ba
feat: statistics for orphaned tokens (#7568)
Added metrics for orphaned tokens and modified `createTokenRowReducer` to exclude tokens in v1 format.
2024-07-11 11:39:38 +02:00
Christopher Kolstad
8bee33fa48
task: added flag to remove unsafe inline style src header (#7566)
Our CSP reports that unsafe-inline is not recommended for styleSrc. This
PR adds a flag for making it possible to remove this element of our CSP
headers. It should allow us to see what (if anything) breaks hard.
2024-07-10 14:36:28 +02:00
Mateusz Kwasniewski
3fe110f155
feat: exclude archived features in max reporting (#7559) 2024-07-10 09:11:22 +02:00
Christopher Kolstad
f65afff6c1
feat: Disallow repeating last 5 passwords. (#7552)
We'll store hashes for the last 5 passwords, fetch them all for the user
wanting to change their password, and make sure the password does not
verify against any of the 5 stored hashes.

Includes some password-related UI/UX improvements and refactors. Also
some fixes related to reset password rate limiting (instead of an
unhandled exception), and token expiration on error.

---------

Co-authored-by: Nuno Góis <github@nunogois.com>
2024-07-09 16:18:35 +02:00
Thomas Heartman
e2c6d468e4
Chore: use createApiTokenService instead of newing it up (#7560)
PR #7519 introduced the pattern of using `createApiTokenService` instead
of newing it up. This usage was introduced in a concurrent PR (#7503),
so we're just cleaning up and making the usage consistent.
2024-07-09 14:11:56 +02:00
David Leek
2e5d81cb89
chore: delete project api tokens when last mapped project is removed (#7503)
Deletes API tokens bound to specific projects when the last project they're mapped to is deleted.

---------

Co-authored-by: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com>
Co-authored-by: Thomas Heartman <thomas@getunleash.io>
2024-07-09 13:49:26 +02:00
Mateusz Kwasniewski
7ca2ace0bc
feat: constraints limit in a strategy (#7554) 2024-07-08 11:02:22 +02:00
Tymoteusz Czech
225d8a91f1
API tokens scoped to deleted projects shouldn't give wildcard access (#7499)
If you have SDK tokens scoped to projects that are deleted, you should
not get access to any flags with those.

---------

Co-authored-by: David Leek <david@getunleash.io>
2024-07-08 09:52:10 +02:00
Christopher Kolstad
d8bb9f18de
fix: update addon counter to include new relic addon 2024-07-05 15:17:45 +02:00
Alexandru Savin
9fae7801ed
feat: New Relic integration (#7492)
## About the changes
Add New Relic integration based on issue #878.


![image](https://github.com/Unleash/unleash/assets/1612455/05523b73-398b-413d-b760-26bf2feec2db)


![image](https://github.com/Unleash/unleash/assets/1612455/1ec01f52-0c1a-46a7-aa5b-5ca80004dcf8)


<!-- 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 #878
2024-07-05 15:16:00 +02:00
Simon Hornby
2e205fc14e
chore: make sdk metrics snake case (#7547) 2024-07-05 12:29:00 +02:00
Thomas Heartman
59d6014853
Chore: add limits to feature flags (#7536)
This PR adds a feature flag limit to Unleash. It's set up to be
overridden in Enterprise, where we turn the limit up.

I've also fixed a couple bugs in the fake feature flag store.
2024-07-04 11:00:11 +02:00
Simon Hornby
30073d527a
feat: extended SDK metrics (#7527)
This adds an extended metrics format to the metrics ingested by Unleash
and sent by running SDKs in the wild. Notably, we don't store this
information anywhere new in this PR, this is just streamed out to
Victoria metrics - the point of this project is insight, not analysis.

Two things to look out for in this PR:

- I've chosen to take extend the registration event and also send that
when we receive metrics. This means that the new data is received on
startup and on heartbeat. This takes us in the direction of collapsing
these two calls into one at a later point
- I've wrapped the existing metrics events in some "type safety", it
ain't much because we have 0 type safety on the event emitter so this
also has some if checks that look funny in TS that actually check if the
data shape is correct. Existing tests that check this are more or less
preserved
2024-07-04 08:51:27 +02:00
Jaanus Sellin
08533d7224
chore: remove unused clone code (#7529)
Removing this code, because variants per env are GA and I did not find
any usage of it.
2024-07-03 15:08:19 +03:00
Thomas Heartman
6d913809ca
chore: extract api token service composition root; place it in /features (#7519)
This is a refactoring task, creating an ApiTokenService composition root
in /features.
2024-07-03 11:49:11 +02:00
Mateusz Kwasniewski
72615cc6d5
feat: segments limit (#7524) 2024-07-03 10:41:56 +02:00
Mateusz Kwasniewski
e9b643761c
feat: Project limit UI (#7518) 2024-07-02 15:29:58 +02:00
Thomas Heartman
b2522f9199
feat: add resource limits for API tokens (#7510)
This PR adds the back end for API token resource limits. 

It adds the limit to the schema and checks the limit in the service.

## Discussion points

The PAT service uses a different service and different store entirely,
so I have not included testing any edge cases where PATs are included.
However, that could be seen as "knowing too much". We could add tests
that check both of the stores in tandem, but I think it's overkill for
now.
2024-07-02 12:41:31 +00:00
Mateusz Kwasniewski
8a9535d352
feat: projects limit (#7514) 2024-07-02 12:03:00 +02:00
Thomas Heartman
be518af228
feat: use new environment limit in Unleash UI (#7500)
This PR updates the Unleash UI to use the new environment limit.

As it turns out, we already had an environment limit in the UI, but it
was hardcoded (luckily, its value is the same as the new default value
🥳).

In addition to the existing places this limit was used, it also disables
the "new environment" button if you've reached the limit. Because this
limit already exists, I don't think we need a flag for it. The only
change is that you can't click a button (that should be a link!) that
takes you to a page you can't do anything on.
2024-07-02 06:14:15 +00:00
Mateusz Kwasniewski
054b44a8dd
feat: allow enterprise override for constraint values limit (#7502) 2024-07-01 15:45:13 +02:00
Mateusz Kwasniewski
57b253c050
feat: constraint values limit UI (#7501) 2024-07-01 15:05:44 +02:00
Mateusz Kwasniewski
2cfd71f34e
feat: constraint values limit (#7498) 2024-07-01 13:28:30 +02:00
Thomas Heartman
441c399f58
feat: add environments to resource limit schema (#7495)
This PR adds limits for environments to the resource limit schema. The
actual limiting will have to be done in Enterprise, however, so this is
just laying the groundwork.
2024-07-01 11:20:22 +02:00
Mateusz Kwasniewski
3525928fea
feat: configurable strategies limit (#7488) 2024-07-01 10:03:26 +02:00
Mateusz Kwasniewski
eaf68af2da
test: remove last seen at assertion (#7487) 2024-06-28 15:18:16 +02:00
Mateusz Kwasniewski
5bd32f264d
feat: strategy limit to 30 (#7473) 2024-06-28 11:18:44 +02:00
Christopher Kolstad
fbda7cdc48
chore: sync dependencies with enterprise (#7482)
As the title says. We had some mismatch in our dependencies where
enterprise was ahead of oss, and some places where oss was ahead of
enterprise. Hence
https://github.com/ivarconr/unleash-enterprise/pull/1419 and this PR
2024-06-28 10:54:37 +02:00
Thomas Heartman
95359ecff8
fix: cap project ids to 90 characters (without suffix) (#7481)
This fixes the issue where project names that are 100 characters long
or longer would cause the project creation to fail. This is because
the resulting ID would be longer than the 100 character limit imposed
by the back end.

We solve this by capping the project ID to 90 characters, which leaves
us with 10 characters for the suffix, meaning you can have 1 billion
projects (999,999,999 + 1) that start with the same 90
characters (after slugification) before anything breaks.

It's a little shorter than what it strictly has to be (we could
probably get around with 95 characters), but at this point, you're
reaching into edge case territory anyway, and I'd rather have a little
too much wiggle room here.
2024-06-28 09:25:27 +02:00
Mateusz Kwasniewski
b67c73a578
chore: resource limits flag (#7471) 2024-06-27 14:25:07 +02:00
Nuno Góis
47b0c61670
chore: better debug logs in slack app (#7467)
Should improve the readability of our Slack App integration logs.
2024-06-27 09:14:37 +01:00
Mateusz Kwasniewski
db525a6617
refactor: largest resources queries (#7466) 2024-06-27 09:26:40 +02:00
Thomas Heartman
a9a87bc84d
chore: change generated project id format to use incrementing numbers instead of hashes (#7456) 2024-06-27 09:21:09 +02:00
Mateusz Kwasniewski
72de574012
feat: largest projects and features metric (#7459) 2024-06-26 16:09:08 +02:00
Jaanus Sellin
e8511789fd
feat: command menu items can have description as tooltip now (#7455)
![image](https://github.com/Unleash/unleash/assets/964450/7a55a1a7-7aea-4f9c-96ac-46adf2edd36f)
2024-06-26 12:39:53 +03:00
Mateusz Kwasniewski
d29230cd49
feat: transactional complete/uncomplete feature (#7451) 2024-06-26 09:05:17 +02:00
Mateusz Kwasniewski
3a3b6a29ff
feat: lifecycle stage entered counter (#7449) 2024-06-25 14:40:16 +02:00
David Leek
5d0fc071e7
chore: remove unused interfaces from old state import (#7448) 2024-06-25 14:30:57 +02:00
Jaanus Sellin
ed7f917df6
fix: make search selects explicit (#7445)
Now we are not returning * columns, but all tables that we join later,
will need to select columns one by one.
2024-06-25 13:56:40 +03:00
Mateusz Kwasniewski
388fe2dbd3
fix: change lifecycle stage duration metric type (#7444) 2024-06-25 12:42:43 +02:00
Mateusz Kwasniewski
c3fa468a9d
refactor: lifecycle stage duration outside instance stats (#7442) 2024-06-25 11:22:26 +02:00
Mateusz Kwasniewski
6a9a2c687d
feat: stage count by project metric (#7441) 2024-06-25 09:54:26 +02:00
Mateusz Kwasniewski
c14c67f476
feat: lifecycle stage count (#7434) 2024-06-25 09:11:46 +02:00
Mateusz Kwasniewski
70c7e3f978
feat: Anonimize demo users list flag view (#7432) 2024-06-24 13:48:08 +02:00
Mateusz Kwasniewski
ea1221c45e
chore: remove unstable label from GA metrics features (#7433) 2024-06-24 13:32:35 +02:00
Thomas Heartman
0af5bbad38
chore: remove createProjectWithEnvironmentConfig and newCreateProjectUI flags (#7429)
This PR removes the last two flags related to the project managament
improvements project, making the new project creation form GA.

In doing so, we can also delete the old project creation form (or at
least the page, the form is still in use in the project settings).
2024-06-24 12:53:55 +02:00
Thomas Heartman
c2a29b49b8
fix: turn off showing usernames and emails in the project cards when the flag is turned on (#7421)
This PR:
- adds a flag to anonymize user emails in the new project cards
- performs the anonymization using the existing `anonymise` function
that we have.

It does not anonymize the system user, nor does it anonymize groups. It
does, however, leave the gravatar url unchanged, as that is already
hashed (but we may want to hide that too).

This PR also does not affect the user's name or username. Considering
the target is the demo instance where the vast majority of users don't
have this (and if they do, they've chosen to set it themselves), this
seems an appropriate mitigation.

With the flag turned off:

![image](https://github.com/Unleash/unleash/assets/17786332/10a84562-c025-4e5c-b642-f949595b4e7e)

With the flag on:

![image](https://github.com/Unleash/unleash/assets/17786332/6fc35203-e2fa-4208-9650-0a87d3898996)
2024-06-21 12:51:37 +02:00
Nuno Góis
4736084e00
fix: check for permission in group access assignment (#7408)
Fix project role assignment for users with `ADMIN` permission, even if
they don't have the Admin root role. This happens when e.g. users
inherit the `ADMIN` permission from a group root role, but are not
Admins themselves.

---------

Co-authored-by: Gastón Fournier <gaston@getunleash.io>
2024-06-18 17:06:34 +01:00
Thomas Heartman
c4e2159401
chore: add metrics/gauges for "max constraint values" and "max constraints" (#7398)
This PR adds metrics tracking for:
- "maxConstraintValues": the highest number of constraint values that
are in use
- "maxConstraintsPerStrategy": the highest number of constraints used on
a strategy

It updates the existing feature strategy read model that returns max
metrics for other strategy-related things.

It also moves one test into a more fitting describe block.
2024-06-17 11:13:13 +02:00
Simon Hornby
4eaa1525a0
fix: make default for gradual rollout work on the correct strategy name (#7401) 2024-06-14 15:54:00 +02:00
Jaanus Sellin
c33901b332
fix: project to lifecycle events (#7400)
We need project for those events to filter it out in webhook
configuration.
2024-06-14 16:42:10 +03:00
Jaanus Sellin
708183ce26
feat: optimize search store by removing inline EXISTS (#7394)
Instead of running exists on every row, we are joining the exists, which
runs the query only once.
This decreased load time on my huge dataset from 2000ms to 200ms.

Also added tests that values still come through as expected.
2024-06-14 10:26:12 +03:00
Mateusz Kwasniewski
0c79b36b74
feat: Max strategies metrics (#7392) 2024-06-14 09:20:43 +02:00
Jaanus Sellin
1191f162e5
fix: fix unstable search (#7391)
Reverting

https://github.com/Unleash/unleash/pull/7387
https://github.com/Unleash/unleash/pull/7385
2024-06-13 15:37:31 +03:00
Jaanus Sellin
906940948b
feat: optimize search (#7387)
I am moving the strategies join to later part of query, because it is
not used for filtering, only need it for data.
2024-06-13 13:46:06 +03:00
Jaanus Sellin
b9f43f5ba0
feat: optimize search store by removing inline EXISTS (#7385)
Instead of running exists on every row, we are joining the exists, which
runs the query only once.
This decreased load time on my huge dataset from 2000ms to 200ms.

Also added tests that values still come through as expected.
2024-06-13 13:11:47 +03:00
Mateusz Kwasniewski
3cc0dfe35a
fix: playground parent deps check (#7384) 2024-06-13 10:36:44 +02:00
Mateusz Kwasniewski
702ee8cb12
test: describe default stickiness bahavior in a test (#7379) 2024-06-12 16:49:50 +02:00
Jaanus Sellin
7fc87e1647
feat: clean up command bar props (#7368)
A lot of things were passed in for search, but since we only have single
command bar, we do not need them and it was bloating our component.
2024-06-12 09:24:16 +03:00
Mateusz Kwasniewski
c1656d8630
feat: Read flag creator (#7357) 2024-06-11 15:22:52 +02:00
David Leek
576dd04dc5
feat: command bar poc (#7350)
Command bar PoC using clone of search

---------

Co-authored-by: sjaanus <sellinjaanus@gmail.com>
2024-06-11 15:27:59 +03:00
Mateusz Kwasniewski
2a616c28bc
feat: adding full creator information to view used by feature read (#7356) 2024-06-11 14:19:32 +02:00
Jaanus Sellin
3acb3ad2c2
feat: upgrade from react v17 to v18 (#7265)
**Upgrade to React v18 for Unleash v6. Here's why I think it's a good
time to do it:**
- Command Bar project: We've begun work on the command bar project, and
there's a fantastic library we want to use. However, it requires React
v18 support.
- Straightforward Upgrade: I took a look at the upgrade guide
https://react.dev/blog/2022/03/08/react-18-upgrade-guide and it seems
fairly straightforward. In fact, I was able to get React v18 running
with minimal changes in just 10 minutes!
- Dropping IE Support: React v18 no longer supports Internet Explorer
(IE), which is no longer supported by Microsoft as of June 15, 2022.
Upgrading to v18 in v6 would be a good way to align with this change.

TS updates:
* FC children has to be explicit:
https://stackoverflow.com/questions/71788254/react-18-typescript-children-fc
* forcing version 18 types in resolutions:
https://sentry.io/answers/type-is-not-assignable-to-type-reactnode/

Test updates:
* fixing SWR issue that we have always had but it manifests more in new
React (https://github.com/vercel/swr/issues/2373)

---------

Co-authored-by: kwasniew <kwasniewski.mateusz@gmail.com>
2024-06-11 13:59:52 +03:00
Mateusz Kwasniewski
44ca447fd2
chore: remove debug metrics flag (#7348) 2024-06-11 10:44:16 +02:00
Mateusz Kwasniewski
cedf19d2ec
fix: lifecycle metrics on metrics insert (#7322) 2024-06-07 15:55:15 +02:00
Mateusz Kwasniewski
8279da9f9b
feat: show creators from non archived features (#7309) 2024-06-06 14:50:38 +02:00
Thomas Heartman
eb39a212ce
chore: test that the tags API still returns tags that you can't create anymore (#7304)
This change adds a test to the tags API to ensure that even if you
can't create tags that are pure whitespace anymore, you'll still
receive pre-existing tags from the API that fit this description.

The test is here to ensure that we don't break this in future versions
of Unleash.
2024-06-06 14:16:45 +02:00
Mateusz Kwasniewski
6b4d9d0c1d
fix: remove null users in filter (#7308) 2024-06-06 13:38:54 +02:00
Mateusz Kwasniewski
a91b77a7ce
feat: filter by created by (#7306) 2024-06-06 12:59:11 +02:00
Mateusz Kwasniewski
2cc4b5faab
feat: display created by user in search (#7292) 2024-06-06 11:51:54 +02:00
Mateusz Kwasniewski
3c3e888ff0
feat: project flag creators api (#7302) 2024-06-06 11:10:28 +02:00
Mateusz Kwasniewski
1a6197660f
feat: add created by in search results (#7285) 2024-06-05 13:54:24 +02:00
Thomas Heartman
2bad98a121
fix: disallow invalid tag values (#7268)
This PR fixes how Unleash handles tag values. Specifically, it does
these things:
1. Trims leading and trailing whitespace from tag values before
inserting them into the database
2. Updates OpenAPI validation to not allow whitespace-only and to ignore
leading and trailing whitespace

Additionally, it moves the tag length constants into the constants file
from the Joi tag schema file. This is because importing the values
previously rendered them as undefined (probably due to a circular
dependency somewhere in the system). This means that the previous values
were also ignored by OpenAPI.

UI updates reflecting this wil follow.

## Background
When you tag a flag, there's nothing stopping you from using an entirely
empty tag or a tag with leading/trailing whitespace.

Empty tags make little sense and leading trailing whitespace differences
are incredibly subtle:

![image](https://github.com/Unleash/unleash/assets/17786332/ec8fe193-8837-4c6a-b7bf-8766eff34eed)


Additionally, leading and trailing whitespace is not shown in the
dropdown list, so you'd have to guess at which is the right one.

![image](https://github.com/Unleash/unleash/assets/17786332/a14698ab-2bfd-4ec3-8814-b8e876d0aadb)
2024-06-05 08:31:30 +02:00
Gastón Fournier
1fb6eb1593
fix: import export pointing to new docs (#7274)
I believe this link is pointing to old docs and should be updated
2024-06-04 23:00:53 +02:00
Mateusz Kwasniewski
2069af427a
feat: more powerful feature search by type (#7267) 2024-06-04 15:13:11 +02:00
Christopher Kolstad
0db5bc193f
task: upgraded semver dependency (and biome) (#7272)
Sorry for the extra noise here, but this seems to be the biome upgrade
altering formatting slightly.
2024-06-04 15:01:43 +02:00
David Leek
927f911c62
chore: add a flag+ui flag for commandBarUI (#7264) 2024-06-04 08:50:13 +00:00
David Leek
63e300da3b
chore: change to fs/promises and add an import from file e2e test (#7240) 2024-06-03 12:10:12 +02:00
Mateusz Kwasniewski
8c26c038b4
feat: new sidebar by default for OSS (#7239) 2024-06-03 11:05:10 +02:00
Gastón Fournier
54c6ac8163
fix: Created by on application-created adds the ip as created by (#7231)
To avoid leaking potential PII information in the event log, this replaces the IP for the system user as the "created by" field
2024-06-02 15:57:47 +02:00
Gastón Fournier
5845d0e552
chore: make ip mandatory (#7220)
IP should be mandatory for storing events. Automated events should use
127.0.0.1
2024-05-31 14:52:15 +02:00
David Leek
80ba3647a6
feat: file import (#7219) 2024-05-31 13:21:41 +02:00
Jaanus Sellin
d17ae37800
feat: now CLIENT_METRICS event will be emitted with new structure (#7210)
1. CLIENT_METRICS event will be emitted with new structure
2. CLIENT_METRICS event will be emitted from bulkMetrics endpoint
2024-05-31 12:40:46 +03:00
Jaanus Sellin
3c73ce9dd9
fix: increase performance of outdated SDK query (#7226)
Joining might not always be the best solution. If a table contains too
much data, and you later run sorting on top of it, it will be slow.

In this case, we will first reduce the instances table to a minimal
version because instances usually share the same SDK versions. Only
after that, we join.

Based on some customer data, we reduced query time from 3000ms to 60ms.
However, this will vary based on the number of instances the customer
has.
2024-05-31 12:39:52 +03:00
Thomas Heartman
de74faac46
chore: remove flag for new project cards (#7225)
This PR removes the flag for the new project card design, making it GA.

It also removes deprecated components and updates one reference (in the
groups card) to the new components instead.
2024-05-31 10:58:31 +02:00
Thomas Heartman
bea5929460
chore: remove project list split feature flags (#7224)
This PR removes all the feature flags related to the project list split
and updates the snapshot.

Now the project list will always contain "my projects" and "other
projects"
2024-05-31 10:38:23 +02:00
Simon Hornby
d6dc2b4ce2
chore: mark deprecations with version (#7218)
Makes some deprecation messages in open API clearer around which version
they were deprecated in so that they can be removed in v7
2024-05-30 13:49:39 +02:00
Gastón Fournier
07ef4a114f
chore: sync user groups is a system action (#7214)
## About the changes
After an internal conversation, we concluded that syncExternalGroups is
an action that Unleash performs as a system, not something triggered by
the user. We keep the method and just write the event log that the
action was performed by the system user.
2024-05-30 11:47:30 +02:00
Jaanus Sellin
6c8b1d8904
fix: when finding median time to production, ignore 0s (#7200)
We have an issue that if you open up Insights, the Time to Production
chart was showing nothing because it was taking the median across all
projects. You might have many new or empty projects where the median was
0 (no data).

For example, the median from [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.7, 50.3, 140] was 0.

Now, we will remove the 0 values to have a more reasonable median.
2024-05-29 14:17:31 +03:00
David Leek
998abaad67
chore: remove unused and deprecated methods in feature toggle legacy controller and in feature toggle service (#7199) 2024-05-29 11:01:33 +02:00
Jaanus Sellin
ef9f09b58c
feat: insights out of beta and expose 2 widgets to pro (#7177)
1. Remove beta badge
2. Remove exposure from oss
3. Expose 2 widgets to pro and rest to enterprise
2024-05-29 11:55:01 +03:00
David Leek
61a8908694
chore: remove state service (#7184)
## About the changes

Removes the deprecated state endpoint, state-service (despite the
service itself not having been marked as deprecated), and the file
import in server-impl. Leaves a TODO in place of where file import was
as traces for a replacement file import based on the new import/export
functionality
2024-05-28 14:47:31 +02:00
Simon Hornby
f16f8594f5
chore: deprecate custom strategies (#7186) 2024-05-28 12:33:53 +02:00
Christopher Kolstad
cea64dc21d
task: Removed edge bulk metrics endpoint (#7161)
Removes /edge/metrics. This has been superseded by
/api/client/metrics/bulk. Once this is merged, Unleash 6.0 will require
Edge > 17.0.0. (We recommend at least v19.1.3)
2024-05-28 11:30:41 +02:00
Jaanus Sellin
304d619597
chore: upgrade edge banner version (#7180)
Upgrading banner to 19.1.3, because we fixed critical issue there.
2024-05-28 12:16:42 +03:00
Jaanus Sellin
83912d872b
fix: fix empty events when no features need to be deleted (#7181) 2024-05-28 11:32:20 +03:00
Jaanus Sellin
73f0cb6180
chore: switch insights ui flag to kill switch (#7166)
The flag is already set up in our Unleash instance.
2024-05-28 09:44:52 +03:00
gitar-bot[bot]
6e8e807e44
[Gitar] Cleaning up stale feature flag: executiveDashboard with value true (#7158)
We are keeping the UI hidden for mdsol behind kill switch, but I feel
like we can remove the flag completely for backend, so everyone will
keep collecting data.

Co-authored-by: Gitar Bot <noreply@gitar.co>
2024-05-27 14:21:44 +03:00
Gastón Fournier
e5aa1a81cb
feat: add remote ip to all events (2) (#7149)
## About the changes
This aligns us with the requirement of having ip in all events. After
tackling the enterprise part we will be able to make the ip field
mandatory here:
2c66a4ace4/src/lib/types/events.ts (L362)
2024-05-27 11:58:32 +02:00
Thomas Heartman
f518b12b07
chore!: [v6] remove error.description in error messages (#7157)
In preparation for v6, this PR removes usage and references to
`error.description` instead favoring `error.message` (as mentioned
#4380)

I found no references in the front end, so this might be (I believe it
to be) all the required changes.
2024-05-27 11:26:19 +02:00
David Leek
9ea66e8850
chore: remove deprecated legacy features endpoint (#7129)
This PR is part of #4380 - Remove legacy `/api/feature` endpoint.

## About the changes

### Frontend
- Removes the useFeatures hook
- Removes the part of StrategyView that displays features using this
strategy (not been working since v4.4)
- Removes 2 unused features entries from routes 

### Backend
- Removes the /api/admin/features endpoint
- Moves a couple of non-feature related tests (auth etc) to use
/admin/projects endpoint instead
- Removes a test that was directly related to the removed endpoint
- Moves a couple of tests to the projects/features endpoint
- Reworks some tests to fetch features from projects features endpoint
and strategies from project strategies
2024-05-27 09:24:09 +02:00
Christopher Kolstad
6f2a10922d
feat: error log on unsupported pg (#7139)
Co-authored-by: Gastón Fournier <gaston@getunleash.io>
2024-05-27 09:21:45 +02:00
Gastón Fournier
8ac8d873b4
chore: edge active tokens cache flag removal (#7094)
## About the changes
EdgeService is the only place where we use active tokens validation in
bulk. By switching to validating from the cache, we no longer need a
method to return all active tokens from the DB.
2024-05-24 14:42:30 +02:00
Jaanus Sellin
bd90d1304e
chore: rename toggle to flag #final (#7146) 2024-05-24 15:07:01 +03:00
Mateusz Kwasniewski
8b5e39c997
feat: hide top nav (#7140) 2024-05-24 12:08:08 +02:00
Gastón Fournier
345c34a945
feat: add ip to state-service and group-service (#7120)
The add ip to two services. Despite state is being deprecated, I think
we better get it out of the way.
2024-05-24 09:53:46 +02:00
Christopher Kolstad
4b68a0b3fd
chore: make it build again 2024-05-23 15:32:46 +02:00
Christopher Kolstad
7e38d6bae1
Node20 (#7095)
Upgrades workflows, nvmrc and package.json to use Node 20.
2024-05-23 14:14:09 +02:00
Jaanus Sellin
b3dd460d2f
chore: rename toggle to flag #7 (#7125) 2024-05-23 13:19:49 +03:00
Jaanus Sellin
d9e631c326
chore: remove e2e that is not needed anymore (#7124)
We talked with @nunogois that this test is testing migration from 2023,
but time has passed and the migration is working properly, so we think
to cut down on test run time, we can remove it.
2024-05-23 12:49:12 +03:00
Jaanus Sellin
c4566baeac
chore: rename roles toggles to flag (#7123)
Running migration to update roles descriptions.
2024-05-23 12:01:04 +03:00
Mateusz Kwasniewski
be6837b53a
feat: navigation sidebar stub (#7121) 2024-05-23 10:49:11 +02:00
Jaanus Sellin
7937301424
chore: rename toggle to flag #6 (#7122) 2024-05-23 11:32:11 +03:00
Jaanus Sellin
4824a02f2b
feat: rename toggle to flag with db migration (#7118)
Renaming also permissions with migration
2024-05-23 10:17:02 +03:00
Jaanus Sellin
2d519469d4
chore: rename feature toggle to feature flag #5 (#7115) 2024-05-23 08:36:58 +03:00
Jaanus Sellin
29e7c4035d
chore: rename toggle to flag #4 (#7114) 2024-05-22 16:26:22 +03:00
Mateusz Kwasniewski
ad4f269d23
feat: debug metrics flag (#7108) 2024-05-22 11:53:10 +02:00
Mateusz Kwasniewski
99403e481b
feat: add prometheus metrics error logging (#7105) 2024-05-22 10:08:31 +02:00
Jaanus Sellin
2fb95339ef
chore: change toggle to flag #3 (#7101) 2024-05-22 09:58:53 +03:00
Mateusz Kwasniewski
45eff83a8a
test: fix flaky lifecycle test (#7093) 2024-05-21 13:40:14 +02:00
Jaanus Sellin
4f46f03843
fix: small improvements (#7090)
Fixing isAdmin method. It is not that critical, because that is mostly
for system users not real usage.
Also fixing wording for outdated sdks.
2024-05-21 12:40:52 +03:00
Jaanus Sellin
45c75a65ce
feat: add global isAdmin method for access service (#7088)
This is preparation, so we do not need to define an `isAdmin` method in
the change request context.
2024-05-21 11:56:22 +03:00
Jaanus Sellin
a204f2c615
feat: outdated sdks project level (#7080)
This adds project level endpoint to catch outdated SDKs only for that
project.
2024-05-20 12:58:30 +03:00
David Leek
dfc0c3c63f
feat: refactor data usage into hooks, estimate monthly added fees (#7048)
- Refactors data processing and overage calculations to separate hooks
- Adds support for estimating traffic costs based on monthly usage up to
current point
- Adds accrued traffic charges to the billing page


![image](https://github.com/Unleash/unleash/assets/707867/39a837c2-5092-49b8-8bbf-46d8757635c0)


![image](https://github.com/Unleash/unleash/assets/707867/55ecfa5e-afe1-4cb6-9aa4-7dd67db4248c)
2024-05-17 15:27:32 +02:00
Mateusz Kwasniewski
150a7b3ed4
feat: Deprecate feature toggle environment variants api (#7066) 2024-05-16 13:43:21 +02:00
Mateusz Kwasniewski
9281d6b694
fix: reached stage should emit feature name (#7068) 2024-05-16 12:11:13 +02:00
Gastón Fournier
7cf9cfa96e
fix: bearer tokens with base-path (#7065)
## About the changes
We've identified that Bearer token middleware is not working for
/enterprise instance.

Looking at a few lines below:
88e3b1b79e/src/lib/app.ts (L81-L84)
we can see that we were missing the basePath in the use definition.
2024-05-16 11:45:16 +02:00
Mateusz Kwasniewski
88e3b1b79e
feat: deprecate feature toggle variants at environment level (#7058) 2024-05-16 10:57:32 +02:00
Zachary Skalko
9903cf1090
fix: Add appropriate response headers to SPA entry point HTML response (#6992)
## About the changes

Current state, when returning the HTML entry point from the server,
there are no headers attached. We encountered an issue with a deployment
and this had an impact for us.

A brief description:

1. We deployed the most recent version. Noticed an unrelated issue.
2. Users tried to use the most recent version and due to their client
cache, requested assets that did not exist in the newest version.
3. Our cache layer cached the assets that were not there with the HTML
response. It had to infer the type based on the filename because there
was no attached `Content-Type` header. This cache was very sticky.
4. After rolling back we saw the HTML response (from the cache) instead
of the appropriate response from the upstream Unleash application.

This PR does a few things.

1. When responding with the HTML entry point, it adds header
(`Content-Type: text/html`).
2. When the client is requesting an asset (a path that ends with an
extension), it also instructs the resource not to be cached
(`Cache-Control: no-cache`) and returns a 404. This will prevent misses
from getting cached.


## Discussion points

To me, there doesn't seem to be a lot of test infra on serving the SPA
application. If that is an error, please indicate where that is and an
appropriate test can be added.
2024-05-15 15:07:07 +02:00
Mateusz Kwasniewski
6b59b30846
feat: backfill current stage on startup (#7057) 2024-05-15 12:47:01 +02:00
Christopher Kolstad
8aa0616698
feat: expose postgres version (#7041)
Adds a postgres_version gauge to allow us to see postgres_version in
prometheus and to post it upstream when version checking. Depends on
https://github.com/bricks-software/version-function/pull/20 to be merged
first to ensure our version-function doesn't crash when given the
postgres-version data.
2024-05-13 14:41:28 +02:00
Mateusz Kwasniewski
dfc065500d
feat: kept and discarded read model (#7045) 2024-05-13 14:24:31 +02:00
Jaanus Sellin
dac3f4a186
feat: webhook data for completed (#7043)
Now we post status and statusValue with webhook.
2024-05-13 12:18:02 +03:00
Jaanus Sellin
958ccabb54
feat: lifecycle prometheus metrics per project (#7032)
When we pushed metrics per feature, it had too many datapoints and
grafana could not handle it. Now I am taking median for a project.
2024-05-10 15:24:27 +03:00
Jaanus Sellin
8a2b977ac0
fix: fix prometheus metrics for lifecycle (#7030)
getAll was not properly tested, added test and fixed query. Now metrics
should come up.
2024-05-10 11:50:47 +03:00
Mateusz Kwasniewski
3fc7714e78
feat: Lifecycle in project overview (#7024) 2024-05-09 13:38:18 +02:00
Jaanus Sellin
79739a1d7f
feat: add completed status backend (#7022)
1. Implemented controller, service, store for status saving
2024-05-09 12:05:19 +03:00
Mateusz Kwasniewski
97d702afeb
feat: expose lifecycle stage in project overview search (#7017) 2024-05-09 10:50:51 +02:00
Jaanus Sellin
28a7797aea
feat: feature lifecycle completed schema (#7021)
1. Added new schema and tests
2. Controller also accepts the data
3. Also sending fake data from frontend currently

Next steps, implement service/store layer and frontend
2024-05-09 09:51:44 +03:00
Jaanus Sellin
8ea034cc2f
feat: add status fields for feature lifecycle table (#7014) 2024-05-09 09:39:01 +03:00
Ivar Conradi Østhus
64c10f9eff
poc: many strategies pagination (#7011)
This fixes the case when a customer have thousands of strategies causing
the react UI to crash. We still consider it incorrect to use that amount
of strategies and this is more a workaround to help the customer out of
a crashing state.

We put it behind a flag called `manyStrategiesPagination` and plan to
only enable it for the customer in trouble.
2024-05-08 14:20:51 +02:00
Jaanus Sellin
cd49ae2a26
feat: add project id to prometheus and feature flag (#7008)
Now we are also sending project id to prometheus, also querying from
database. This sets us up for grafana dashboard.
Also put the metrics behind flag, just incase it causes cpu/memory
issues.
2024-05-08 15:19:23 +03:00
Thomas Heartman
95ac2e6b8d
feat: generate project ids if they're missing (#7003)
This PR updates the project service to automatically create a project id
if it is not provided. The feature is behind a flag. If an ID is
provided, it will still attempt to use that ID instead.
2024-05-08 12:45:11 +02:00
Jaanus Sellin
02440dfed2
feat: duration in stage, add feature lifecycle prometheus metrics (#6973)
Introduce a new concept. Duration in stage.
Also add it into prometheus metric.
2024-05-08 11:33:51 +03:00
Thomas Heartman
861ae6aa93
chore: add automatic ID generation algorithm (#7001)
This PR adds a function to automatically generate a project ID on
creation. Using this when the id is missing will be handled in following
PRs.

The function uses the existing `slug` package to create a slug, and then
takes the 12 characters of a uuidv4 string to generate an ID.

The included tests check that the 12 character hash is added and that
the resulting string is url friendly (by checking that
`encodeURIComponent` doesn't change it).

We could also test a lot of edge cases (such as dealing with double
spaces, trimming the string, etc), but I think that's better handled by
the library itself (but you can check out what I removed in
2d9bcb6390
for an idea).

The function doesn't really need to be in the service; it could be moved to a util. But for proximity, I'll create it here first.
2024-05-08 07:26:35 +00:00
Egor Stronhin
8ae8cbbdb4
feat: Allow to use CA certificate file path for DB (#6985)
Regarding ticket #6892:

I would like to enable the use of a CA certificate without requiring
other certificates. This would be useful for AWS Helm, as AWS only
provides a single PEM file for DB connections.
2024-05-07 14:43:19 +02:00
Mateusz Kwasniewski
8ae78236d2
chore: remove project overview refactor flag (#6897) 2024-05-07 13:58:56 +02:00
Mateusz Kwasniewski
d1803b2e62
feat: increase possible number range for yes/no metrics (#6995) 2024-05-07 13:54:56 +02:00
Jaanus Sellin
206d0190ff
feat: create initial stages for features (#6983)
We are getting questions from engineers, why I do not see lifecycle. The
same will happen with our customers. Now customers will see lifecycle
component unified across features.
2024-05-07 11:38:51 +03:00
Jaanus Sellin
77d5156eba
feat: start exposing environment metrics from feature endpoint (#6986)
We want to start showing same donut that we do show in project page.
This is setting it up for UI.
2024-05-07 09:32:46 +03:00
Mateusz Kwasniewski
8d04772256
fix: duplicate column name in search query (#6989) 2024-05-06 19:26:23 +02:00
Jaanus Sellin
2c05f1a0ce
feat: search order by final (#6976)
Final rank has always been ordering correctly by default. But after 5.12
I see some issues that sometimes it is not ordered. Just to be extra
sure, I am for ordering it.
2024-05-03 13:30:12 +03:00
Jaanus Sellin
5c61667282
feat: add completed event as webhook event (#6968)
Now feature completed event can be used with webhook.
2024-05-02 14:48:33 +03:00
Christopher Kolstad
7754ac69df
task: added migration for scim_external_id (#6966) 2024-04-30 10:24:17 +02:00
andreas-unleash
979220d80d
chore: scheduled change request cache kill switch (#6957)
Removes the `inMemoryScheduledChangeRequests` flag and adds
`killScheduledChangeRequestCache`

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2024-04-30 09:33:42 +03:00
Jaanus Sellin
2ba250fa41
feat: do not insert into database stages that already exist (#6964)
Previously when we had thousands of metrics coming in, we were trying to
write them all to database and running into on conflict
2024-04-30 09:07:20 +03:00
Thomas Heartman
a66b3c65c1
chore: add flag for the new project creation form layout (#6959)
Add a flag to enable/disable the new UI for project creation.
This flag is separate from the impl on the back end so that we can
enable one without the other (but uses flag dependencies in Unleash, so
that we can never enable the new UI without the new back end).

I have not set the flag to `true` in server startup because the form
doesn't work yet, so it's a manual step for now.
2024-04-29 13:52:56 +02:00
Thomas Heartman
491cd588da
chore: remove workaround (#6942)
This PR removes the workaround introduced in
https://github.com/Unleash/unleash/pull/6931. After
https://github.com/ivarconr/unleash-enterprise/pull/1268 has been
merged, this should be safe to apply.

Notably, this PR: 
- tightens up the type for the enable change request function, so we can
use that to inform the code
- skips trying to do anything with an empty array

The last point is less important than it might seem because both the env
validation and the current implementation of the callback is essentially
a no-op when there are no envs. However, that's hard to enforce. If we
just exit out early, then at least we know nothing happens.

Optionally, we could do something like this instead, but I'm not sure
it's better or worse. Happy to take input.
```ts
            const crEnvs = newProject.changeRequestEnvironments ?? []
            await this.validateEnvironmentsExist(crEnvs.map((env) => env.name));
            const changeRequestEnvironments =
                await enableChangeRequestsForSpecifiedEnvironments(crEnvs,);

            data.changeRequestEnvironments = changeRequestEnvironments;
```
2024-04-29 13:47:47 +02:00
Tymoteusz Czech
b6865a5a9d
feat: Project owners UI (#6949)
---------

Co-authored-by: Thomas Heartman <thomas@getunleash.io>
2024-04-29 11:51:44 +02:00
gitar-bot[bot]
010c4ee57b
[Gitar] Cleaning up stale feature flag: applicationOverviewNewQuery with value true (#6956)
---------

Co-authored-by: Gitar Bot <noreply@gitar.co>
Co-authored-by: sjaanus <sellinjaanus@gmail.com>
2024-04-29 11:02:08 +03:00
Mateusz Kwasniewski
49e84d3a91
feat: Check production enabled live stage (#6952) 2024-04-26 13:38:25 +02:00
Mateusz Kwasniewski
1739f8e11d
feat: pre-live is non production not just dev (#6946) 2024-04-26 12:43:10 +02:00
Tymoteusz Czech
66ec9a2f2f
feat: project owners in project service (#6935)
Schema and integrating into service and controller for project owners

---------

Co-authored-by: Thomas Heartman <thomas@getunleash.io>
2024-04-26 12:07:11 +02:00
Jaanus Sellin
78b9299ff1
feat: feature lifecycle complete and uncomplete (#6927)
Creating a way to complete and uncomplete feature.
2024-04-26 11:38:42 +03:00
Mateusz Kwasniewski
31ab38e162
fix: ignore metrics for non-existent features (#6945) 2024-04-26 10:30:12 +02:00
Mateusz Kwasniewski
8ed15165d2
feat: revived feature goes to initial lifecycle stage (#6944) 2024-04-26 09:50:13 +02:00
Thomas Heartman
3fb53737c6
feat: include CR envs enabled on creation in event and update validation (#6931)
This PR improves the handling of change request enables on project
creation in two ways:

1. We now verify that the envs you try to enable CRs for exist before
passing them on to the enterprise functionality.
2. We include data about environments and change request environments in
the project created events.
2024-04-26 07:21:29 +02:00
Christopher Kolstad
cb40f35aeb
fix: don't apply bearer token middleware to root (#6939)
Conflicts with scim which assumes Bearer <token>, and is located under
/scim, with no /api prefix
2024-04-25 16:56:51 +02:00
Gastón Fournier
2400ffc67e
feat: remove bearer token middleware flag (#6934)
## About the changes
Removes the bearer token middleware flag for GA
2024-04-25 14:01:06 +00:00
Jaanus Sellin
68e7a3164e
fix: flag trends should support bigint for yes and no evaluations (#6930)
Recently we see some pods failing with inserting yes, no values that
were over int. Increasing type to bigint.
2024-04-25 14:02:04 +03:00
Tymoteusz Czech
34c1da58cc
feat: map project owners to projects list (#6928)
- Combining list of projects with owners
- Additional tests and checks
2024-04-25 11:26:39 +02:00
Mateusz Kwasniewski
44521c1c74
chore: remove variant dependencies flag (#6896) 2024-04-25 11:07:16 +02:00
Christopher Kolstad
af54e272d2
fix: added a check to avoid double counting (#6925)
Due to how we handle redirects of embedded proxy, we ended up counting
the same request twice. This PR adds a boolean to res.locals which we
then check if set to avoid double counting.
2024-04-25 10:08:23 +02:00
Mateusz Kwasniewski
574eb284b9
fix: client metrics structure lifecycle (#6924) 2024-04-25 09:27:20 +02:00
Tymoteusz Czech
477da7d514
Project owners read model - db read (#6916)
Implementation of the logic for fetching project owners.

Co-authored-by: Thomas Heartman <thomas@getunleash.io>
2024-04-25 09:23:11 +02:00
Mateusz Kwasniewski
f5061bc3ff
feat: return lifecycle state in feature overview (#6920) 2024-04-24 14:27:26 +02:00
Jaanus Sellin
e0ec5ed4b0
fix: now metrics in search will be aggregated across applications (#6915) 2024-04-24 12:10:39 +03:00
Jaanus Sellin
d578deab7f
chore: remove new frontend api feature flag (#6906)
The flag has been 100% for a bit now, we need to prepare for GA.
2024-04-24 09:15:57 +03:00
Gastón Fournier
8ec9a0f62d
chore: remove log (#6911)
This log is also not needed because we have the API status code 401 that
shows the same data
2024-04-23 12:48:34 +00:00
Gastón Fournier
61a689ccc7
chore: remove unnecessary logs (#6909) 2024-04-23 12:27:38 +00:00
Gastón Fournier
3e4ed38e2b
chore: remove logs for secret and change invalid token query logic (#6907)
## About the changes
What's going on is the following:
1. When a token is not found in the token's cache we try to find it in
the db
2. To prevent a denial of service attack using invalid tokens, we cache
the invalid tokens so we don't hit the db.
3. The issue is that we stored this token in the cache regardless we
found it or not. And if the token was valid the first time we'd add a
timestamp to avoid querying this token again the next time.
4. The next iteration the token should be in the cache:
54383a6578/src/lib/services/api-token-service.ts (L162)
but for some reason it is not and therefore we have to make a query. But
this is where the query prevention mechanism kicks in because it finds
the token in the cache and kicks us out. This PR fixes this by only
storing in the cache for misses if not found:
54383a6578/src/lib/services/api-token-service.ts (L164-L165)

The token was added to the cache because we were not checking if it had
expired. Now we added a check and we also have a log for expired tokens.
Some improvement opportunities:
- I don't think we display that a token has expired in the UI which
probably led to this issue
- When a token expired we don't display a specific error message or
error response saying that which is not very helpful for users
2024-04-23 11:44:59 +00:00
Gastón Fournier
dec107a597
chore: add a bunch of logs to validate api token validation behavior (#6905)
This change is meant to test something in sandbox. It will be reverted
after the investigation.
2024-04-23 11:14:54 +02:00
00Chaotic
13aa58e0e9
feat: allow admin login using demo auth (#6808)
This PR introduces a configuration option (`authentication.demoAllowAdminLogin`) that allows you to log in as admin when using demo authentication. To do this, use the username `admin`. 

## About the changes
The `admin` user currently cannot be accessed in `demo` authentication
mode, as the auth mode requires only an email to log in, and the admin
user is not created with an email. This change allows for logging in as
the admin user only if an `AUTH_DEMO_ALLOW_ADMIN_LOGIN` is set to `true`
(or the corresponding `authDemoAllowAdminLogin` config is enabled).

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

### Important files

[demo-authentication.ts](https://github.com/Unleash/unleash/compare/main...00Chaotic:unleash:feat/allow_admin_login_using_demo_auth?expand=1#diff-c166f00f0a8ca4425236b3bcba40a8a3bd07a98d067495a0a092eec26866c9f1R25)


## Discussion points
Can continue discussion of [this
comment](https://github.com/Unleash/unleash/pull/6447#issuecomment-2042405647)
in this PR.

---------

Co-authored-by: Thomas Heartman <thomasheartman+github@gmail.com>
2024-04-23 08:39:33 +02:00
Thomas Heartman
9ba6be6000
feat: add environments to project created payload (#6901)
This commit adds an `environments` property to the project created
payload. The list contains only the projects that the project has
enabled.

The point of adding it is that it gives you a better overview over
what you have created.
2024-04-22 14:37:45 +02:00
Thomas Heartman
b8380a0b5b
chore: add the projectListNewCards flag (#6898)
This PR adds the `projectListNewCards` flag to the constant defined in
`experimental.ts`. This should allow the API to pass that value to the
front end.
2024-04-22 10:50:21 +00:00
Gastón Fournier
ef91a5a8da
feat: crud time queries (#6895)
## About the changes
Add time metrics to relevant queries:
- get
- getAll
- bulkInsert
- count
- exists
- get

Ignored because might not be that relevant:
- insert
- delete
- deleteAll
- update
2024-04-22 09:31:37 +02:00
Gastón Fournier
126b78896e
feat: make edge use token's cache (#6893)
## About the changes
This PR removes the feature flag `queryMissingTokens` that was fully
rolled out.
It introduces a new way of checking edgeValidTokens controlled by the
flag `checkEdgeValidTokensFromCache` that relies in the cached data but
hits the DB if needed.

The assumption is that most of the times edge will find tokens in the
cache, except for a few cases in which a new token is queried. From all
tokens we expect at most one to hit the DB and in this case querying a
single token should be better than querying all the tokens.
2024-04-19 15:40:15 +02:00
Christopher Kolstad
ff6297d338
feat: Make Database SSL Configurable through files (#6892)
This makes it configurable either through a single JSON file with all
three certificates as separate keys or via separate files per
ca/cert/key key.

fixes #6718
2024-04-19 14:38:33 +02:00
Gastón Fournier
e6764a43c0
chore: Remove unused type (#6887)
This type was added to try to consolidate events now we're moving in a
different direction and this type is not used.
2024-04-18 16:52:14 +02:00
Christopher Kolstad
cf2bd28ff6
feat: use audit info in events (#6872)
I've tried to use/add the audit info to all events I could see/find.
This makes this PR necessarily huge, because we do store quite a few
events. 

I realise it might not be complete yet, but tests
run green, and I think we now have a pattern to follow for other events.
2024-04-18 16:32:35 +02:00