Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gravitee-io/gravitee-policy-latency
https://github.com/gravitee-io/gravitee-policy-latency
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/gravitee-io/gravitee-policy-latency
- Owner: gravitee-io
- License: apache-2.0
- Created: 2017-05-11T08:14:33.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-04-19T22:54:50.000Z (9 months ago)
- Last Synced: 2024-04-20T18:15:13.357Z (9 months ago)
- Language: Java
- Size: 63.5 KB
- Stars: 0
- Watchers: 28
- Forks: 4
- Open Issues: 7
-
Metadata Files:
- Readme: README.adoc
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.adoc
- License: LICENSE.txt
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
= Latency policy
ifdef::env-github[]
image:https://img.shields.io/static/v1?label=Available%20at&message=Gravitee.io&color=1EC9D2["Gravitee.io", link="https://download.gravitee.io/#graviteeio-apim/plugins/policies/gravitee-policy-latency/"]
image:https://img.shields.io/badge/License-Apache%202.0-blue.svg["License", link="https://github.com/gravitee-io/gravitee-policy-latency/blob/master/LICENSE.txt"]
image:https://img.shields.io/badge/semantic--release-conventional%20commits-e10079?logo=semantic-release["Releases", link="https://github.com/gravitee-io/gravitee-policy-latency/releases"]
image:https://circleci.com/gh/gravitee-io/gravitee-policy-latency.svg?style=svg["CircleCI", link="https://circleci.com/gh/gravitee-io/gravitee-policy-latency"]
endif::[]== Compatibility with APIM
|===
|Plugin version | APIM version| Up to 1.3.x | Up to 3.9.x
| 1.4.x | Up to 3.20
| 2.x | 4.x to latest
|====== V3 engine
[cols="4*", options="header"]
|===
^|onRequest
^|onResponse
^|onRequestContent
^|onResponseContent^.^| X
^.^|
^.^|
^.^|
|====== V4 engine
[cols="4*", options="header"]
|===
^|onRequest
^|onResponse
^|onMessageRequest
^|onMessageResponse^.^| X
^.^|
^.^| X
^.^| X
|===== Description
You can use the latency policy to add latency to either the request or the response. So for example, if you configure the policy on the request with a latency of 100ms, the gateway waits 100ms before routing the request to the backend service.
This policy is particularly useful in two scenarios:
* Testing: adding latency allows you to test client applications when APIs are slow to respond.
* Monetization: a longer latency can be added to free plans to encourage clients to move to a better (or paid) plan.|===
== Configuration
You can configure the policy with the following options:
|===
|Property |Required |Description |Type| Default.^|time
^.^|
|Time to wait (`ms`)
^.^|integer
^.^|`100`.^|timeUnit
^.^|
|Time unit ( `"MILLISECONDS"` or `"SECONDS"`)
^.^|string
^.^|`"MILLISECONDS"`|===
== Errors
== HTTP status code
|===
|Code |Message.^| ```500```
| Server error|===