Skip to content

Commit 12269f7

Browse files
authored
Merge pull request #191027 from pizzaz93/patch-2
Update api-custom-events-metrics.md
2 parents 614e31d + f507ec6 commit 12269f7

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

articles/azure-monitor/app/api-custom-events-metrics.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,12 +634,22 @@ Normally, the SDK sends data at fixed intervals (typically 30 secs) or whenever
634634

635635
*.NET*
636636

637+
When using Flush(), we recommend this [pattern](./console.md#full-example):
638+
637639
```csharp
638640
telemetry.Flush();
639641
// Allow some time for flushing before shutdown.
640642
System.Threading.Thread.Sleep(5000);
641643
```
642644

645+
When using FlushAsync(), we recommend this pattern:
646+
647+
```csharp
648+
await telemetryClient.FlushAsync()
649+
```
650+
651+
We recommend always flushing as part of the application shutdown to guarantee that telemetry is not lost.
652+
643653
*Java*
644654

645655
```java
@@ -656,7 +666,8 @@ telemetry.flush();
656666

657667
The function is asynchronous for the [server telemetry channel](https://www.nuget.org/packages/Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel/).
658668

659-
We recommend using the flush() or flushAsync() methods in the shutdown activity of the Application when using the .NET SDK.
669+
> [!NOTE]
670+
> The Java and Javascript SDKs automatically flush on application shutdown.
660671
661672
## Authenticated users
662673

0 commit comments

Comments
 (0)