summaryrefslogtreecommitdiff
path: root/doc/development/application_limits.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/development/application_limits.md')
-rw-r--r--doc/development/application_limits.md35
1 files changed, 25 insertions, 10 deletions
diff --git a/doc/development/application_limits.md b/doc/development/application_limits.md
index b13e2994c52..1f7a9ff09b9 100644
--- a/doc/development/application_limits.md
+++ b/doc/development/application_limits.md
@@ -11,7 +11,7 @@ coordinate with others to [document](../administration/instance_limits.md)
and communicate those limits.
There is a guide about [introducing application
-limits](https://about.gitlab.com/handbook/product/product-management/process/index.html#introducing-application-limits).
+limits](https://about.gitlab.com/handbook/product/product-management/process/#introducing-application-limits).
## Development
@@ -21,7 +21,7 @@ In the `plan_limits` table, you have to create a new column and insert the
limit values. It's recommended to create separate migration script files.
1. Add new column to the `plan_limits` table with non-null default value
- that represents desired limit, eg:
+ that represents desired limit, such as:
```ruby
add_column(:plan_limits, :project_hooks, :integer, default: 100, null: false)
@@ -31,7 +31,7 @@ limit values. It's recommended to create separate migration script files.
enabled. You should use this setting only in special and documented circumstances.
1. (Optionally) Create the database migration that fine-tunes each level with
- a desired limit using `create_or_update_plan_limit` migration helper, eg:
+ a desired limit using `create_or_update_plan_limit` migration helper, such as:
```ruby
class InsertProjectHooksPlanLimits < ActiveRecord::Migration[5.2]
@@ -65,7 +65,7 @@ for plans that do not exist.
#### Get current limit
Access to the current limit can be done through the project or the namespace,
-eg:
+such as:
```ruby
project.actual_limits.project_hooks
@@ -76,13 +76,13 @@ project.actual_limits.project_hooks
There is one method `PlanLimits#exceeded?` to check if the current limit is
being exceeded. You can use either an `ActiveRecord` object or an `Integer`.
-Ensures that the count of the records does not exceed the defined limit, eg:
+Ensures that the count of the records does not exceed the defined limit, such as:
```ruby
project.actual_limits.exceeded?(:project_hooks, ProjectHook.where(project: project))
```
-Ensures that the number does not exceed the defined limit, eg:
+Ensures that the number does not exceed the defined limit, such as:
```ruby
project.actual_limits.exceeded?(:project_hooks, 10)
@@ -115,6 +115,20 @@ it_behaves_like 'includes Limitable concern' do
end
```
+### Testing instance-wide limits
+
+Instance-wide features always use `default` Plan, as instance-wide features
+do not have license assigned.
+
+```ruby
+class InstanceVariable
+ include Limitable
+
+ self.limit_name = 'instance_variables' # Optional as InstanceVariable corresponds with instance_variables
+ self.limit_scope = Limitable::GLOBAL_SCOPE
+end
+```
+
### Subscription Plans
Self-managed:
@@ -123,9 +137,10 @@ Self-managed:
GitLab.com:
-- `free` - Everyone
-- `bronze`- Namespaces with a Bronze subscription
-- `silver` - Namespaces with a Silver subscription
-- `gold` - Namespaces with a Gold subscription
+- `default` - Any system-wide feature
+- `free` - Namespaces and projects with a Free subscription
+- `bronze`- Namespaces and projects with a Bronze subscription
+- `silver` - Namespaces and projects with a Silver subscription
+- `gold` - Namespaces and projects with a Gold subscription
NOTE: **Note:** The test environment doesn't have any plans.