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

269 Commits

Author SHA1 Message Date
Christopher Kolstad
29b292f1ea
task: make count column bigint. (#8183)
We now have customers that exceed INT capacity, so we need to change
this to BIGINT in client_metrics_env_variants_daily as well.

Even heavy users only have about 10000 rows here, so should be a quick
enough operation.
2024-09-19 10:59:40 +02:00
Mateusz Kwasniewski
d220aaec0f
fix: editor can add dependencies in default project (#8077) 2024-09-04 11:25:32 +02:00
Jaanus Sellin
9eb80a8d48
chore: clear onboarding events (#8062)
Clearing onboarding tables, because the data is invalid and we want to
start tracking all of this for only new customers.
This migration must be applied after the new logic is implemented.
2024-09-03 16:27:11 +03:00
Jaanus Sellin
4079485338
feat: collect onboarding events in separate table (#8020) 2024-08-30 11:34:47 +03:00
Jaanus Sellin
3188f991f4
feat: start tracking user first login migration (#8006)
Start tracking user first login.
2024-08-28 16:27:09 +03:00
Thomas Heartman
9af42b3565
fix: add migration to normalize api token types (#7974)
Adds a migration to normalize api token types already in the database,
to remove any weird casing issues as currently demonstrated on sandbox


![image](https://github.com/user-attachments/assets/ad14db22-114d-4de2-b952-722df9ae84a4)

This is a companion piece to #7972
2024-08-23 13:29:49 +02:00
Jaanus Sellin
99e4a564d0
fix: fix events with no-project projects (#7951)
Fixes issue where `segment-created `events had fake project name
**no-project** attached.

In total for previous 4 months, all segments created that were global
segments, have this issue.


https://github.com/Unleash/unleash/pull/6872/files#diff-68dcd43b31d35a8a80c73bca1f2a9626b0234dd0b76920a6881b81fa04708268R135
2024-08-21 15:32:37 +03:00
Jaanus Sellin
624c6ce9c3
feat: events table type column index (#7838)
Adding index on even table type column, since we are running queries on
top of it.
2024-08-12 13:46:27 +03:00
Jaanus Sellin
ea057d1777
feat: add index on events created at (#7836)
After adding an index, the time for the new event search on 100k events
decreased from 5000ms to 4ms. This improvement is due to the query using
an index scan instead of a sequence scan.
2024-08-12 12:46:50 +03:00
Mateusz Kwasniewski
74de3ea72e
feat: archived at column in projects (#7782) 2024-08-07 10:00:37 +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
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
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
c4566baeac
chore: rename roles toggles to flag (#7123)
Running migration to update roles descriptions.
2024-05-23 12:01:04 +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
8ea034cc2f
feat: add status fields for feature lifecycle table (#7014) 2024-05-09 09:39:01 +03: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
Christopher Kolstad
7754ac69df
task: added migration for scim_external_id (#6966) 2024-04-30 10:24:17 +02: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
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
Gastón Fournier
0a2d40fb8b
feat: allow schedulers to run in a single node (#6794)
## About the changes
This PR provides a service that allows a scheduled function to run in a
single instance. It's currently not in use but tests show how to wrap a
function to make it single-instance:

65b7080e05/src/lib/features/scheduler/job-service.test.ts (L26-L32)

The key `'test'` is used to identify the group and most likely should
have the same name as the scheduled job.

---------

Co-authored-by: Christopher Kolstad <chriswk@getunleash.io>
2024-04-10 11:47:22 +02:00
andreas-unleash
5a5d909137
fix: environment_type_trends table data (#6796)
Creates a migration to fix the environment_type_trends table data.


---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
Co-authored-by: sjaanus <sellinjaanus@gmail.com>
2024-04-09 12:37:05 +03:00
Mateusz Kwasniewski
9dc9fb3586
feat: Feature lifecycle sql store (#6790) 2024-04-08 08:54:41 +02:00
Mateusz Kwasniewski
11f4155d5a
fix: revert archived column for backwards migration compatibility (#6737) 2024-03-29 13:00:33 +01:00
Christopher Kolstad
8e08df5c19
feat: add index on group name (#6696)
As the title says, adds an index on the group name. Scim (in particular
Azure) uses group names to find correct group to sync.
2024-03-26 14:48:05 +01:00
Simon Hornby
2747dcaba9
chore: add scim id migration for groups (#6682) 2024-03-25 11:39:11 +02:00
Christopher Kolstad
ca329da4b4
fix: scim id was not unique (#6450)
This PR drops the previous PRs scim_id idx and replaces it with an
actual UNIQUE index
2024-03-12 13:36:21 +01:00
Jaanus Sellin
ae38b81af1
chore: remove archived column from features table (#6431)
This column has not been used for 1.5 years and was replace by
**archived_at** column and people still get confused of why this is not
working as name suggests. Removing this column to remove technical debt.
2024-03-05 22:28:47 +02:00
andreas-unleash
1915b77b9b
Feat: add metrics summary columns to flag trends (#6440)
Adds the metrics summary trend columns to flag_trends table.
These will be populated with the rest of the weekly aggregations

Closes
[1-2139](https://linear.app/unleash/issue/1-2139/add-the-summary-columns-to-flag-trends-table)

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2024-03-05 16:49:17 +02:00
Christopher Kolstad
a44c3a3fa7
task: added scim id to user (#6439)
SCIM synchronizations requires a stable id no matter how many changes
are made to username and email (our other unique fields). In addition,
exposing internal incremented database ids to an external service (our
current id field) feels insecure. Our plan is to create either a uuidv7
or ulid when scim operations are performed against the user, so the
external scim provisioner has a stable globally unique id to use to
refer to the users they're modifying.
2024-03-05 14:48:19 +01:00
andreas-unleash
dc7a715386
Fix: add created at to environment type trends (#6437)
Add created_at to environment_type_trends table for easy sorting

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2024-03-05 15:10:13 +02:00
andreas-unleash
62361847f5
Feat: add enviroment type trends table (#6432)
Creates the environment_type_trends table to store aggregated metrics

Closes: #
[1-2124](https://linear.app/unleash/issue/1-2124/create-the-table-to-store-weekly-aggregation)

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2024-03-05 10:51:32 +02:00
Nuno Góis
b3e31c09a1
chore: rename incoming webhooks to signals (DB) (#6413)
https://linear.app/unleash/issue/2-1997/rename-feature-in-the-db

Renames the **incoming webhooks** feature to **signals** in the DB.

Also adds a `description` column to `action_sets`, so we can match the
new designs.
2024-03-04 10:28:19 +00:00
Mateusz Kwasniewski
68095916e8
fix: relax trends tables constraints (#6386) 2024-02-29 10:56:14 +01:00
Mateusz Kwasniewski
5a80d5e026
fix: project client metrics trends remove invalid insert (#6385) 2024-02-29 09:52:58 +01:00
andreas-unleash
7a08a121f0
feat: create the project-metrics-summary-trends table (#6313)
Adds a migration to create and fill the `project_metrics_summary_trends`

This table is to be used in enterprise to update the metrics data daily
per project (after the aggregation of the hourly data)

Driving force for this was doing performance testing on the executive
dashboard.
This will allow to remove the expensive query to aggregate the data on
demand and will drop the total response time from 2.5sec to 125ms
(measurements done with 100 Projects, 10000 features and over 1M rows in
`client_metrics_env_daily`

Closes #
[1-2080](https://linear.app/unleash/issue/1-2080/create-the-project-metrics-summary-trends-table)

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2024-02-22 17:21:08 +02:00
Nuno Góis
6246459926
chore: db drop action_states (#6300)
Follow up to: https://github.com/Unleash/unleash/pull/6298

We no longer need this table, since it was superseded by `action_events`
and is no longer used.
I believe it's safe to drop this table right away since the feature is
not being used yet.
2024-02-21 17:32:08 +00:00
Nuno Góis
4a4d5388d9
chore: action_set_events db table migration (#6298)
https://linear.app/unleash/issue/2-1962/implement-new-action-events-logic

Adds a new `action_set_events` table for the new action events logic.

Even though observable events are technically immutable, we're storing
the observable event along with the action set event. This allows us to
avoid 1 join while allowing us to persist action set event information
after deleting observable events, if we wish to do so at a later stage.
2024-02-21 14:02:19 +00:00
Nuno Góis
17c0d7137f
chore: add action state db indexes (#6283)
Adds some relevant indexes to `action_states`, useful for our new
"action events" query.
2024-02-20 15:45:33 +00:00
Tymoteusz Czech
b02f8005f1
migration: flag-trends - add users column (#6254)
Add `users` column to per-project trends.
2024-02-16 15:42:47 +01:00
David Leek
1b1bde8aec
chore: add migration for traffic data collection (#6171)
## About the changes

Adds migration for creating table `stat_traffic_usage`.
This table primary-keys on day, traffic_group, and status_code_series.
Adds individual indexes for day, traffic_group, and status_code_series.

Traffic group is the grouping for API endpoints for which traffic is
counted.
status_code_series is 200/202 etc = 200, 304 etc = 300
2024-02-09 09:58:58 +01:00
Jaanus Sellin
ecc200bf8a
feat: add index on events for faster revision id (#6170)
On all pods and instances, we run the same revision update query every
second. It is relatively fast when the application has started. This is
the single most ran query in unleash.
Benchmarks:

1. Running pod with existing revisionID:
  - old 5.5ms
  - new 0.028ms

2. New pod without existing revisionID
 - old 9.329ms
 - new 0.033ms



This query is getting optimized


7e66a79f9f/src/lib/features/events/event-store.ts (L161)
2024-02-08 14:11:58 +02:00
Jaanus Sellin
bc7d4b8edb
feat: add partial index on client_applications annouced FALSE (#6166)
We have customers with tens or hundreds of thousands of applications,
and we have a scheduler running that sets application fields to
`announced` as true. However, every time it runs, it queries the entire
table, which is slow and causes database connection acquisition issues.
To make it faster, we added a partial index to the table.
2024-02-08 10:57:10 +02:00
Mateusz Kwasniewski
82e84ec14d
feat: migration for health and time_to_production in flag trends (#6067) 2024-01-30 13:28:10 +01:00
David Leek
bbebd293e5
chore: add a migration that removes incorrectly set sysuserid (#6032)
## About the changes

Resets created_by_user_id on events incorrectly marked as -1337 when an actual user has been set in created_by column, to clean up after a bug
2024-01-29 09:16:18 +01:00
Mateusz Kwasniewski
a1fa5a4212
feat: flag trends db migration (#6044) 2024-01-26 14:37:15 +01:00
Mateusz Kwasniewski
8ab4aa3d0e
feat: user trends migration (#6030) 2024-01-25 12:56:29 +01:00
David Leek
0045fcbcdf
chore: replace systemUser -1 with new -1337 system user (#5999)
## About the changes
This PR replaces the old systemUser -1 in user-service.ts with the new
SYSTEM_USER -1337 and adds a migration to move events created_by = -1 to
-1337


## Discussion points
Does it make sense to do both of these things? Or should we skip the
migration? How would this behave in a large system with hundreds of
thousands of events, should this be split up?
2024-01-25 11:19:39 +01:00
andreas-unleash
8f3275ee40
chore: change users image_url column to text (#6031)
Change the image_url column to text

Closes #
https://github.com/orgs/Unleash/projects/8/views/1?pane=issue&itemId=51021534

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2024-01-25 11:40:18 +02:00