-
Notifications
You must be signed in to change notification settings - Fork 82
feat(docs): artillery integration example #3664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
3b7e512
feat(docs): artillery integration example
3bd842b
fix testFile key
5beb366
remove token
25ac460
--wip-- [skip ci]
schoren 1f16a39
--wip-- [skip ci]
schoren 02f2fdb
set basic flow
schoren 904220d
adding shared context
xoscar c6137a6
fix examples
schoren 29972ff
Merge branch 'quickstart-artillery' of github.com:kubeshop/tracetest …
xoscar ef99ad3
Merge branch 'main' into quickstart-artillery
xoscar c008696
.
xoscar 919aec3
cleanup
xoscar 56cb7f7
adding recipies and examples
xoscar 72f14e4
cleanup
xoscar f57eb94
Merge branch 'main' into quickstart-artillery
xoscar 1545f2b
chore(examples): Adding Artillery + Playwright + Tracetest example (#…
xoscar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TRACETEST_AGENT_API_KEY= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.env | ||
node_modules |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Tracetest + Artillery | ||
|
||
> [Read the detailed recipe for setting up Tracetest + Artillery in our documentation.](https://docs.tracetest.io/tools-and-integrations/artillery) | ||
|
||
This is a quick start showing how you can create programs to run trace-based tests from your Artillery setup utilizing the tracetest engine and plugin. The example shows how to define the Tracetest tests, execute them, and wait for results to be ready. [Read the Typescript Quick Start Docs](https://docs.tracetest.io/tools-and-integrations/artillery) to see how to run this example. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
receivers: | ||
otlp: | ||
protocols: | ||
grpc: | ||
http: | ||
|
||
processors: | ||
batch: | ||
|
||
exporters: | ||
logging: | ||
loglevel: debug | ||
jaeger: | ||
endpoint: ${JAEGER_ENDPOINT} | ||
tls: | ||
insecure: true | ||
otlp/trace: | ||
endpoint: tracetest-agent:4317 | ||
tls: | ||
insecure: true | ||
|
||
service: | ||
pipelines: | ||
traces: | ||
receivers: [otlp] | ||
processors: [batch] | ||
exporters: [logging, jaeger] | ||
traces/1: | ||
receivers: [otlp] | ||
processors: [batch] | ||
exporters: [otlp/trace] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
version: "3.5" | ||
name: pokeshop | ||
|
||
services: | ||
tracetest-agent: | ||
environment: | ||
TRACETEST_API_KEY: ${TRACETEST_AGENT_API_KEY} | ||
image: kubeshop/tracetest-agent:latest | ||
networks: | ||
default: null | ||
|
||
# pokeshop demo services | ||
postgres: | ||
image: postgres:14 | ||
ports: | ||
- 5434:5432 | ||
environment: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: postgres | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"] | ||
interval: 1s | ||
timeout: 5s | ||
retries: 60 | ||
|
||
cache: | ||
image: redis:6 | ||
ports: | ||
- 6379:6379 | ||
healthcheck: | ||
test: ["CMD", "redis-cli", "ping"] | ||
interval: 1s | ||
timeout: 3s | ||
retries: 60 | ||
|
||
queue: | ||
image: rabbitmq:3.12 | ||
restart: unless-stopped | ||
ports: | ||
- 5672:5672 | ||
- 15672:15672 | ||
healthcheck: | ||
test: rabbitmq-diagnostics -q check_running | ||
interval: 1s | ||
timeout: 5s | ||
retries: 60 | ||
|
||
otel-collector: | ||
image: otel/opentelemetry-collector-contrib:0.59.0 | ||
restart: unless-stopped | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" | ||
ports: | ||
- 4317:4317 | ||
- 4318:4318 | ||
command: | ||
- "--config" | ||
- "/otel-local-config.yaml" | ||
volumes: | ||
- ./collector.config.yaml:/otel-local-config.yaml | ||
environment: | ||
- JAEGER_ENDPOINT=jaeger:14250 | ||
depends_on: | ||
jaeger: | ||
condition: service_healthy | ||
|
||
api: | ||
image: kubeshop/demo-pokemon-api:latest | ||
restart: unless-stopped | ||
pull_policy: always | ||
environment: | ||
REDIS_URL: cache | ||
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/postgres?schema=public | ||
RABBITMQ_HOST: queue | ||
POKE_API_BASE_URL: https://pokeapi.co/api/v2 | ||
COLLECTOR_ENDPOINT: http://otel-collector:4317 | ||
NPM_RUN_COMMAND: api | ||
healthcheck: | ||
test: ["CMD", "wget", "--spider", "localhost:8081"] | ||
interval: 1s | ||
timeout: 3s | ||
retries: 60 | ||
ports: | ||
- 8081:8081 | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
cache: | ||
condition: service_healthy | ||
queue: | ||
condition: service_healthy | ||
|
||
worker: | ||
image: kubeshop/demo-pokemon-api:latest | ||
restart: unless-stopped | ||
pull_policy: always | ||
environment: | ||
REDIS_URL: cache | ||
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/postgres?schema=public | ||
RABBITMQ_HOST: queue | ||
POKE_API_BASE_URL: https://pokeapi.co/api/v2 | ||
COLLECTOR_ENDPOINT: http://otel-collector:4317 | ||
NPM_RUN_COMMAND: worker | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
cache: | ||
condition: service_healthy | ||
queue: | ||
condition: service_healthy | ||
|
||
rpc: | ||
image: kubeshop/demo-pokemon-api:latest | ||
restart: unless-stopped | ||
pull_policy: always | ||
environment: | ||
REDIS_URL: cache | ||
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/postgres?schema=public | ||
RABBITMQ_HOST: queue | ||
POKE_API_BASE_URL: https://pokeapi.co/api/v2 | ||
COLLECTOR_ENDPOINT: http://otel-collector:4317 | ||
NPM_RUN_COMMAND: rpc | ||
healthcheck: | ||
test: ["CMD", "lsof", "-i", "8082"] | ||
interval: 1s | ||
timeout: 3s | ||
retries: 60 | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
cache: | ||
condition: service_healthy | ||
queue: | ||
condition: service_healthy | ||
|
||
jaeger: | ||
image: jaegertracing/all-in-one:latest | ||
ports: | ||
- 16686:16686 | ||
healthcheck: | ||
test: ["CMD", "wget", "--spider", "localhost:16686"] | ||
interval: 1s | ||
timeout: 3s | ||
retries: 60 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
config: | ||
target: my_target | ||
tracetest: | ||
token: <YOUR_TRACETES_ENV_TOKEN> | ||
phases: | ||
- duration: 2 | ||
arrivalRate: 5 | ||
engines: | ||
tracetest: {} | ||
scenarios: | ||
- name: tracetest_engine_test | ||
engine: tracetest | ||
flow: | ||
- test: | ||
id: artillery-engine-import-pokemon | ||
runInfo: | ||
variables: | ||
- key: ENDPOINT | ||
value: http://api:8081 | ||
- key: POKEMON_ID | ||
value: "6" | ||
- summary: | ||
format: "pretty" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
config: | ||
target: my_target | ||
tracetest: | ||
token: <YOUR_TRACETES_ENV_TOKEN> | ||
phases: | ||
- duration: 1 | ||
arrivalRate: 1 | ||
engines: | ||
tracetest: {} | ||
scenarios: | ||
- name: tracetest_engine_test | ||
engine: tracetest | ||
flow: | ||
- test: | ||
definition: import-pokemon.yaml | ||
runInfo: | ||
variables: | ||
- key: ENDPOINT | ||
value: http://api:8081 | ||
- key: POKEMON_ID | ||
value: "6" | ||
- summary: | ||
format: "pretty" |
28 changes: 28 additions & 0 deletions
28
examples/quick-start-artillery/import-pokemon-trace-id.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
type: Test | ||
spec: | ||
id: artillery-plugin-import-pokemon | ||
name: "Artillery Plugin: Import a Pokemon" | ||
trigger: | ||
type: traceid | ||
traceid: | ||
id: ${var:TRACE_ID} | ||
specs: | ||
- selector: span[tracetest.span.type="general" name = "validate request"] span[tracetest.span.type="http"] | ||
name: "All HTTP Spans: Status code is 200" | ||
assertions: | ||
- attr:http.status_code = 200 | ||
- selector: span[tracetest.span.type="http" name="GET" http.method="GET"] | ||
assertions: | ||
- attr:http.route = "/api/v2/pokemon/${var:POKEMON_ID}" | ||
- selector: span[tracetest.span.type="database"] | ||
name: "All Database Spans: Processing time is less than 1s" | ||
assertions: | ||
- attr:tracetest.span.duration < 1s | ||
- selector: span[tracetest.span.type="http" name="post" http.method="POST"] | ||
name: Response time should be fast | ||
assertions: | ||
- attr:response.time.ms < 100 | ||
outputs: | ||
- name: DATABASE_POKEMON_ID | ||
selector: span[tracetest.span.type="database" name="create postgres.pokemon" db.system="postgres" db.name="postgres" db.user="postgres" db.operation="create" db.sql.table="pokemon"] | ||
value: attr:db.result | json_path '$.id' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
type: Test | ||
spec: | ||
id: artillery-engine-import-pokemon | ||
name: "Artillery Engine: Import Pokemon" | ||
trigger: | ||
type: http | ||
httpRequest: | ||
method: POST | ||
url: ${var:ENDPOINT}/pokemon/import | ||
body: '{"id": ${var:POKEMON_ID}}' | ||
headers: | ||
- key: Content-Type | ||
value: application/json | ||
specs: | ||
- selector: span[tracetest.span.type="general" name = "validate request"] span[tracetest.span.type="http"] | ||
name: "All HTTP Spans: Status code is 200" | ||
assertions: | ||
- attr:http.status_code = 200 | ||
- selector: span[tracetest.span.type="http" name="GET" http.method="GET"] | ||
assertions: | ||
- attr:http.route = "/api/v2/pokemon/${var:POKEMON_ID}" | ||
- selector: span[tracetest.span.type="database"] | ||
name: "All Database Spans: Processing time is less than 1s" | ||
assertions: | ||
- attr:tracetest.span.duration < 1s | ||
outputs: | ||
- name: DATABASE_POKEMON_ID | ||
selector: span[tracetest.span.type="database" name="create postgres.pokemon" db.system="postgres" db.name="postgres" db.user="postgres" db.operation="create" db.sql.table="pokemon"] | ||
value: attr:db.result | json_path '$.id' |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.