tencent cloud

Tencent Cloud Observability Platform

Data Reporting Verification

Download
Focus Mode
Font Size
Last updated: 2026-05-25 18:01:56

Prerequisites

Dart exceptions, startup performance metrics, lag metrics, and network reporting all need to be enabled and support sampling. During integration, ensure that the enabled features meet your expectations.
You need to create a configuration task on the Terminal Performance Monitoring Pro > Setting > SDK configuration page. For more information on the configuration feature, see SDK configuration.
During integration, it is recommended to set the sampling rate of all monitoring items to 1.0 (sample_ratio and event_sample_ratio) for easier data reporting verification. After the integration is complete, you can change the sampling rate as needed. You can enable all monitoring items for development tasks, apply sampling as needed during the grayscale phase, and reduce sampling for the official release as required.
Check whether the product to be integrated has purchased and bound an active resource package. If not, the product will be unable to report data.

Error Monitoring

Simulating an Exception

Refer to the following sample code to simulate various types of exceptions:
class MyCrashTestApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('APM Exception Capture Test')),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// 1. Synchronous exception test
ElevatedButton(
child: const Text('Trigger Synchronous Exception'),
onPressed: () => _throwSyncException(),
),
const SizedBox(height: 20),
// 2. Asynchronous exception test
ElevatedButton(
child: const Text('Trigger Asynchronous Exception'),
onPressed: () => _throwAsyncException(),
),
const SizedBox(height: 20),
// 3. Widget build exception
ElevatedButton(
child: const Text('Trigger Widget Exception'),
onPressed: () => Navigator.push(
context,
MaterialPageRoute(builder: (_) => FaultyWidget())
),
),
],
),
),
),
);
}

// Synchronous exception example
void _throwSyncException() {
// Simulates a business logic error.
final list = [];
print(list[0]); // Out-of-bounds access
}

// Asynchronous exception example
Future<void> _throwAsyncException() async {
await Future.delayed(Duration(milliseconds: 500));
// Simulates an asynchronous error.
dynamic nullObject = null;
print(nullObject.length); // NoSuchMethodError
}
}

// Exception-throwing Widget
class FaultyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
// Intentionally throws an exception during build.
if (DateTime.now().millisecond % 2 == 0) {
return Container(color: Colors.blue);
}
throw Exception('Random exception during Widget build');
}
}

Checking Data Reporting

After an error is reported, view the issue in Error > Problem List. Click the issue to view its details.

Lag Metrics

As long as the lifecycle listeners are properly configured, lag data will be captured. For detailed instructions, see API Description > Lifecycle Listening. You can view the data on the Lag page.


Launch Monitoring

As long as the launch monitoring instrumentation is properly configured, launch data will be captured. For detailed instructions, see API Description > Configuring Launch Monitoring Instrumentation. You can view the data on the Launch page.






Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback