From d21bccc2076ad69bf35baa05deb2b9620a87c633 Mon Sep 17 00:00:00 2001 From: sabevzenko Date: Thu, 18 Jul 2024 14:04:03 +0300 Subject: [PATCH] e7d5c27e72236cb7d4ba6cff580b8fc65623d178 --- .mapping.json | 18 +++- docs/README.md | 10 ++- docs/content/en/aggregator/_index.md | 61 ++++++++++++++ docs/content/en/aggregator/sink.md | 28 +++++++ docs/content/en/best-practices/_index.md | 2 +- docs/content/en/generator/dummy-generator.md | 16 ++++ docs/content/en/provider/_index.md | 7 ++ docs/content/en/provider/data-sources.md | 35 ++++++++ docs/content/en/provider/dummy-provider.md | 20 +++++ .../http-provider.md} | 2 +- docs/content/en/provider/json-provider.md | 46 +++++++++++ docs/content/ru/aggregator/_index.md | 82 +++++++++++++++++++ docs/content/ru/aggregator/sink.md | 28 +++++++ docs/content/ru/best-practices/_index.md | 2 +- docs/content/ru/generator/dummy-generator.md | 16 ++++ docs/content/ru/get-started/architecture.md | 4 +- docs/content/ru/provider/_index.md | 7 ++ docs/content/ru/provider/data-sources.md | 35 ++++++++ docs/content/ru/provider/dummy-provider.md | 21 +++++ .../http-provider.md} | 2 +- docs/content/ru/provider/json-provider.md | 46 +++++++++++ docs/layouts/partials/section-index.html | 2 +- 22 files changed, 480 insertions(+), 10 deletions(-) create mode 100644 docs/content/en/aggregator/_index.md create mode 100644 docs/content/en/aggregator/sink.md mode change 100755 => 100644 docs/content/en/best-practices/_index.md create mode 100644 docs/content/en/generator/dummy-generator.md create mode 100644 docs/content/en/provider/_index.md create mode 100644 docs/content/en/provider/data-sources.md create mode 100644 docs/content/en/provider/dummy-provider.md rename docs/content/en/{providers.md => provider/http-provider.md} (99%) create mode 100644 docs/content/en/provider/json-provider.md create mode 100644 docs/content/ru/aggregator/_index.md create mode 100644 docs/content/ru/aggregator/sink.md mode change 100755 => 100644 docs/content/ru/best-practices/_index.md create mode 100644 docs/content/ru/generator/dummy-generator.md create mode 100644 docs/content/ru/provider/_index.md create mode 100644 docs/content/ru/provider/data-sources.md create mode 100644 docs/content/ru/provider/dummy-provider.md rename docs/content/ru/{providers.md => provider/http-provider.md} (99%) create mode 100644 docs/content/ru/provider/json-provider.md diff --git a/.mapping.json b/.mapping.json index ff86b40d9..ecb72bf4c 100644 --- a/.mapping.json +++ b/.mapping.json @@ -275,12 +275,15 @@ "docs/assets/scss/_variables_project.scss":"load/projects/pandora/docs/assets/scss/_variables_project.scss", "docs/config.yaml":"load/projects/pandora/docs/config.yaml", "docs/content/en/_index.md":"load/projects/pandora/docs/content/en/_index.md", + "docs/content/en/aggregator/_index.md":"load/projects/pandora/docs/content/en/aggregator/_index.md", + "docs/content/en/aggregator/sink.md":"load/projects/pandora/docs/content/en/aggregator/sink.md", "docs/content/en/best-practices/_index.md":"load/projects/pandora/docs/content/en/best-practices/_index.md", "docs/content/en/best-practices/discard-overflow.md":"load/projects/pandora/docs/content/en/best-practices/discard-overflow.md", "docs/content/en/best-practices/rps-per-instance.md":"load/projects/pandora/docs/content/en/best-practices/rps-per-instance.md", "docs/content/en/best-practices/shared-client.md":"load/projects/pandora/docs/content/en/best-practices/shared-client.md", "docs/content/en/generator/_index.md":"load/projects/pandora/docs/content/en/generator/_index.md", "docs/content/en/generator/custom.md":"load/projects/pandora/docs/content/en/generator/custom.md", + "docs/content/en/generator/dummy-generator.md":"load/projects/pandora/docs/content/en/generator/dummy-generator.md", "docs/content/en/generator/grpc-generator.md":"load/projects/pandora/docs/content/en/generator/grpc-generator.md", "docs/content/en/generator/http-generator.md":"load/projects/pandora/docs/content/en/generator/http-generator.md", "docs/content/en/generator/scenario-grpc-generator.md":"load/projects/pandora/docs/content/en/generator/scenario-grpc-generator.md", @@ -296,16 +299,23 @@ "docs/content/en/get-started/tutorial.md":"load/projects/pandora/docs/content/en/get-started/tutorial.md", "docs/content/en/load-profile.md":"load/projects/pandora/docs/content/en/load-profile.md", "docs/content/en/performance.md":"load/projects/pandora/docs/content/en/performance.md", - "docs/content/en/providers.md":"load/projects/pandora/docs/content/en/providers.md", + "docs/content/en/provider/_index.md":"load/projects/pandora/docs/content/en/provider/_index.md", + "docs/content/en/provider/data-sources.md":"load/projects/pandora/docs/content/en/provider/data-sources.md", + "docs/content/en/provider/dummy-provider.md":"load/projects/pandora/docs/content/en/provider/dummy-provider.md", + "docs/content/en/provider/http-provider.md":"load/projects/pandora/docs/content/en/provider/http-provider.md", + "docs/content/en/provider/json-provider.md":"load/projects/pandora/docs/content/en/provider/json-provider.md", "docs/content/en/search.md":"load/projects/pandora/docs/content/en/search.md", "docs/content/en/startup.md":"load/projects/pandora/docs/content/en/startup.md", "docs/content/ru/_index.md":"load/projects/pandora/docs/content/ru/_index.md", + "docs/content/ru/aggregator/_index.md":"load/projects/pandora/docs/content/ru/aggregator/_index.md", + "docs/content/ru/aggregator/sink.md":"load/projects/pandora/docs/content/ru/aggregator/sink.md", "docs/content/ru/best-practices/_index.md":"load/projects/pandora/docs/content/ru/best-practices/_index.md", "docs/content/ru/best-practices/discard-overflow.md":"load/projects/pandora/docs/content/ru/best-practices/discard-overflow.md", "docs/content/ru/best-practices/rps-per-instance.md":"load/projects/pandora/docs/content/ru/best-practices/rps-per-instance.md", "docs/content/ru/best-practices/shared-client.md":"load/projects/pandora/docs/content/ru/best-practices/shared-client.md", "docs/content/ru/generator/_index.md":"load/projects/pandora/docs/content/ru/generator/_index.md", "docs/content/ru/generator/custom.md":"load/projects/pandora/docs/content/ru/generator/custom.md", + "docs/content/ru/generator/dummy-generator.md":"load/projects/pandora/docs/content/ru/generator/dummy-generator.md", "docs/content/ru/generator/grpc-generator.md":"load/projects/pandora/docs/content/ru/generator/grpc-generator.md", "docs/content/ru/generator/http-generator.md":"load/projects/pandora/docs/content/ru/generator/http-generator.md", "docs/content/ru/generator/scenario-grpc-generator.md":"load/projects/pandora/docs/content/ru/generator/scenario-grpc-generator.md", @@ -321,7 +331,11 @@ "docs/content/ru/get-started/tutorial.md":"load/projects/pandora/docs/content/ru/get-started/tutorial.md", "docs/content/ru/load-profile.md":"load/projects/pandora/docs/content/ru/load-profile.md", "docs/content/ru/performance.md":"load/projects/pandora/docs/content/ru/performance.md", - "docs/content/ru/providers.md":"load/projects/pandora/docs/content/ru/providers.md", + "docs/content/ru/provider/_index.md":"load/projects/pandora/docs/content/ru/provider/_index.md", + "docs/content/ru/provider/data-sources.md":"load/projects/pandora/docs/content/ru/provider/data-sources.md", + "docs/content/ru/provider/dummy-provider.md":"load/projects/pandora/docs/content/ru/provider/dummy-provider.md", + "docs/content/ru/provider/http-provider.md":"load/projects/pandora/docs/content/ru/provider/http-provider.md", + "docs/content/ru/provider/json-provider.md":"load/projects/pandora/docs/content/ru/provider/json-provider.md", "docs/content/ru/search.md":"load/projects/pandora/docs/content/ru/search.md", "docs/content/ru/startup.md":"load/projects/pandora/docs/content/ru/startup.md", "docs/docsy.work":"load/projects/pandora/docs/docsy.work", diff --git a/docs/README.md b/docs/README.md index 481ce6741..58f7300fa 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,4 +1,12 @@ -# Docsy Example +# Pandora documentation with Docsy theme + +## Quick start + +```shell +hugo server +``` + +## Docsy [Docsy][] is a [Hugo theme module][] for technical documentation sites, providing easy site navigation, structure, and more. This **Docsy Example Project** uses the Docsy diff --git a/docs/content/en/aggregator/_index.md b/docs/content/en/aggregator/_index.md new file mode 100644 index 000000000..1569a1501 --- /dev/null +++ b/docs/content/en/aggregator/_index.md @@ -0,0 +1,61 @@ +--- +title: Aggregator +description: +categories: [Aggregator] +weight: 10 +--- + +The aggregator collects samples and stores them somewhere. + +### 1. phout + +**All config** + +```yaml +result: + type: phout + destination: file_path.log + id: false # Print ammo ids if true. + flush-time: 1s + sample-queue-size: 262144 + buffer-size: 1048576 +``` + +### 2. jsonlines + +```yaml +result: + type: jsonlines + sink: + type: file + path: file_path + buffer-size: 1048576 + flush-interval: 1s + sample-queue-size: 131072 + marshal-float-with-6-digits: false + sort-map-keys: false +``` + +See [here](./sink.md) for other types for `sink`. + +### 3. json + +This is an alias for `jsonlines`. + +### 4. log + +Output aggregator data to Pandora's standard logs + +```yaml +result: + type: log +``` + +### 5. discard + +Discard aggregator output + +```yaml +result: + type: discard +``` diff --git a/docs/content/en/aggregator/sink.md b/docs/content/en/aggregator/sink.md new file mode 100644 index 000000000..7e5b25270 --- /dev/null +++ b/docs/content/en/aggregator/sink.md @@ -0,0 +1,28 @@ +--- +title: Sink +description: +categories: [Aggregators] +weight: 2 +--- + +1. file + +```yaml +sink: + type: file + path: file_path +``` + +2. stdout + +```yaml +sink: + type: stdout +``` + +3. stderr + +```yaml +sink: + type: stderr +``` diff --git a/docs/content/en/best-practices/_index.md b/docs/content/en/best-practices/_index.md old mode 100755 new mode 100644 index 4a2ca4449..630c411df --- a/docs/content/en/best-practices/_index.md +++ b/docs/content/en/best-practices/_index.md @@ -2,5 +2,5 @@ title: Best practices description: categories: [Best practices] -weight: 6 +weight: 12 --- \ No newline at end of file diff --git a/docs/content/en/generator/dummy-generator.md b/docs/content/en/generator/dummy-generator.md new file mode 100644 index 000000000..e86e69e62 --- /dev/null +++ b/docs/content/en/generator/dummy-generator.md @@ -0,0 +1,16 @@ +--- +title: Dummy generator +description: Dummy generator is used to check load profiles +categories: [Provider] +tags: [provider, dummy] +weight: 1 +--- + +When you are creating a complex load profile that consists of multiple phases, or just want to test +what your load profile will look like, you can use the Dummy Generator to keep your test server unloaded in the first stage. + +```yaml +gun: + type: dummy + sleep: 10ms # optional +``` \ No newline at end of file diff --git a/docs/content/en/provider/_index.md b/docs/content/en/provider/_index.md new file mode 100644 index 000000000..47af30e66 --- /dev/null +++ b/docs/content/en/provider/_index.md @@ -0,0 +1,7 @@ +--- +title: Providers +description: Pandora component responsible for generating Payload from files for the generator +categories: [Providers] +weight: 3 +--- + diff --git a/docs/content/en/provider/data-sources.md b/docs/content/en/provider/data-sources.md new file mode 100644 index 000000000..f98486813 --- /dev/null +++ b/docs/content/en/provider/data-sources.md @@ -0,0 +1,35 @@ +--- +title: Data Sources +description: To simplify the implementation of your custom generators +categories: [Provider] +tags: [provider, dummy] +weight: 40 +--- + +Used for json providers + +There are 3 data sources + +1. `file` + +```yaml +source: + type: file + path: you_path +``` + +2. `stdin` + +```yaml +source: + type: stdin +``` + +3. `inline` + +```yaml +source: + type: inline + data: | + {"you": "json"} +``` diff --git a/docs/content/en/provider/dummy-provider.md b/docs/content/en/provider/dummy-provider.md new file mode 100644 index 000000000..3d33e78f1 --- /dev/null +++ b/docs/content/en/provider/dummy-provider.md @@ -0,0 +1,20 @@ +--- +title: Dummy Provider +description: Dummy provider is used for generators without external Payload. +categories: [Provider] +tags: [provider, dummy] +weight: 30 +--- + +Pandora requires a Provider configuration. But there are cases where you don't need any Payload. +In such cases, you can use an empty `dummy` Provider + +```yaml +ammo: +type: dummy +``` + +This provider is useful in 2 cases: + +1. for checks on your payload profile configuration +2. for custom generators, where you prepare your Payloads inside the generator \ No newline at end of file diff --git a/docs/content/en/providers.md b/docs/content/en/provider/http-provider.md similarity index 99% rename from docs/content/en/providers.md rename to docs/content/en/provider/http-provider.md index 1c4117f07..542f977c1 100644 --- a/docs/content/en/providers.md +++ b/docs/content/en/provider/http-provider.md @@ -3,7 +3,7 @@ title: HTTP Ammo providers description: HTTP Ammo provider is a source of test data - it makes ammo object categories: [Provider] tags: [provider, http] -weight: 6 +weight: 10 --- HTTP Ammo provider is a source of test data: it makes ammo object. diff --git a/docs/content/en/provider/json-provider.md b/docs/content/en/provider/json-provider.md new file mode 100644 index 000000000..d766d7062 --- /dev/null +++ b/docs/content/en/provider/json-provider.md @@ -0,0 +1,46 @@ +--- +title: JSON provider +description: JSON provider converts to Payload json files +categories: [Provider] +tags: [provider, json] +weight: 20 +--- + +The provider reads the payload files and passes a structure of the desired type to the generators. + +Since you cannot use your own structures in the default build, the default provider returns +`map[string]interface{}{}` + +But this provider is convenient for creating custom generators. +You only need to specify your type into which you want to marshal the json file + +```go +import ( + "github.com/yandex/pandora/core" + coreimport "github.com/yandex/pandora/core/import" +) + +type MyCustomPayload struct { + URL string + QueryParam string +} + +//... +coreimport.RegisterCustomJSONProvider("my-custom-provider-name", func() core.Ammo { return &MyCustomPayload{} }) +//... +``` + +And specify your ISP in the config + +```yaml +provider: + type: my-custom-provider-name + ammo-queue-size: 1 + limit: 0 + passes: 0 + source: + type: file + path: my-costom-payload.json +``` + +You can also use `stdin`, `inline` for the source. See [payload sources](data-sources.md) for more details \ No newline at end of file diff --git a/docs/content/ru/aggregator/_index.md b/docs/content/ru/aggregator/_index.md new file mode 100644 index 000000000..efa34f0e6 --- /dev/null +++ b/docs/content/ru/aggregator/_index.md @@ -0,0 +1,82 @@ +--- +title: Аггрегатор +description: +categories: [Aggregator] +weight: 10 +--- + +Агрегатор собирает замеры запросов и сохраняет их в каком-нибудь месте. + + +### 1. phout + +**Минимальный конфиг** + +```yaml +result: + type: phout + destination: file_path.log +``` + +**Весь конфиг** + +```yaml +result: + type: phout + destination: file_path.log + id: false # Print ammo ids if true. + flush-time: 1s + sample-queue-size: 262144 + buffer-size: 1048576 +``` + +### 2. jsonlines + +**Минимальный конфиг** + +```yaml +result: + type: jsonlines + sink: + type: file + path: file_path +``` + +**Весь конфиг** + +```yaml +result: + type: jsonlines + sink: + type: file + path: file_path + buffer-size: 1048576 + flush-interval: 1s + sample-queue-size: 131072 + marshal-float-with-6-digits: false + sort-map-keys: false +``` + +Какие еще типы для `sink` существуют смотрите [тут](./sink.md) + +### 3. json + +Эта псевдоним для `jsonlines` + +### 4. log + +Вывод данных аггрегатора в о стандартный лог Пандоры + +```yaml +result: + type: log +``` + +### 5. discard + +Отказ от вывода аггрегатора + +```yaml +result: + type: discard +``` \ No newline at end of file diff --git a/docs/content/ru/aggregator/sink.md b/docs/content/ru/aggregator/sink.md new file mode 100644 index 000000000..7e5b25270 --- /dev/null +++ b/docs/content/ru/aggregator/sink.md @@ -0,0 +1,28 @@ +--- +title: Sink +description: +categories: [Aggregators] +weight: 2 +--- + +1. file + +```yaml +sink: + type: file + path: file_path +``` + +2. stdout + +```yaml +sink: + type: stdout +``` + +3. stderr + +```yaml +sink: + type: stderr +``` diff --git a/docs/content/ru/best-practices/_index.md b/docs/content/ru/best-practices/_index.md old mode 100755 new mode 100644 index df0ccdd90..902d5bc50 --- a/docs/content/ru/best-practices/_index.md +++ b/docs/content/ru/best-practices/_index.md @@ -2,5 +2,5 @@ title: Лучшие практики description: categories: [Best practices] -weight: 6 +weight: 12 --- \ No newline at end of file diff --git a/docs/content/ru/generator/dummy-generator.md b/docs/content/ru/generator/dummy-generator.md new file mode 100644 index 000000000..1d7aa41fc --- /dev/null +++ b/docs/content/ru/generator/dummy-generator.md @@ -0,0 +1,16 @@ +--- +title: Dummy генератор +description: Dummy генератор используется для проверки профилей нагрузки +categories: [Provider] +tags: [provider, dummy] +weight: 1 +--- + +Когда вы создаете сложную нагрузку, которая состоит из нескольких этапов, или просто хотите проверить, +как будет выглядеть ваш профиль нагрузки, вы можете использовать Dummy Generator, чтобы на первом этапе не нагружать ваш тестовый сервер. + +```yaml +gun: + type: dummy + sleep: 10ms # опционально +``` \ No newline at end of file diff --git a/docs/content/ru/get-started/architecture.md b/docs/content/ru/get-started/architecture.md index c9030b51e..9b0def2d9 100644 --- a/docs/content/ru/get-started/architecture.md +++ b/docs/content/ru/get-started/architecture.md @@ -58,6 +58,6 @@ You can also combine two methods mentioned above. Instances takes an ammo, waits for a Scheduler tick and then shoots with a Gun it has. Gun is a tool that sends a request to your service and measures the parameters (time, error codes, etc.) of the response. -### Aggregator +### Агрегатор -Aggregator collects measured samples and saves them somewhere. +Агрегатор собирает замеры запросов и сохраняет их в каком-нибудь месте. diff --git a/docs/content/ru/provider/_index.md b/docs/content/ru/provider/_index.md new file mode 100644 index 000000000..ec27a7e1b --- /dev/null +++ b/docs/content/ru/provider/_index.md @@ -0,0 +1,7 @@ +--- +title: Провайдеры +description: Компонент Pandora отвечающий за формирование Payload из файлов для генератора +categories: [Providers] +weight: 3 +--- + diff --git a/docs/content/ru/provider/data-sources.md b/docs/content/ru/provider/data-sources.md new file mode 100644 index 000000000..6b35e6c32 --- /dev/null +++ b/docs/content/ru/provider/data-sources.md @@ -0,0 +1,35 @@ +--- +title: Источники Payload +description: Для упрощения реализации ваших кастомных генераторов +categories: [Provider] +tags: [provider, dummy] +weight: 40 +--- + +Используется для json провайдеров + +Есть 3 источника + +1. `file` + +```yaml +source: + type: file + path: you_path +``` + +2. `stdin` + +```yaml +source: + type: stdin +``` + +3. `inline` + +```yaml +source: + type: inline + data: | + {"you": "json"} +``` diff --git a/docs/content/ru/provider/dummy-provider.md b/docs/content/ru/provider/dummy-provider.md new file mode 100644 index 000000000..e7c068a47 --- /dev/null +++ b/docs/content/ru/provider/dummy-provider.md @@ -0,0 +1,21 @@ +--- +title: Dummy провайдер +description: Dummy провайдер используется для генераторов без внешних Payload +categories: [Provider] +tags: [provider, dummy] +weight: 30 +--- + +Pandora требует конфигурацию Провайдера. Но есть случаи, когда вам не нужны какие-либо Payload. +В таких случаях можно использовать пустой `dummy` Провайдер + +```yaml +ammo: + type: dummy +``` + +Данный провайдер полезен в 2-х случаях: + +1. для проверок вашей конфигурации профиля нагрузки +2. для кастомных генераторов, где ваши Payload вы подготавливаете внутри генератора + diff --git a/docs/content/ru/providers.md b/docs/content/ru/provider/http-provider.md similarity index 99% rename from docs/content/ru/providers.md rename to docs/content/ru/provider/http-provider.md index 217eb05c4..ec7ce76d3 100644 --- a/docs/content/ru/providers.md +++ b/docs/content/ru/provider/http-provider.md @@ -3,7 +3,7 @@ title: HTTP провайдер description: HTTP провайдер это источник тестовых данных, который создает объекты Payload categories: [Provider] tags: [provider, http] -weight: 6 +weight: 10 --- Провайдер HTTP является источником тестовых данных: он создает объект Payload. diff --git a/docs/content/ru/provider/json-provider.md b/docs/content/ru/provider/json-provider.md new file mode 100644 index 000000000..39a1295ec --- /dev/null +++ b/docs/content/ru/provider/json-provider.md @@ -0,0 +1,46 @@ +--- +title: JSON провайдер +description: JSON провайдер преобразует в Payload json файлы +categories: [Provider] +tags: [provider, json] +weight: 20 +--- + +Данные провайдер читает payload файлы и передает в генераторы структуру нужного типа. + +Так как в дефолтной сборке нельзя использовать свои собственные структуры дефолтный провайдер возвращает +`map[string]interface{}{}` + +Но данный провайдер удобен для создания пользовательских генераторов. +Вам достаточно только указать свой тип, в который необходимо маршалить json файл + +```go +import ( + "github.com/yandex/pandora/core" + coreimport "github.com/yandex/pandora/core/import" +) + +type MyCustomPayload struct { + URL string + QueryParam string +} + +//... +coreimport.RegisterCustomJSONProvider("my-custom-provider-name", func() core.Ammo { return &MyCustomPayload{} }) +//... +``` + +И в конфиге указать свой провайдер + +```yaml +provider: + type: my-custom-provider-name + ammo-queue-size: 1 + limit: 0 + passes: 0 + source: + type: file + path: my-costom-payload.json +``` + +Для источника можно так же использовать `stdin`, `inline`. Подробнее смотрите [источники payload](data-sources.md) \ No newline at end of file diff --git a/docs/layouts/partials/section-index.html b/docs/layouts/partials/section-index.html index dfbac795f..7943d237a 100644 --- a/docs/layouts/partials/section-index.html +++ b/docs/layouts/partials/section-index.html @@ -37,7 +37,7 @@

{{ end -}} {{ else }} {{ $manualLink := cond (isset .Params "manuallink") .Params.manualLink ( cond (isset .Params "manuallinkrelref") (relref . .Params.manualLinkRelref) .RelPermalink) }} -
+

{{- .Title -}}