A swift written distributed tracing and log clinet built conformimg to OpenTelemetry's specifications
For details of opentelemetry, go to here
Here's an example of user activity. In this show case, the user has done following actions:
- Enter trace page
- Segue to another page
- Press a button and segue to another page
- view a table list, select one of the item
- An alert is shown, the user tapped OK
Here's the distributed tracing data collected in an Zipkin backend, by searching the trace ID the developer can look into details when the App is used by the user. Including:
- Each span duration
- Attribute added to the span
- Event happend during the span period
In short, To help application developer to improve the observability of their apps. By offering distributed tacing data to the backend colletor, developer can see through the connection between logs and understand the hole process they defined rather than searching in tons of god knows wether they are relative logs and die trying to organize the whole situation.
when the distributed tracing data sent to backend, in a Grafana backend would looks like this:
You can monitor each span you defined and created, how they relate to one and other, what futher information they carry.
-
Pure Swift coding
-
MacOS/iOS support
-
iOS 10+ compatible
-
Logging & Distributed Tracing functions available
-
Defualt Zipkin support
-
Cocoapods & SPM intergration support
-
And more!
Observatory is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'ObservatoryPod'
Alternatively, you can intergrate the module only if it's what you need:
pod 'Observatory/Tracing'
For default Zipkin implementation:
pod 'Observatory/TracingZipkin'
Add your GitHub account and install Package from xcode
Like Cocoapods, SPM offers 4 moudles for developer to import
ObservatoryCommon
, ObservatoryLogging
, ObservatoryTracing
, ZipkinExport
- For cocoapods intergration and example, clone this repository and navigate to
Example/SFRoleDriverModels.xcworkspace
- Use the commandline and run command
pod install
(Assuming you already installed Cocoapods) - Run the
SFRoleDriverModels.xcworkspace
with XCode
- For SPM intergration and example, clone this repository and navigate to
ObservatorySPMExample/ObservatorySPMExample.xcodeproj
- Simplly Run the project with Xcode
The Components within the SDK are layouted like this:
- TracerProvider: To create and manage tracers, manage a
Processors
queue and aSampler
, holds the recouce instantance for commonly used data, for most case a shared singleton would be enough. - Tracer: Created by the
tracerProvider
, serves as aspan
creator. - Sampler: When a
span
is created by thetracer
, it should passed to thesampler
and decide if it should be record and export. - Processor: Created by User and passed to
TracerPrvider
during its creatation, an interceptor for span life cycle, duringspan
's start and end it can perform additional action for thespan
. It will effet one by one according to the queue holded by thetracerprovider
. - Exporter: Created by User and passed to
Processor
during its creatation, each processor can only bind with one exporter. It handles the span data's exportation to the remote end distributed tracing data collector via APIs. - Resource: Created by User and passed to
TracerPrvider
during its creatation, the commonly used data send alongside the span data to the remote end distributed tracing data collector.
- TracerProvider is created and configured. It must hold by an instance during App lifetime incase it's recycle and deinit by system.
- Tracer, created by tracerprovider, usually one would be enough
- When tracer creates a span, it should passed to the sampler first, sampler can be defined by user and decide if this span is valid and wether it can be used.
- All the processor will call thier onStart and onEnd method during span's lifetime.
- After the span is ended, it will passed to the exporter to export.
RavenDeng dlfkid@icloud.com
Observatory is available under the MIT license. See the LICENSE file for more info.