Skip to content

Commit

Permalink
examples(grafana): update pokeshop grafana sample (#3287)
Browse files Browse the repository at this point in the history
  • Loading branch information
adnanrahic committed Oct 25, 2023
1 parent ed06964 commit 0b4e213
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 18 deletions.
4 changes: 2 additions & 2 deletions examples/tracetest-grafana-tempo-pokeshop/README.md
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
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
@@ -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
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

0 comments on commit 0b4e213

Please sign in to comment.