Skip to content

Sample project to showcase how opentelemetry can be used to enable monitoring in various platform

Notifications You must be signed in to change notification settings

imrenagi/concurrent-booking

Repository files navigation

Simple Concert Ticketing

This application is used for demonstrating the application instrumentation, especially trace and metrics.

Running it locally

Enable new relic (optional)

To enable new relic instrumentation:

  1. Create free newrelic account and grab the license key.

  2. Set these following env var:

    • OTEL_NEW_RELIC_EXPORTER_OTLP_ENDPOINT to https://otlp.nr-data.net:4317
    • OTEL_NEW_RELIC_EXPORTER_API_KEY to ingest license key from newrelic account

Enable Google Cloud Tracing and Monitoring

  1. Create GCP service account and ensure that service account has (at minimum) roles/monitoring.metricWriter and roles/cloudtrace.agent role.

  2. Update value of exporters.googlecloud.project in otel-config file to your google cloud project id/

Run Docker Compose

```shell
docker-compose up
```

Open Dashboard

  1. Jaeger Tracing Dashboard: http://127.0.0.1:16686/
  2. Prometheus Dashboard: http://127.0.0.1:9090/
  3. Grafana Dashboard: http://127.0.0.1:3000/
  4. Asynqmon Dashboard: http://127.0.0.1:8011/
  5. Newrelic dashboard (optional)
  6. Google Cloud Monitoring
  7. Google Cloud Tracing

Run load generator

  1. Install hey

  2. Run load generator

    hey -z 1m -c 2 -q 2  -m POST -d '{"show_id": "b9b0d5da-98a4-4b09-b5f5-83dc0c3b9964"}' http://localhost:9999/api/v1/booking
    hey -z 1m -c 2 -q 2  -m POST -d '{"show_id": "b9b0d5da-98a4-4b09-b5f5-83dc0c3b9964"}' http://localhost:9999/api/v2/booking

Running it on kubernetes

WARNING: This setup is not properly documented.

  1. Setup CloudSQL Postgres Instance. Update secret.yaml.example, app.yaml, and worker.yaml with correct value for database config.

    docker run -d \
        -v ${PWD}/hack/observability/secrets/psql-local.json:/config/key.json \
        -p 127.0.0.1:5432:5432 \
        gcr.io/cloudsql-docker/gce-proxy:1.31.0 /cloud_sql_proxy \
        -instances=io-extended-2022:asia-southeast1:booking=tcp:0.0.0.0:5432 -credential_file=/config/key.json
  2. Install bitnami/helm chart

    helm repo add bitnami https://charts.bitnami.com/bitnami
    helm install redis --namespace redis --values redis-values.yml bitnami/redis
  3. Apply all manifest in k8s directory.

  4. Port forward prometheus dashboard

     kubectl -n gmp-test port-forward svc/frontend 9091:9090
  5. Run load test

    k apply -f k8s/hey.yaml

Demo Script

hey -n 1 -c 1 -q 1  -m POST -d '{"show_id": "b9b0d5da-98a4-4b09-b5f5-83dc0c3b9964"}' http://localhost:9999/api/v1/booking

hey -z 5s -c 100 -m POST -d '{"show_id": "b9b0d5da-98a4-4b09-b5f5-83dc0c3b9964"}' http://localhost:9999/api/v1/booking

About

Sample project to showcase how opentelemetry can be used to enable monitoring in various platform

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages