# Observability

To continuously improve the performance and stability of the Thryve SDK, the framework reports telemetry data like crashes and traces to Thryve's observability backend. Observability data is fully handled by Thryve's own infrastructure and never shared or processed with any 3rd party, ensuring the highest degree of data privacy for your end users.&#x20;

### Integrate Thryve Observability with your application

To integrate Observability into your application, add the `ThryveObservability` module from Thryve's SDK. You can achieve this by adding `ThryveObservability` pods on iOS and dependencies on Android.

{% tabs %}
{% tab title="iOS" %}

```ruby
platform :ios, '13.0'
source 'https://git.thryve.de/thryve/Specs.git'

target 'ThryveConnectorSample' do
 
  use_frameworks!

...
pod 'ThryveObservability', '5.2.2'
...

end
```

{% endtab %}

{% tab title="Android" %}
Using Thryve Maven Repository Dependency:

```kotlin
dependencies {
    ...
    api("com.thryve.sdk:observability:${thryve_sdk_version}")
    ...
}
```

If you are using `.aar` approach, please include below dependencies

```kotlin
dependencies {
    ...
    implementation(files("libs/thryve_module_observability_${thryve_sdk_version}.aar")

    //dependencies for Observability Module
    implementation("io.opentelemetry:opentelemetry-api:$openTelemetryVersion")
    implementation("io.opentelemetry:opentelemetry-sdk:$openTelemetryVersion")
    implementation("io.opentelemetry.semconv:opentelemetry-semconv:$openTelemetrySemanticConventionsVersion")
    implementation("io.opentelemetry:opentelemetry-exporter-otlp:$openTelemetryVersion")// OpenTelemetry Exporters
     ...
}
```

{% endtab %}
{% endtabs %}

### Configure the `ThryveObservability` module

{% tabs %}
{% tab title="iOS" %}

{% code overflow="wrap" %}

```swift
import ThryveCore
import ThryveCommons
import ThryveObservability

let observabilityConfig = ObservabilityConfig(
    tracingEnabled: true, 
    crashReportingEnabled: true
)

let thryveSDKConfig = ThryveSDKConfig(
    authId: "AUTH_ID",
    authSecret: "AUTH_SECRET",
    endUserAlias: "YOUR_UNIQUE_USER_IDENTIFIER",
    endUserId: nil, 
    locale: "de",
    observability: observabilityConfig
)
        
await ThryveSDK.getOrCreate(thryveSDKConfig).getUserInformation()
```

{% endcode %}
{% endtab %}

{% tab title="Android" %}

```kotlin
import com.thryve.sdk
import com.thryve.sdk.commons

val observabilityConfig = ThryveObservabilityConfig(
        tracingEnabled = true,
        crashReportingEnabled = true,
    )
    
val thryveSDKConfig = ThryveSDKConfig(
    authId = "ASSIGNED_AUTH_ID",
    authSecret = "ASSIGNED_AUTH_SECRET",
    endUserAlias = "XXXXXXXXXXX",
    endUserId = null, 
    locale = "de",
    observabilityConfig = observabilityConfig,
)
                 
val thryveSDK = ThryveSDK.getOrCreate(thryveSDKConfig, context) { thryveResponse ->
       if (thryveResponse.successful) {
           // ThryveSDK initialization processes completed successfully
       } else {
           // ThryveSDK initalization process failed, process the ThryveErrors for the specific reason
           thryveResponse.errors.map { thryveError -> Logger.e(TAG) {" getOrCreate ThryveError in onCreate function $thryveError" } }
       }
  }
```

{% endtab %}
{% endtabs %}

{% hint style="danger" %}
Any updates to the configuration should pass the Observability configuration as well. Failing to pass the configuration to the updated configuration will disable the Observability module.
{% endhint %}

### Module configuration options

When using the Observability module, make sure to define the options in the Observability configuration.&#x20;

<table><thead><tr><th width="218">Parameter</th><th width="381">Description</th><th>Default</th></tr></thead><tbody><tr><td><code>tracingEnabled</code></td><td>When <code>true</code>, information on performance and errors linked to a Thryve user is reported to Thryve's observability backend. Requires import of <code>ThryveObservability</code> module.</td><td>true</td></tr><tr><td><code>crashReportingEnabled</code></td><td>When <code>true</code>, crashes caused by the ThryveSDK will be reported anonymously to Thryve's observability backend.</td><td>true</td></tr></tbody></table>

<details>

<summary>Overview of data shared with Thryve when crash reporting or tracing is enabled</summary>

The following data is processed by Thryve when observability functions are enabled:

#### Crash reporting

When crash reporting is enabled, the following information is sent to Thryve's self-operated observability backend in the event of an app crash:

* crash stack trace
* app information
  * authId
  * bundle/package id
  * state (inactive/active)
  * version
* device information
  * model name
  * operating system
  * operating system version
  * memory size
  * free memory
* session information
  * app start time
  * app uptime
  * app time in foreground
  * timestamps on actions performed by the SDK, e.g. initialization, execution of methods etc.

{% hint style="danger" %}
Crash reports are anonymous and no IP information or other unique identifiers are collected
{% endhint %}

#### Tracing

When tracing is enabled the following information is sent to Thryve's self-operated observability backend:

* app information
  * authId
  * bundle id
  * state (inactive/active)
  * version
* device information
  * model name
  * operating system
  * operating system version
  * memory size
* user information
  * endUserId
* process (trace) information
  * success true/false
  * ThryveErrors
  * start/endTimestamp of process
  * process parameters (e.g. requested HealthKit types, requested timeframes etc.)
  * process metadata (e.g. number of processed data points)

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.thryve.health/integrate-your-mobile-app/observability.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
