Interface IDiagnosticsAgent
Interface for the Diagnostics Agent Diagnostics, usage data collection, caches and flushing
Namespace: SuperOffice.CRM.Services
Assembly: SuperOffice.Services.dll
Syntax
[Agent("Diagnostics Agent", "Interface for the Diagnostics Agent. Diagnostics, usage data collection, caches and flushing")]
public interface IDiagnosticsAgent : IAgent
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (DiagnosticsAgent agent = new DiagnosticsAgent())
{
// call methods on agent here...
}
}
Methods
AddWebAppUsageAsync(WebAppUsage[], CancellationToken)
Adds WebApp usage to existing log
Declaration
Task AddWebAppUsageAsync(WebAppUsage[] webAppUsages, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| WebAppUsage[] | webAppUsages | Web app usage. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
ChangeLogSettingsAsync(bool, bool, bool, bool, bool, bool, bool, bool, CancellationToken)
Change NetServer log settings.
Declaration
Task ChangeLogSettingsAsync(bool logWarning, bool logInformation, bool logSuccessAudit, bool logFailureAudit, bool logToEventLog, bool logToSuperOffice, bool logToFile, bool logToTrace, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | logWarning | Turn on warning log |
| bool | logInformation | Turn on information log |
| bool | logSuccessAudit | Turn on success audit log |
| bool | logFailureAudit | Turn on failure audit log |
| bool | logToEventLog | Log to event log |
| bool | logToSuperOffice | Log to SuperOffice |
| bool | logToFile | Log to file |
| bool | logToTrace | Log to trace |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
CollectDataAdditionsAsync(CancellationToken)
Collect and transmit usage statistics: Database Additions. If opted-out then this call does nothing. The call returns immediately (starting a background thread), and updates CS scheduler table to set the next run time.
Declaration
Task CollectDataAdditionsAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
CollectTableSizesAsync(CancellationToken)
Collect and transmit usage statistics: Table Sizes. If opted-out then this call does nothing. The call returns immediately (starting a background thread), and updates CS scheduler table to set the next run time.
Declaration
Task CollectTableSizesAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
CollectWebUsageAsync(CancellationToken)
Collect and transmit usage statistics: Web-based clients Usage. If opted-out then this call does nothing. The call returns immediately (starting a background thread), and updates CS scheduler table to set the next run time.
Declaration
Task CollectWebUsageAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
CollectWinUsageAsync(CancellationToken)
Collect and transmit usage statistics: Windows CRM Client Usage. If opted-out then this call does nothing. The call returns immediately (starting a background thread), and updates CS scheduler table to set the next run time.
Declaration
Task CollectWinUsageAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
FlushCachesAsync(CancellationToken)
Flushes all NetServer caches
Declaration
Task FlushCachesAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
FlushCachesByNameAsync(string[], CancellationToken)
Flushes all NetServer caches named
Declaration
Task FlushCachesByNameAsync(string[] cacheNames, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | cacheNames | Name of the cachnes to flush |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
GetAnalyticsDataAsync(CancellationToken)
Retrieve analytics properties to be included in usage tracking.
Declaration
Task<AnalyticsData> GetAnalyticsDataAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<AnalyticsData> | Description Analytics Data |
GetCacheInvalidationGenerationsAsync(string[], CancellationToken)
Get generation for provided names
Declaration
Task<CacheInvalidation[]> GetCacheInvalidationGenerationsAsync(string[] names, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | names | Name of caches |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<CacheInvalidation[]> | Array of caches with generation number |
GetCacheNamesAsync(CancellationToken)
Get the name of the caches that can be flushed
Declaration
Task<string[]> GetCacheNamesAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<string[]> | Name of the caches that can be flusehd |
GetCacheStateAsync(string[], CancellationToken)
Get the current generation value of the named caches. State is opaque.
Declaration
Task<string> GetCacheStateAsync(string[] cacheNames, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | cacheNames | Names of the caches to check |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<string> | Current state of the caches named. If not the same as previous value, then it is time to flush |
GetEntityCountsForAllUsersAsync(CancellationToken)
Get an array of entities and number of entities created for all associates.
Declaration
Task<EntityCounts[]> GetEntityCountsForAllUsersAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<EntityCounts[]> | Array of EntityCounts[] for all the users |
GetEntityCountsForCurrentUserAsync(CancellationToken)
Get an array of entities and number of entities created for the current associate
Declaration
Task<EntityCounts[]> GetEntityCountsForCurrentUserAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<EntityCounts[]> | Array of EntityCounts[] for the current associate |
GetNextTableNumberAsync(CancellationToken)
Increment save and return NextTableNumber, to be used when creating new extra table
Declaration
Task<int> GetNextTableNumberAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<int> | NextTableNumber of DatabaseModel |
GetSystemMessagesAsync(int, CancellationToken)
Retrieves a list of system messages for a specific associate.
Declaration
Task<SystemMessage[]> GetSystemMessagesAsync(int associateId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | associateId | The associateId of the message target. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<SystemMessage[]> | List of SystemMessages for desired associate |
GetWebAppUsagesForPeriodAsync(DateTime, DateTime, string, CancellationToken)
Get all WebAppUsages for a given period, that match an optional search term
Declaration
Task<WebAppUsage[]> GetWebAppUsagesForPeriodAsync(DateTime fromDate, DateTime toDate, string searchTerm, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | fromDate | |
| DateTime | toDate | |
| string | searchTerm | ViewState search term. '%' is the wildcard character, for example 'Pocket%' will match all viewstates starting with 'Pocket'. If empty, all viewstates will be matched |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<WebAppUsage[]> |
LogViewStateAsync(string, CancellationToken)
Log a change in view state. The granularity of the logging depends on the current configuration. This call returns asynchronously, leaving the server to finish processing later on.
Declaration
Task LogViewStateAsync(string viewState, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | viewState | Current view state to be logged |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
PerformTasksAfterCustomObjectTableCreatedAsync(string, CancellationToken)
A temporary method to be used from c++ until CustomObjectsAgent.CreateTable implemented in NetServer
Declaration
Task PerformTasksAfterCustomObjectTableCreatedAsync(string tableName, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tableName | Name of DB table of the custom object that was created. E.g., 'y_car' |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
PerformTasksAfterCustomObjectTableDeletedAsync(string, CancellationToken)
A temporary method to be used from c++ until CustomObjectsAgent.DeleteTable implemented in NetServer
Declaration
Task PerformTasksAfterCustomObjectTableDeletedAsync(string tableName, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tableName | Name of DB table of the custom object that was deleted. E.g., 'y_car' |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
PerformTasksAfterUpgradeAsync(CancellationToken)
After upgrading to a new fileset, there may be tasks that need to be done. Examples - import new TypicalSearches, if present. Tasks performed here need to be idempotent and independent of the actual upgrade jump (what was the previous version). They should complete in a reasonable time, not more than a few minutes maximum.
Declaration
Task<string> PerformTasksAfterUpgradeAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<string> | Message that can be shown to the user, summarizing what has been done, if anything. |
RemoveExpiredSystemMessagesAsync(CancellationToken)
Deletes expired system messages.
Declaration
Task RemoveExpiredSystemMessagesAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
RemoveSystemMessageAsync(int, string, CancellationToken)
Removes a system message for current associate
Declaration
Task RemoveSystemMessageAsync(int onlineappId, string systemMessageId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | onlineappId | Id of the online app that owns this message |
| string | systemMessageId | Message identifier, used for message removal |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
RemoveSystemMessageForAssociateAsync(int, string, int, CancellationToken)
Removes a system message for specific associate.
Declaration
Task RemoveSystemMessageForAssociateAsync(int onlineappId, string systemMessageId, int associateId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | onlineappId | Id of the online app that owns this message |
| string | systemMessageId | Message identifier, used for message update or removal |
| int | associateId | The associateId of the message target. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
ResyncUsersAsync(CancellationToken)
Resynchronize user information with SuperOffice Community, if opted-out then this call does nothing. The call returns immediately (starting a background thread), and updates CS scheduler table to set the next run time.
Declaration
Task ResyncUsersAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
SendSystemMessageAsync(string, int, string, DateTime, SystemMessageType, CancellationToken)
Adds a system message for a specific associate.
Declaration
Task SendSystemMessageAsync(string systemMessageId, int associateId, string markdownMessage, DateTime expire, SystemMessageType type, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | systemMessageId | The message string id |
| int | associateId | The associateId of the message target. |
| string | markdownMessage | Markdown message to be displayed to the user |
| DateTime | expire | When the message will no longer be available |
| SystemMessageType | type | Type of message, example: info, warning, error |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
TrackEventAsync(string, StringDictionary, CancellationToken)
Sends events to Amplitude and Userflow.
Declaration
Task<long> TrackEventAsync(string trackEventName, StringDictionary eventProperties, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | trackEventName | "Sale Completed" or "Sale Sold" etc. See the TrackEventNames class for suitable string constants. |
| StringDictionary | eventProperties | key-value pairs of event properties. client is set from the application token. Special keys: app_version, platform, os_name, os_version, device_brand, device_manufacturer |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<long> | Amplitude Session id used to track the event. May be the same as passed in SO-AMPLITUDE header or ampSess cookie, or a fresh one if none defined. |
TrackUserAsync(StringDictionary, CancellationToken)
Sends user identification to Amplitude and Userflow. Sets current rights, user licenses automatically. Additional properties can be specified in userProperties.
Declaration
Task<long> TrackUserAsync(StringDictionary userProperties, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| StringDictionary | userProperties | Optional: Additional key-value pairs of user properties to set on the user. Special keys: app_version, platform, os_name, os_version, device_brand, device_manufacturer |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<long> | Amplitude Session id used to track the user. May be the same as passed in SO-AMPLITUDE header or ampSess cookie, or a fresh one if none defined. |
WebAppUsageExistsInPeriodAsync(int, string, DateTime, CancellationToken)
Returns true if viewState has been clicked at least once since FromDate, if asscoiateId < 0 or FromDate is DateTime.MinValue no restriction given for those parameters
Declaration
Task<bool> WebAppUsageExistsInPeriodAsync(int associateId, string viewState, DateTime fromDate, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | associateId | The asscoiate id to look for webapp usage |
| string | viewState | The viewState to search for |
| DateTime | fromDate | The datetime to restrict webapp usage on |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<bool> | Returns true if viewState has been clicked at least once since FromDate |