Skip to content

Advanced usage: Configuring the built in application metrics monitor writer

Boia Alexandru edited this page Mar 17, 2023 · 1 revision

There is a dedicated setup sub-flow for configuring the application metrics monitor writer, that can be entered by calling IStakhanoviseSetup.SetupAppMetricsMonitorWriter(), which needs an Action<IAppMetricsMonitorWriterSetup> as a parameter.

You can then use the IAppMetricsMonitorWriterSetup.SetupBuiltInWriter() method to configure the built-in writer:

await Stakhanovise
	.CreateForTheMotherland()
	.SetupWorkingPeoplesCommittee(setup => 
	{
		setup.SetupAppMetricsMonitorWriter(writerSetup => 
		{
			writerSetup.SetupBuiltInWriter(builtinWriterSetup => 
			{
				//only DB connection options can be modified at this time
				//normally you don't need to do this unless:
				//	a) you want to store these to a separate database
				//		OR
				//	b) you want o alter the additional connection parameters 
				//		(DB connect retry count, retry delay and so on)
				builtinWriterSetup.WithConnectionOptions(connSetup => 
				{
					connSetup.WithConnectionString(...)
						.WithConnectionRetryCount(...)
						.WithConnectionRetryDelayMilliseconds(...)
						.WithConnectionKeepAlive(...);
				});
			});
		});
	})
	.StartFulfillingFiveYearPlanAsync();