NSDiagnosticEventProvider (Transact-SQL)

Produces the event provider report for a Microsoft SQL Server Notification Services application. The report contains information about the events collected through a specified event provider.

Syntax

[ schema_name . ] NSDiagnosticEventProvider 
    [ @ApplicationName = ] 'app_name' ,
    [ @EventProviderName = ] 'event_provider_name' 
    [, [ @ReportingInterval = ] interval ] 
    [, [ @StartDateTime = ] 'start_date_time' ] 
    [, [ @EndDateTime = ] 'end_date_time' ] 

Arguments

  • [ @ApplicationName = ] 'app_name'
    Is the name of an application, as defined in the configuration file. app_name is nvarchar(255) and has no default value.
  • [ @EventProviderName = ] 'event_provider_name'
    Is the name of an event provider within the application. event_provider_name is nvarchar(255) and has no default value.
  • [ @ReportingInterval = ] interval
    Is the number of generator quanta in each reporting interval. The report contains one row per interval. interval is int and has a default value of 1, which indicates one generator quantum per interval.

    The quantum duration is defined in the application definition file (ADF).

  • [ @StartDateTime = ] 'start_date_time'
    Is the report start date and time in UTC (Coordinated Universal Time or Greenwich Mean Time). start_date_time is datetime. The default value is @EndDateTime - (5 * QuantumDuration * @ReportingInterval). Using the default value, the result set contains at most five rows, each row representing one reporting interval.
  • [ @EndDateTime = ] 'end_date_time'
    Is the report end date and time in UTC. end_date_time is datetime. The default value is the time at which you invoke the stored procedure (in UTC).

Return Code Values

0 (success) or 1 (failure)

Result Sets

Column Name Data Type Description

IntervalStartDateTime

datetime

Start date and time for the reporting interval in UTC.

IntervalEndDateTime

datetime

End date and time for the reporting interval in UTC.

EventBatchesSubmitted

int

Number of event batches submitted by the event provider during the reporting interval.

EventsSubmitted

int

Number of events submitted by the event provider during the reporting interval.

AvgTimeCollectingEvents

float

Average time in seconds that the event provider spent collecting events during the reporting interval.

UnfinishedEventBatches

int

Number of event batches started, but not completed, by the event provider during the reporting interval.

Remarks

Notification Services creates the NSDiagnosticEventProvider stored procedure in the instance database when you create the instance. When you update the instance, Notification Services recompiles the stored procedure.

This stored procedure is in the instance schema, which is specified by the SchemaName element of the instance configuration file (ICF). If no schema name is provided, the default schema is dbo.

Event batches fall within the reporting interval when the EndCollectionTime value is greater than IntervalStartDateTime and less than or equal to IntervalEndDateTime.

To determine the current UTC date and time, run SELECT GETUTCDATE() in SQL Server Management Studio. The current UTC time is derived from the current local time and the time zone setting in the operating system of the computer on which SQL Server is running.

Permissions

Execute permissions default to members of the NSAnalysis database role, the db_owner fixed database role, and the sysadmin fixed server role.

Examples

A. Specify Reporting Interval, Start Time, and End Time

This example produces the event provider diagnostic report for the Flight application and FlightEP event provider. The instance uses the default database settings, which places all instance objects in the dbo schema.

The report includes 50 generator quanta in each report interval. The report starts at 5:00 P.M. on 23 May, 2004, and ends at 6:00 P.M. the same day (UTC).

EXEC dbo.NSDiagnosticEventProvider 
    @ApplicationName = N'Flight', 
    @EventProviderName = N'FlightEP', 
    @ReportingInterval = 50, 
    @StartDateTime = '2004-05-23 17:00', 
    @EndDateTime = '2004-05-23 18:00';

B. Use Default Values, Named Schema

This example produces the event provider diagnostic report for the Flight application and FlightEP event provider. In this example, the stored procedure (like all other instance objects) is in the FlightInstance schema, as specified in the SchemaName element of the ICF.

The report uses default values, which specifies to show data for the past five generator quanta.

EXEC FlightInstance.NSDiagnosticEventProvider 
    @ApplicationName = N'Flight', 
    @EventProviderName = N'FlightEP';

See Also

Reference

Notification Services Stored Procedures (Transact-SQL)

Other Resources

Notification Services Performance Reports
SchemaName Element (ICF)

Help and Information

Getting SQL Server 2005 Assistance