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
gitar-bot[bot]
5aaa4920dd
chore: [Gitar] Cleaning up stale flag: featureCollaborators with value true (#7820)
[![Gitar](https://raw.githubusercontent.com/gitarcode/.github/main/assets/gitar-banner.svg)](https://gitar.co)
  
  ---
This automated PR was generated by [Gitar](https://gitar.co). View
[docs](https://gitar.co/docs).

---------

Co-authored-by: Gitar <noreply@gitar.co>
Co-authored-by: Thomas Heartman <thomas@getunleash.io>
2024-08-09 11:12:26 +02:00
Jaanus Sellin
2f92dac14e
feat: event creators (#7809)
Adds an endpoint to return all event creators.

An interesting point is that it does not return the user object, but
just created_by as a string. This is because we do not store user IDs
for events, as they are not strictly bound to a user object, but rather
a historical user with the name X.
2024-08-09 10:32:31 +03:00
Mateusz Kwasniewski
bde81b940c
feat: prevent adding flags to archived project (#7811) 2024-08-09 09:00:19 +02:00
Tymoteusz Czech
413da2aa27
fix: don't show link stubs in slack notifications (#7810)
Slack is trying to add not useful link previews
2024-08-08 15:29:42 +02:00
Mateusz Kwasniewski
b65e593c23
chore: remove featureLifecycle and featureLifecycleMetrics flags (#7808) 2024-08-08 13:45:23 +02:00
Mateusz Kwasniewski
fffed5d8dc
feat: filter out archived projects from the main project list (#7803) 2024-08-08 13:22:44 +02:00
Mateusz Kwasniewski
3fe385e127
chore: remove flagCreator flag (#7807) 2024-08-08 12:19:32 +02:00
Mateusz Kwasniewski
8caa1e242c
feat: transactional project service support (#7799) 2024-08-07 16:34:55 +02:00
Mateusz Kwasniewski
0450bfe6f9
feat: archive project service (#7794) 2024-08-07 12:09:00 +02:00
Mateusz Kwasniewski
74de3ea72e
feat: archived at column in projects (#7782) 2024-08-07 10:00:37 +02:00
Simon Hornby
a507ca91a5
chore: remove scim api flag (#7780) 2024-08-07 09:19:42 +02:00
Thomas Heartman
440d6b48db
feat: make to date inclusive (#7775)
Changes the handling of the `to` query parameter in
the API to be inclusive.
2024-08-06 13:40:07 +00:00
Thomas Heartman
76bc7bf250
refactor: rename createdAtFrom/To to from/to (#7773)
Update the query parameter of the new event search API to match the
query parameters of the insights API
2024-08-06 15:02:44 +02:00
Mateusz Kwasniewski
f9665233cc
chore: archive projects flag (#7772) 2024-08-06 14:59:49 +02:00
Jaanus Sellin
0118f88964
fix: feature type is now validated (#7769)
Previously people were able to send random data to feature type. Now it
is validated.

Fixes https://github.com/Unleash/unleash/issues/7751

---------

Co-authored-by: Thomas Heartman <thomas@getunleash.io>
2024-08-06 12:27:20 +03:00
Jaanus Sellin
1a97515adf
feat: event search e2e tests (#7755)
This covers the e2e cases for event search.
2024-08-05 15:02:35 +03:00
Mateusz Kwasniewski
afa34867c1
fix: playground parent disabled with strategy (#7744) 2024-08-05 10:39:21 +02:00
Jaanus Sellin
57a8b9da79
feat: event search on new endpoint, first test (#7739)
Changed the url of event search to search/events to align with
search/features. With that created a search controller to keep all
searches under there.
Added first test.
2024-08-02 15:07:21 +03:00
Jaanus Sellin
bcb7a803d0
feat: new event search (#7708)
This introduces the new event search API, with paging.
2024-08-02 10:56:42 +03:00
Mateusz Kwasniewski
bbefff5d5a
refactor: rename rollback to more explicit rollbackTransaction (#7723) 2024-08-01 13:49:49 +02:00
Tymoteusz Czech
d1e70eefbe
feat: Remove orphaned tokens flags (#7714)
Cleanup of `allowOrphanedWildcardTokens` and `cleanApiTokenWhenOrphaned`
2024-08-01 13:31:52 +02:00
Thomas Heartman
0c53f7d21b
feat: create gauges for all resource limits (#7718)
This PR adds Grafana gauges for all the existing resource limits. The
primary purpose is to be able to use this in alerting. Secondarily, we
can also use it to get better insights into how many customers have
increased their limits, as well as how many people are approaching their
limit, regdardless of whether it's been increased or not.

## Discussion points

### Implementation

The first approach I took (in
87528b4c67),
was to add a new gauge for each resource limit. However, there's a lot
of boilerplate for it.

I thought doing it like this (the current implementation) would make it
easier. We should still be able to use the labelName to collate this in
Grafana, as far as I understand? As a bonus, we'd automatically get new
resource limits when we add them to the schema.

``` tsx
        const resourceLimit = createGauge({
            name: 'resource_limit',
            help: 'The maximum number of resources allowed.',
            labelNames: ['resource'],
        });

        // ...

        for (const [resource, limit] of Object.entries(config.resourceLimits)) {
            resourceLimit.labels({ resource }).set(limit);
        }
```

That way, when checking the stats, we should be able to do something
like this:

``` promql
resource_limit{resource="constraintValues"}
```

### Do we need to reset gauges?

I noticed that we reset gauges before setting values in them all over
the place. I don't know if that's necessary. I'd like to get that double
clarified before merging this.
2024-08-01 09:59:25 +02:00
Mateusz Kwasniewski
a4c49e7d7f
fix: rollback should await a result (#7712) 2024-07-31 16:46:15 +02:00
Nuno Góis
49fecb2005
chore: request origin prom metrics (#7709)
https://linear.app/unleash/issue/2-2501/adapt-origin-middleware-to-stop-logging-ui-requests-and-start

This adapts the new origin middleware to stop logging UI requests (too
noisy) and adds new Prometheus metrics.

<img width="745" alt="image"
src="https://github.com/user-attachments/assets/d0c7f51d-feb6-4ff5-b856-77661be3b5a9">

This should allow us to better analyze this data. If we see a lot of API
requests, we can dive into the logs for that instance and check the
logged data, like the user agent.

This PR adds some helper methods to make listening and emitting metric
events more strict in terms of types. I think it's a positive change
aligned with our scouting principle, but if you think it's complex and
does not belong here I'm happy with dropping it.
2024-07-31 13:52:39 +01:00
Mateusz Kwasniewski
987ba5ea0a
chore: composition root playground service (#7710) 2024-07-31 14:44:57 +02:00
Mateusz Kwasniewski
126dff2344
chore: change request playground flag (#7707) 2024-07-31 11:38:55 +02:00
Mateusz Kwasniewski
6170d10e62
feat: rollback transaction wrapper (#7706) 2024-07-31 10:22:05 +02:00
Nuno Góis
9fff29a080
chore: change log level to info in origin middleware (#7705)
https://linear.app/unleash/issue/2-2492/change-origin-middleware-log-level-to-info

Changes origin middleware log level to `info` instead of `debug`.
2024-07-31 09:01:48 +01:00
Jaanus Sellin
24e2c4030b
feat: new event search flag (#7699)
Add `newEventSearch` flag
2024-07-31 08:59:42 +02:00
Mateusz Kwasniewski
c828d01135
refactor: encapsulate playground limit in service (#7700) 2024-07-30 12:40:27 +02:00
Nuno Góis
50167d4f9e
chore: origin middleware (#7695)
https://linear.app/unleash/issue/2-2489/create-a-first-iteration-of-an-origin-middleware-that-logs-ui-and-api

Small spike around what the first iteration of an "origin middleware"
would look like.

No strong feelings all around, so feel free to tell me this is all wrong
and we should go a different route. However diving a little bit into it
personally helps me wrap my head around it, so it may help you too.
2024-07-30 10:42:50 +01:00
Tymoteusz Czech
1f2d47bd91
fix: on project delete with tokens put token deleted in audit log (#7675)
Use service with audit tracking instead of store directly.
2024-07-26 14:06:15 +02:00
Jaanus Sellin
1e3c690185
feat: tag feature on creation (#7664)
Now it is possible to tag feature on creation.
2024-07-25 13:36:28 +03:00
Tymoteusz Czech
369518cd7d
Feat: webhook markdown (#7658)
Add ability to format format event as Markdown in generic webhooks,
similar to Datadog integration.
Closes https://github.com/Unleash/unleash/issues/7646

Co-authored-by: Nuno Góis <github@nunogois.com>
2024-07-25 09:45:20 +00:00
Thomas Heartman
245c3e119d
chore: add flag configuration for the new flag creation flow (#7662)
Add a new flag and default it to true for local development.
2024-07-25 11:12:58 +02:00
Jaanus Sellin
0148481623
feat: update openapi schema for feature creation for tags (#7657)
Added tags support for schema.
2024-07-25 10:36:04 +03:00
Nuno Góis
8a20ae999f
chore: keep latest integration events for each integration configuration (#7652)
https://linear.app/unleash/issue/2-2469/keep-the-latest-event-for-each-integration-configuration

This makes it so we keep the latest event for each integration
configuration, along with the previous logic of keeping the latest 100
events of the last 2 hours.

This should be a cheap nice-to-have, since now we can always know what
the latest integration event looked like for each integration
configuration. This will tie-in nicely with the next task of making the
latest integration event state visible in the integration card.

Also improved the clarity of the auto-deletion explanation in the modal.
2024-07-24 13:52:57 +01:00
Thomas Heartman
e2b90ae91d
fix: add workaround for tooltip (#7649)
This PR adds the UI part of feature flag collaborators. Collaborators are hidden on windows smaller than size XL because we're not sure how to deal with them in those cases yet.
2024-07-24 09:33:29 +00:00
Nuno Góis
1d6dc9b195
chore: integration events API (#7639)
https://linear.app/unleash/issue/2-2439/create-new-integration-events-endpoint

https://linear.app/unleash/issue/2-2436/create-new-integration-event-openapi-schemas

This adds a new `/events` endpoint to the Addons API, allowing us to
fetch integration events for a specific integration configuration id.


![image](https://github.com/user-attachments/assets/e95b669e-e498-40c0-9d66-55be30a24c13)

Also includes:
- `IntegrationEventsSchema`: New schema to represent the response object
of the list of integration events;
- `yarn schema:update`: New `package.json` script to update the OpenAPI
spec file;
- `BasePaginationParameters`: This is copied from Enterprise. After
merging this we should be able to refactor Enterprise to use this one
instead of the one it has, so we don't repeat ourselves;

We're also now correctly representing the BIGSERIAL as BigInt (string +
pattern) in our OpenAPI schema. Otherwise our validation would complain,
since we're saying it's a number in the schema but in fact returning a
string.
2024-07-23 10:09:19 +01:00
Nuno Góis
9ff393b3d7
chore: register integration events in New Relic integration (#7636)
https://linear.app/unleash/issue/2-2462/register-integration-events-new-relic

Registers integration events in the **New Relic** integration.

Similar to:
- #7635
- #7634
- #7631
- #7626
- #7621
2024-07-23 10:07:31 +01:00
Nuno Góis
47ff73afb2
chore: register integration events in Datadog integration (#7635)
https://linear.app/unleash/issue/2-2461/register-integration-events-datadog

Registers integration events in the **Datadog** integration.

Similar to:
 - #7634 
 - #7631
 - #7626
 - #7621
2024-07-22 12:14:32 +01:00
Nuno Góis
e07ded9455
chore: register integration events in Teams integration (#7634)
https://linear.app/unleash/issue/2-2460/register-integration-events-teams

Registers integration events in the **Teams** integration.

Also includes slight improvements to the **Webhooks** integration.

Similar to:
 - #7631
 - #7626
 - #7621
2024-07-22 12:13:10 +01:00
Nuno Góis
1033276e97
chore: register integration events in Slack App integration (#7631)
https://linear.app/unleash/issue/2-2459/register-integration-events-slack-app

Registers integration events in the **Slack App** integration.

Similar to:
 - #7626
 - #7621
2024-07-22 11:54:19 +01:00
Thomas Heartman
a5223af702
fix: change "features flags" -> "feature flags" (#7632)
This typo has been around since the tag was introduced. About time we
fixed it.
2024-07-22 10:48:54 +02:00
Christopher Kolstad
71b2035dfb
chore: extend uiConfig schema with new SSO variables (#7628)
As the title says. Adds two new nullable variables to uiConfig. Used in
frontend to decide if SSO config is editable through the GUI
2024-07-19 12:39:34 +00:00
Mateusz Kwasniewski
71b3a2ae0a
feat: feature collaborators added to API behind a flag (#7627) 2024-07-19 14:34:22 +02:00
Nuno Góis
203b700e27
chore: register integration events in Slack integration (#7626)
https://linear.app/unleash/issue/2-2458/register-integration-events-slack

Registers integration events in the **Slack** integration.

Similar to: https://github.com/Unleash/unleash/pull/7621

Also slightly improves the previous work on webhooks.
2024-07-19 12:56:55 +01:00
Thomas Heartman
87fa5a2414
chore: allow you to lower constraint values even when they're above limit (#7624)
This PR allows you to gradually lower constraint values, even if they're
above the limits.

It does, however, come with a few caveats because of how Unleash deals
with constraints:
Constraints are just json blobs. They have no IDs or other
distinguishing features. Because of this, we can't compare the current
and previous state of a specific constraint.

What we can do instead, is to allow you to lower the amount of
constraint values if and only if the number of constraints hasn't
changed. In this case, we assume that you also haven't reordered the
constraints (not possible from the UI today). That way, we can compare
constraint values between updated and existing constraints based on
their index in the constraint list.

It's not foolproof, but it's a workaround that you can use. There's a
few edge cases that pop up, but that I don't think it's worth trying to
cover:

Case: If you **both** have too many constraints **and** too many
constraint values
Result: You won't be allowed to lower the amount of constraints as long
as the amount of strategy values is still above the limit.
Workaround: First, lower the amount of constraint values until you're
under the limit and then lower constraints. OR, set the constraint you
want to delete to a constraint that is trivially true (e.g. `currentTime
> yesterday` ). That will essentially take that constraint out of the
equation, achieving the same end result.

Case: You re-order constraints and at least one of them has too many
values
Result: You won't be allowed to (except for in the edge case where the
one with too many values doesn't move or switches places with another
one with the exact same amount of values).
Workaround: We don't need one. The order of constraints has no effect on
the evaluation.
2024-07-19 10:14:42 +00:00
Mateusz Kwasniewski
c3a00c07e1
feat: feature collaborators read model (#7625) 2024-07-19 12:10:21 +02:00
Nuno Góis
0869e39603
chore: register integration events in webhooks (#7621)
https://linear.app/unleash/issue/2-2450/register-integration-events-webhook

Registers integration events in the **Webhook** integration.

Even though this touches a lot of files, most of it is preparation for
the next steps. The only actual implementation of registering
integration events is in the **Webhook** integration. The rest will
follow on separate PRs.

Here's an example of how this looks like in the database table:

```json
{
  "id": 7,
  "integration_id": 2,
  "created_at": "2024-07-18T18:11:11.376348+01:00",
  "state": "failed",
  "state_details": "Webhook request failed with status code: ECONNREFUSED",
  "event": {
    "id": 130,
    "data": null,
    "tags": [],
    "type": "feature-environment-enabled",
    "preData": null,
    "project": "default",
    "createdAt": "2024-07-18T17:11:10.821Z",
    "createdBy": "admin",
    "environment": "development",
    "featureName": "test",
    "createdByUserId": 1
  },
  "details": {
    "url": "http://localhost:1337",
    "body": "{ \"id\": 130, \"type\": \"feature-environment-enabled\", \"createdBy\": \"admin\", \"createdAt\": \"2024-07-18T17: 11: 10.821Z\", \"createdByUserId\": 1, \"data\": null, \"preData\": null, \"tags\": [], \"featureName\": \"test\", \"project\": \"default\", \"environment\": \"development\" }"
  }
}
```
2024-07-19 10:07:52 +01:00
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