{"id":27933488,"url":"https://github.com/timescale/opentelemetry-demo","last_synced_at":"2025-05-07T04:59:02.353Z","repository":{"id":37411857,"uuid":"451914733","full_name":"timescale/opentelemetry-demo","owner":"timescale","description":"A demo system for exploring the tracing features of Promscale","archived":false,"fork":false,"pushed_at":"2022-08-18T14:34:02.000Z","size":1359,"stargazers_count":66,"open_issues_count":8,"forks_count":30,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-05-07T04:58:55.541Z","etag":null,"topics":["opentelemetry","postgresql","promscale","timescaledb","tracing"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timescale.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2022-01-25T14:41:21.000Z","updated_at":"2024-11-04T01:09:55.000Z","dependencies_parsed_at":"2022-07-12T20:50:50.485Z","dependency_job_id":null,"html_url":"https://github.com/timescale/opentelemetry-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timescale%2Fopentelemetry-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timescale%2Fopentelemetry-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timescale%2Fopentelemetry-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timescale%2Fopentelemetry-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timescale","download_url":"https://codeload.github.com/timescale/opentelemetry-demo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252816943,"owners_count":21808704,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["opentelemetry","postgresql","promscale","timescaledb","tracing"],"created_at":"2025-05-07T04:59:01.611Z","updated_at":"2025-05-07T04:59:02.336Z","avatar_url":"https://github.com/timescale.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenTelemetry Demo\n\n## Summary\n\nThis repo contains a environment for demonstrating OpenTelemetry tracing\nsupport in [Promscale](https://www.timescale.com/promscale).\n\n## Workshop\n\nThis repo is used to deliver workshops on OpenTelemetry Traces and SQL. If you are here\nto explore the workshop, head to this [page](./workshop.md).\n\n## The Password Generator Service\n\nA password generator service is instrumented with \n[OpenTelemetry tracing](https://opentelemetry-python.readthedocs.io/en/stable/). \nThis is an absurd service and should not be taken as a shining example\nof architecture nor coding. It exists as a playground example to generate\ntraces. The [lower service](./instrumented/lower) generates random lowercase letters. The \n[upper service](./instrumented/upper) service generates random uppercase letters. The \n[digit service](./instrumented/digit) generates random digits, and the \n[special service](./instrumented/special) generates random special characters. There is \na [generator](./instrumented/generator) service which makes calls to the other services\nto compose a random password. Finally, there is a [load script](./instrumented/load) which\ncontinuously calls the generator service in order to simulate user load.\n\nThe **lower** service is a Ruby app using Sinatra framework while the other\nservices use Python with Flask.\n\nThere are two versions of the services. Those under the [instrumented](./instrumented/) \ndirectory have explicit instrumentation for tracing, whereas the versions under the \n[uninstrumented](./uninstrumented/) directory solely use auto-instrumentation.\n\n## The Observability Infrastructure\n\nAll of the microservices forward their traces to an instance of the \n[OpenTelemetry Collector](https://opentelemetry.io/docs/collector/).\nThe collector sends the traces on to an instance of the \n[Promscale Collector](https://www.timescale.com/promscale) which \nstores them in a [TimescaleDB](https://www.timescale.com/products) \ndatabase. An instance of the \n[Jaeger UI](https://www.jaegertracing.io/docs/1.30/frontend-ui/) \nis pointed to the Promscale instance, and an instance of \n[Grafana](https://grafana.com/grafana/) is pointed at both Jaeger\nand the TimescaleDB database. In this way, you can use SQL to query\nthe traces directly in the database, and visualize tracing data in\nJaeger and Grafana dashboards.\n\n## Running the System in Docker\n\nWhen the system runs in docker it is configured via the \n[docker compose file](./docker-compose.yaml), and is operated with\ndocker-compose. Run the following command from the root of the repo\nto (re)start the system.\n\n```\ndocker-compose up --remove-orphans --build --detach\n```\n\nOnce running, the following links will let you explore the\nvarious components of the system:\n\n- [password generator service](http://localhost:5050/)\n- [digit service](http://localhost:5051/)\n- [special service](http://localhost:5052/)\n- [lower service](http://localhost:5053/)\n- [upper service](http://localhost:5054/)\n- [Grafana](http://localhost:3000/)\n- [Jaeger](http://localhost:16686/search)\n\nWhen you are ready to shutdown the system, use the following command.\n\n```\ndocker-compose down\n```\n\n## Running the System in Kubernetes\n\nWhen you want to run the system in k8s you can use the following commands (if you have certmanager installed skip that step):\n\n```\nkubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.8.0/cert-manager.yaml\nkubectl apply -f https://github.com/open-telemetry/opentelemetry-operator/releases/latest/download/opentelemetry-operator.yaml\nkubectl apply -k ./yaml\n```\n\nYou should wait for the OpenTelemetry Operator pod to come up before you run the second\ncommand. \n\nYou should see data flowing into Grafana automatically.\n\nTo access individual services as per the Docker instructions below you will need to run\n```\nsh ./yaml/port-forward.sh\n```\n\n\n## Connecting to TimescaleDB\n\nYou can use any SQL client that supports PostgreSQL to connect to the TimescaleDB\ndatabase. The database is not password protected.\n\nUse the psql client to connect to the Timescaledb instance via:\n\n```bash\npsql -h localhost -p 5999 -d otel_demo -U postgres\n```\n## Examples\n\n_Note: the default Grafana login credentials are user \"admin\" and password \"admin\". Once you log in for the first time you will be asked to update your password._\n\n### Request Rates\n\n[Grafana Dashboard](http://localhost:3000/d/QoZDH91nk/01-request-rate?orgId=1)\n\n[Queries](instrumented/queries/01-request-rates.sql)\n\n### Error Rates\n\n[Grafana Dashboard](http://localhost:3000/d/CiE9l917z/02-error-rates?orgId=1)\n\n[Queries](instrumented/queries/02-error-rates.sql)\n\n### Request Durations\n\n[Grafana Dashboard](http://localhost:3000/d/GkrS6rJ7z/03-request-durations?orgId=1)\n\n[Queries](instrumented/queries/03-request-durations.sql)\n\n### Service Dependencies\n\n[Grafana Dashboard](http://localhost:3000/d/scyq99J7k/04-service-dependencies?orgId=1)\n\n[Queries](instrumented/queries/04-service-dependencies.sql)\n\n### Upstream Spans\n\n[Grafana Dashboard](http://localhost:3000/d/lyIow61nz/05-upstream-spans?orgId=1)\n\n[Queries](instrumented/queries/05-upstream-spans.sql)\n\n### Downstream Spans\n\n[Grafana Dashboard](http://localhost:3000/d/SdzI3eJnk/06-downstream-spans?orgId=1)\n\n[Queries](instrumented/queries/06-downstream-spans.sql)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimescale%2Fopentelemetry-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimescale%2Fopentelemetry-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimescale%2Fopentelemetry-demo/lists"}