Skip to content
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

examples(grafana): update pokeshop grafana sample #3287

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/tracetest-grafana-tempo-pokeshop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ This examples' objective is to show how you can:
4. Test if it works by running: `tracetest run test -f tests/test.yaml`. This would trigger a test that will send and retrieve spans from the Grafana Tempo instance that is running on your machine. View the test on `http://localhost:11633`.
5. View traces in Grafana on `http://localhost:3000`. Use this TraceQL query:

```yaml
{ name="POST /pokemon/import" }
```text
{ name="Tracetest trigger" } || { name="POST /pokemon/import?" } || { name="POST /pokemon/import" }
```
5 changes: 3 additions & 2 deletions examples/tracetest-grafana-tempo-pokeshop/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ services:

# Tracetest
tracetest:
image: kubeshop/tracetest:v0.12.2
image: kubeshop/tracetest:v0.14.3
volumes:
- ./tracetest.config.yaml:/app/tracetest.yaml
- ./tracetest.provision.yaml:/app/provisioning.yaml
Expand Down Expand Up @@ -38,7 +38,8 @@ services:
- ./tempo.config.yaml:/etc/tempo.yaml
- ./tempo-data:/tmp/tempo
ports:
- "3200" # tempo
- "3200:3200" # tempo http
- "9095:9095" # tempo grpc
- "4317" # otlp grpc
- "4318" # otlp http
grafana:
Expand Down
23 changes: 9 additions & 14 deletions examples/tracetest-grafana-tempo-pokeshop/tests/test.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
type: Test
spec:
id: ZVJwkpC4g
id: MnZ_kD7Ig
name: Pokeshop - Import
description: Import a Pokemon
trigger:
type: http
httpRequest:
method: POST
url: http://demo-api:8081/pokemon/import
body: '{"id":6}'
body: "{\"id\":837483}"
headers:
- key: Content-Type
value: application/json
specs:
- selector: span[tracetest.span.type="http" name="GET" http.method="GET"]
name: Validate that the external API does not contain an exception.
assertions:
- attr:span.events not-contains "exception"
- selector: span[tracetest.span.type="http"]
name: "All HTTP Spans: Status code is 200"
assertions:
- attr:http.status_code = 200
- selector: span[tracetest.span.type="general" name="import pokemon"]
name: Validate that this span always exists after the message queue
assertions:
- attr:tracetest.selected_spans.count = 1
- attr:span.events not-contains "exception"
- selector: span[tracetest.span.type="database" name="get pokemon_6" db.system="redis" db.operation="get" db.redis.database_index="0"]
name: Validate that Redis is using Charizard.
assertions:
- attr:db.payload = '{"key":"pokemon_6"}'
- 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"]
name: Validate that the Postgres has Charizard.
- selector: span[tracetest.span.type="database"]
name: "All Database Spans: Processing time is less than 100ms"
assertions:
- attr:db.result contains "charizard"
- attr:tracetest.span.duration < 100ms
15 changes: 15 additions & 0 deletions examples/tracetest-grafana-tempo-pokeshop/tracetest.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,18 @@ postgres:
port: 5432
dbname: postgres
params: sslmode=disable

telemetry:
exporters:
collector:
serviceName: tracetest
sampling: 100
exporter:
type: collector
collector:
endpoint: otel-collector:4317

server:
telemetry:
exporter: collector
applicationExporter: collector
Loading