This is a demo project written for a talk on OpenTelemetry given at /dev/world in May 2024.
Warning
This code is for demonstration purposes only. Its mostly functional but was thrown together in a hurry. It's not robust, its not secure, it takes a lot of shortcuts. It comes with no warranty and no support.
This project includes two components: a minimal iOS bank app that shows your account balance, a list of transactions, and allows you to make transfers between your accounts. It also includes a minimal API using Hummingbird to facilitate it. Both ends use GRDB to support database access and value observation (reactive reads), and employ a WebSocket connection between client and server to replicate those reads to the client side.
The purpose of this project is to show usage of swift-distributed-tracing and how you might employ that in an iOS app and on a backend and tie the two traces together.
This project requires Swift 5.10 or higher for the server, and Xcode 15.3 or higher for the app.
- Choose a telemetry backend and get it going. For the demo I used Honeycomb's free tier, but Jaeger or Grafana are also good open-source choices.
- I recommend running an OpenTelemetry Collector in docker on your local machine and configuring it to forward traces to your backend.
- Build and run the server, either using
swift run
in the Server directory, or using theserver
scheme in Xcode. - Build and run the app.
- You should see traces flowing through to your telemetry backend.
If you get stuck you can pass -v
to the longer form of the server command (swift run server serve -v
) and it'll log debug output, including the gRPC telemetry export. Likewise if you're running an OpenTelemetry collector looking at its log output will help (docker logs -f <collector-container>
).
This project is available under the MIT license. See the LICENSE file for more info.