diff --git a/samples/features/r-services/README.md b/samples/features/r-services/README.md
index 349de333..7d7a1148 100644
--- a/samples/features/r-services/README.md
+++ b/samples/features/r-services/README.md
@@ -1,6 +1,10 @@
-# R Services
+# Samples for SQL Server R Services
-Placeholder.
+[Telco Customer Churn](Telco Customer Churn)
+
+Telco Customer Churn sample using SQL Server R Services.
+
+[SSMS Custom Reports](SSMS-Custom-Reports)
+
+Custom reports for SQL Server R Services built using SQL Server Report Builder. The reports can be added to SQL Server Management Studio to view various configuration and runtime information about R scripts execution in SQL Server.
-For now, refer to:
-[https://github.com/Microsoft/SQL-Server-R-Services-Samples] (https://github.com/Microsoft/SQL-Server-R-Services-Samples)
diff --git a/samples/features/r-services/SSMS-Custom-Reports/R Services - Active Sessions.rdl b/samples/features/r-services/SSMS-Custom-Reports/R Services - Active Sessions.rdl
new file mode 100644
index 00000000..be6f489d
--- /dev/null
+++ b/samples/features/r-services/SSMS-Custom-Reports/R Services - Active Sessions.rdl
@@ -0,0 +1,1588 @@
+
+
+ 0
+
+
+
+ SQL
+ Data Source=.
+ true
+
+ Integrated
+ f68705bb-df33-493e-b2ea-e8070ba8d88b
+
+
+
+
+
+ SqlConnection
+ select r.session_id, r.blocking_session_id, r.status
+ , db_name(s.database_id) as database_name, s.login_name
+ , r.wait_time, r.wait_type, r.last_wait_type
+ , r.total_elapsed_time, r.reads, r.logical_reads, r.writes
+ , er.language as script_type, er.degree_of_parallelism, er.external_user_name
+ from sys.dm_exec_requests as r
+ join sys.dm_external_script_requests as er
+ on r.external_script_request_id = er.external_script_request_id
+ join sys.dm_exec_sessions as s
+ on s.session_id = r.session_id;
+ true
+
+
+
+ session_id
+ System.Int16
+
+
+ blocking_session_id
+ System.Int16
+
+
+ status
+ System.String
+
+
+ wait_type
+ System.String
+
+
+ database_name
+ System.String
+
+
+ login_name
+ System.String
+
+
+ wait_time
+ System.Int32
+
+
+ last_wait_type
+ System.String
+
+
+ total_elapsed_time
+ System.Int32
+
+
+ reads
+ System.Int64
+
+
+ writes
+ System.Int64
+
+
+ logical_reads
+ System.Int64
+
+
+ script_type
+ System.String
+
+
+ degree_of_parallelism
+ System.Int32
+
+
+ external_user_name
+ System.String
+
+
+
+
+
+
+
+
+
+
+
+
+ 1in
+
+
+ 1in
+
+
+ 0.63333in
+
+
+ 1in
+
+
+
+
+ 0.25in
+
+
+
+
+ true
+ true
+
+
+
+
+ Total Elapsed Time (ms)
+
+
+
+
+
+
+ Textbox4
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ Reads
+
+
+
+
+
+
+ Textbox5
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ Logical Reads
+
+
+
+
+
+
+ Textbox29
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ Writes
+
+
+
+
+
+
+ Textbox7
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 0.25in
+
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!total_elapsed_time.Value)
+
+
+
+
+
+
+ total_elapsed_time
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!reads.Value)
+
+
+
+
+
+
+ reads
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!logical_reads.Value)
+
+
+
+
+
+
+ reads
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!writes.Value)
+
+
+
+
+
+
+ writes
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1in
+
+
+ true
+ true
+
+
+
+
+ Session ID
+
+
+
+
+
+
+ Textbox23
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 1in
+
+
+ true
+ true
+
+
+
+
+ Blocking Session ID
+
+
+
+
+
+
+ Textbox21
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 1in
+
+
+ true
+ true
+
+
+
+
+ Status
+
+
+
+
+
+
+ Textbox19
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 1in
+
+
+ true
+ true
+
+
+
+
+ Wait Type
+
+
+
+
+
+
+ Textbox17
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 1in
+
+
+ true
+ true
+
+
+
+
+ Wait Time
+
+
+
+
+
+
+ Textbox27
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 1in
+
+
+ true
+ true
+
+
+
+
+ Last Wait Type
+
+
+
+
+
+
+ Textbox15
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 0.525in
+
+
+ true
+ true
+
+
+
+
+ Script Type
+
+
+
+
+
+
+ Textbox13
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 0.475in
+
+
+ true
+ true
+
+
+
+
+ DOP
+
+
+
+
+
+
+ Textbox11
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 1in
+
+
+ true
+ true
+
+
+
+
+ Database Name
+
+
+
+
+
+
+ Textbox10
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 1in
+
+
+ true
+ true
+
+
+
+
+ Login Name
+
+
+
+
+
+
+ Textbox2
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 1.34167in
+
+
+ true
+ true
+
+
+
+
+ External User Name
+
+
+
+
+
+
+ Textbox9
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =Fields!session_id.Value
+
+
+
+
+ =Fields!session_id.Value
+
+
+
+ 1in
+
+
+ true
+ true
+
+
+
+
+ =Fields!session_id.Value
+
+
+
+
+
+
+ session_id
+
+
+ #9eb6e4
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+ =Fields!blocking_session_id.Value
+
+
+
+
+ =Fields!blocking_session_id.Value
+
+
+
+ 1in
+
+
+ true
+ true
+
+
+
+
+ =Fields!blocking_session_id.Value
+
+
+
+
+
+
+ blocking_session_id
+
+
+ #c6daf8
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+ =Fields!status.Value
+
+
+
+
+ =Fields!status.Value
+
+
+
+ 1in
+
+
+ true
+ true
+
+
+
+
+ =Fields!status.Value
+
+
+
+
+
+
+ status
+
+
+ #e6eefc
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+ =Fields!wait_type.Value
+
+
+
+
+ =Fields!wait_type.Value
+
+
+
+ 1in
+
+
+ true
+ true
+
+
+
+
+ =Fields!wait_type.Value
+
+
+
+
+
+
+ wait_type
+
+
+ #e6eefc
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 1in
+
+
+ true
+ true
+
+
+
+
+ =Fields!wait_time.Value
+
+
+
+
+
+
+ wait_time
+
+
+ #e6eefc
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+ =Fields!last_wait_type.Value
+
+
+
+
+ =Fields!last_wait_type.Value
+
+
+
+
+
+ 1in
+
+
+ true
+ true
+
+
+
+
+ =Fields!last_wait_type.Value
+
+
+
+
+
+
+ last_wait_type
+
+
+ #e6eefc
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+ =Fields!script_type.Value
+
+
+
+
+ =Fields!script_type.Value
+
+
+
+ 0.525in
+
+
+ true
+ true
+
+
+
+
+ =Fields!script_type.Value
+
+
+
+
+
+
+ script_type
+
+
+ #e6eefc
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+ =Fields!degree_of_parallelism.Value
+
+
+
+
+ =Fields!degree_of_parallelism.Value
+
+
+
+ 0.475in
+
+
+ true
+ true
+
+
+
+
+ =Fields!degree_of_parallelism.Value
+
+
+
+
+
+
+ degree_of_parallelism
+
+
+ #e6eefc
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 1in
+
+
+ true
+ true
+
+
+
+
+ =Fields!database_name.Value
+
+
+
+
+
+
+ database_name
+
+
+ #e6eefc
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 1in
+
+
+ true
+ true
+
+
+
+
+ =Fields!login_name.Value
+
+
+
+
+
+
+ login_name
+
+
+ #e6eefc
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+ =Fields!external_user_name.Value
+
+
+
+
+ =Fields!external_user_name.Value
+
+
+
+ 1.34167in
+
+
+ true
+ true
+
+
+
+
+ =Fields!external_user_name.Value
+
+
+
+
+
+
+ external_user_name
+
+
+ #e6eefc
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ external_script_requests
+ 1.10833in
+ 0.5in
+ 13.975in
+
+
+
+
+
+ true
+ true
+
+
+
+
+ SQL Server R Services - Active Sessions
+
+
+
+
+
+
+ Title
+ ReportTitle
+ 0.4in
+ 6in
+ 1
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ This report shows the currently executing R scripts on the server.
+
+
+
+
+
+
+ Textbox1
+ 0.46944in
+ 0.25in
+ 9in
+ 2
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ View SQL script
+
+
+
+
+
+
+
+
+
+
+ =".\R Services - Script"
+
+
+ SQL Server R Services - Active Sessions
+
+
+ =DataSets("external_script_requests").CommandText
+
+
+
+
+
+
+ 0.78889in
+ 12.91667in
+ 0.25in
+ 1.05833in
+ 3
+ Click here to view the T-SQL script used to generate the data in the report.
+
+
+ LightGrey
+ Middle
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ 1.64667in
+
+
+
+
+ 13.975in
+
+
+ 0.45in
+ true
+ true
+
+
+ true
+ true
+
+
+
+
+ =Globals!ExecutionTime
+
+
+
+
+
+
+ ExecutionTime
+ 0.2in
+ 9.975in
+ 0.25in
+ 2in
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 1in
+ 1in
+ 1in
+ 1in
+
+
+
+
+
+
+ String
+
+
+ SPE-SAG4HP-02
+
+
+ ServerName
+ true
+
+
+ Inch
+ 2d6f122f-88fc-4fb4-9573-33bf83616a77
+
\ No newline at end of file
diff --git a/samples/features/r-services/SSMS-Custom-Reports/R Services - Configuration.rdl b/samples/features/r-services/SSMS-Custom-Reports/R Services - Configuration.rdl
new file mode 100644
index 00000000..4c85ddbe
--- /dev/null
+++ b/samples/features/r-services/SSMS-Custom-Reports/R Services - Configuration.rdl
@@ -0,0 +1,1256 @@
+
+
+ This report provides SQL Server R Services configuration information
+ Umachandar Jayachandran
+ 0
+
+
+
+ SQL
+ Data Source=.
+ true
+
+ Integrated
+ b3217cf0-c85a-4901-908f-abd9144894c6
+
+
+
+
+
+ SqlConnection
+ /*
+ Retrieve the R Services installation setting & configuration options:
+ Implied Authentication Configuration is checked by verifying if login exists for SQLRUserGroup
+*/
+select CAST(SERVERPROPERTY('IsAdvancedAnalyticsInstalled') as int) as IsRServicesInstalled
+ , CAST(value_in_use as int) as ExternalScriptsEnabled
+ , COALESCE(SIGN(SUSER_ID(CONCAT(CAST(SERVERPROPERTY('MachineName') as nvarchar(128))
+ , '\SQLRUserGroup'
+ , CAST(serverproperty('InstanceName') as nvarchar(128)
+ )))), 0) as ImpliedAuthenticationEnabled
+ , coalesce((select cast(r.value_data as int)
+ from sys.dm_server_registry as r
+ where r.registry_key like 'HKLM\Software\Microsoft\Microsoft SQL Server\%\SuperSocketNetLib\TCP'
+ and r.value_name = 'Enabled'), -1) as IsTcpEnabled
+ from sys.configurations
+ where name = 'external scripts enabled';
+ true
+
+
+
+ IsRServicesInstalled
+ System.Int32
+
+
+ ExternalScriptsEnabled
+ System.Int32
+
+
+ ImpliedAuthenticationEnabled
+ System.Int32
+
+
+ IsTcpEnabled
+ System.Int32
+
+
+
+
+
+ SqlConnection
+ /*
+ Get R runtime properties
+*/
+if (select CAST(SERVERPROPERTY('IsAdvancedAnalyticsInstalled') as int) & CAST(value_in_use as int)
+ from sys.configurations
+ where name = 'external scripts enabled') = 1
+begin
+ exec sp_execute_external_script
+ @language = N'R'
+ , @script = N'
+ # Retrieve properties like R.home, libPath & default packages
+ OutputDataSet <- data.frame(
+ property_name = c("R.home", "libPaths", "defaultPackages"),
+ property_value = c(R.home(), .libPaths(), paste(getOption("defaultPackages"), collapse=", "))
+ )
+ # Transform R version properties to data.frame
+ OutputDataSet <- rbind(OutputDataSet, data.frame(
+ property_name = names(R.version),
+ property_value = matrix(unlist(R.version), nrow = length(R.version), byrow = TRUE),
+ stringsAsFactors = FALSE)
+ )
+ '
+ with result sets ((property_name nvarchar(100), property_value nvarchar(4000)));
+end;
+ true
+
+
+
+ property_name
+ System.String
+
+
+ property_value
+ System.String
+
+
+
+
+
+ SqlConnection
+ /*
+ Check if restart of SQL Server instance is required:
+*/
+select (cast(value_in_use as int) ^ cast(value as int)) as IsRestartRequired
+ from sys.configurations
+ where name = 'external scripts enabled';
+ true
+
+
+
+ IsRestartRequired
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+ 1.4875in
+
+
+ 7.15in
+
+
+
+
+ 0.25in
+
+
+
+
+ true
+ true
+
+
+
+
+ R Runtime Property
+
+
+
+
+
+
+ Textbox8
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ Property Value
+
+
+
+
+
+
+ Textbox9
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 0.25in
+
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!property_name.Value
+
+
+
+
+
+
+ property_name
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!property_value.Value
+
+
+
+
+
+
+ property_value
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ After
+
+
+
+
+
+
+ R_Properties
+ 1.53333in
+ 0.5in
+ 8.6375in
+
+
+
+
+
+
+
+
+ 1in
+
+
+ 1in
+
+
+ 1.25833in
+
+
+ 1in
+
+
+
+
+ 0.25in
+
+
+
+
+ true
+ true
+
+
+
+
+ R Services Installed
+
+
+
+
+
+
+ Textbox2
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ External Scripts Enabled
+
+
+
+
+
+
+ Textbox3
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ Implied Authentication Enabled
+
+
+
+
+
+
+ Textbox5
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ TCP/IP Enabled
+
+
+
+
+
+
+ Textbox6
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 0.35833in
+
+
+
+
+
+
+
+ =First(Fields!IsRServicesInstalled.Value)
+ 1
+ NoOutput
+
+ None
+ Tablix1
+
+ NaN
+ 1
+
+
+ NaN
+ 1
+
+ None
+
+ External
+
+
+ 1
+
+
+
+ 0
+ 1
+
+
+ 0
+ 1
+
+ Red
+ 1
+ ThreeSymbolCross
+
+ External
+
+
+
+
+
+ 1
+ 1
+
+
+ 1
+ 1
+
+ Green
+ 1
+ ThreeSymbolCheck
+
+ External
+
+
+
+
+ 0
+
+ ThreeCircledSymbols
+
+ 4
+ 4
+ 92
+ 92
+
+
+ true
+
+
+
+ Gainsboro
+ DiagonalLeft
+ Gray
+ None
+ 0pt
+
+
+
+
+
+ External
+
+
+
+
+ External
+
+
+ Feature_Settings
+
+
+ White
+
+
+
+
+
+
+
+
+
+
+ =Sum(Fields!ExternalScriptsEnabled.Value)
+ 1
+ NoOutput
+
+ None
+ Tablix1
+
+ NaN
+ 1
+
+
+ NaN
+ 1
+
+ None
+
+ External
+
+
+ 1
+
+
+
+ 0
+ 1
+
+
+ 0
+ 1
+
+ Red
+ 1
+ ThreeSymbolCross
+
+ External
+
+
+
+
+
+ 1
+ 1
+
+
+ 1
+ 1
+
+ Green
+ 1
+ ThreeSymbolCheck
+
+ External
+
+
+
+
+ 0
+
+ ThreeCircledSymbols
+
+ 4
+ 4
+ 92
+ 92
+
+
+ true
+
+
+
+ Gainsboro
+ DiagonalLeft
+ Gray
+ None
+ 0pt
+
+
+
+
+
+ External
+
+
+
+
+ External
+
+
+ Feature_Settings
+
+
+ White
+
+
+
+
+
+
+
+
+
+
+ =Sum(Fields!ImpliedAuthenticationEnabled.Value)
+ 1
+ NoOutput
+
+ None
+ Tablix1
+
+ NaN
+ 1
+
+
+ NaN
+ 1
+
+ None
+
+ External
+
+
+ 1
+
+
+
+ 0
+ 1
+
+
+ 0
+ 1
+
+ Red
+ 1
+ ThreeSymbolCross
+
+ External
+
+
+
+
+
+ 1
+ 1
+
+
+ 1
+ 1
+
+ Green
+ 1
+ ThreeSymbolCheck
+
+ External
+
+
+
+
+ 0
+
+ ThreeCircledSymbols
+
+ 4
+ 4
+ 92
+ 92
+
+
+ true
+
+
+
+ Gainsboro
+ DiagonalLeft
+ Gray
+ None
+ 0pt
+
+
+
+
+
+ External
+
+
+
+
+ External
+
+
+ Feature_Settings
+
+
+ White
+
+
+
+
+
+
+
+
+
+
+ =Sum(Fields!IsTcpEnabled.Value)
+ 1
+ NoOutput
+
+ None
+ Tablix1
+
+ NaN
+ 1
+
+
+ NaN
+ 1
+
+ None
+
+ External
+
+
+ 1
+
+
+
+ 0
+ 1
+
+
+ 0
+ 1
+
+ Red
+ 1
+ ThreeSymbolCross
+
+ External
+
+
+
+
+
+ 1
+ 1
+
+
+ 1
+ 1
+
+ Green
+ 1
+ ThreeSymbolCheck
+
+ External
+
+
+
+
+
+ -1
+ 1
+ NoOutput
+
+
+ -1
+ 1
+ NoOutput
+
+ Orange
+ 1
+ ThreeSymbolUnCircledExclamation
+
+ External
+
+
+
+
+ 0
+
+ ThreeCircledSymbols
+
+ 4
+ 4
+ 92
+ 92
+
+
+ true
+
+
+
+ Gainsboro
+ DiagonalLeft
+ Gray
+ None
+ 0pt
+
+
+
+
+
+ External
+
+
+
+
+ External
+
+
+ Feature_Settings
+
+
+ White
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Feature_Settings
+ 0.84444in
+ 0.60833in
+ 4.25833in
+ 1
+
+
+
+
+
+ true
+ true
+
+
+
+
+ SQL Server R Services - Configuration
+
+
+
+
+
+
+ Title
+ ReportTitle
+ 0.4in
+ 7.98333in
+ 2
+
+
+ LightGrey
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ This report provides configuration settings for SQL Server R Services and properties of the R installation. Click the "Configure Instance" buton when visible to configure instance for external scripts execution & implied authentication.
+
+
+
+
+
+
+ Textbox1
+ 0.51333in
+ 0.25in
+ 7.98333in
+ 3
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ View SQL script
+
+
+
+
+
+
+
+
+
+
+ =".\R Services - Script"
+
+
+ SQL Server R Services - Configuration
+
+
+ =DataSets("Feature_Settings").CommandText & chr(13) & chr(10) & "go" & chr(13) & chr(10) & DataSets("R_Properties").CommandText & chr(13) & chr(10) & "go" & chr(13) & chr(10) & DataSets("IsRestartRequired").CommandText
+
+
+
+
+
+
+ 0.84444in
+ 7.57917in
+ 0.25in
+ 1.05833in
+ 4
+ Click here to view the T-SQL script used to generate the data in the report.
+
+
+ LightGrey
+ Middle
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ Configure Instance
+
+
+
+
+
+
+
+
+
+
+ =".\R Services - Configure Instance"
+
+
+
+
+ 1.20277in
+ 7.3875in
+ 0.25in
+ 1.25in
+ 5
+
+ =Sum(Fields!ExternalScriptsEnabled.Value, "Feature_Settings") = 1 And Sum(Fields!ImpliedAuthenticationEnabled.Value, "Feature_Settings") = 1
+
+ Click here to configure the instance for R Services.
+
+
+ LightGrey
+ Middle
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ Restart of SQL Server instance is required for configuration changes to take effect.
+
+
+
+
+
+
+ Textbox4
+ 0.81889in
+ 4.46597in
+ 0.60833in
+ 2.85208in
+ 6
+
+ =IIF(First(Fields!Flag.Value, "IsRestartRequired") = 0, True, False)
+
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ 2.06666in
+
+
+
+
+ 8.66666in
+
+
+ 0.45in
+ true
+ true
+
+
+ true
+ true
+
+
+
+
+ =Globals!ExecutionTime
+
+
+
+
+
+
+ ExecutionTime
+ 0.2in
+ 6.6375in
+ 0.25in
+ 2in
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 1in
+ 1in
+ 1in
+ 1in
+
+
+
+
+
+
+ String
+
+
+ .
+
+
+ ServerName
+ true
+
+
+ Inch
+ 9ab6c190-a62f-424e-a13a-102d103b4239
+
\ No newline at end of file
diff --git a/samples/features/r-services/SSMS-Custom-Reports/R Services - Configure Instance.rdl b/samples/features/r-services/SSMS-Custom-Reports/R Services - Configure Instance.rdl
new file mode 100644
index 00000000..1004afc7
--- /dev/null
+++ b/samples/features/r-services/SSMS-Custom-Reports/R Services - Configure Instance.rdl
@@ -0,0 +1,245 @@
+
+
+ 0
+
+
+
+ SQL
+ Data Source=.
+ true
+
+ Integrated
+ f68705bb-df33-493e-b2ea-e8070ba8d88b
+
+
+
+
+
+ SqlConnection
+ exec sp_configure 'external scripts enabled', 1;
+reconfigure with override;
+
+declare @login_name nvarchar(255) = CONCAT(cast(SERVERPROPERTY('MachineName') as nvarchar(128)), '\SQLRUserGroup', CAST(serverproperty('InstanceName') as nvarchar(128)));
+if SUSER_ID(@login_name) is null
+begin
+ set @login_name = QUOTENAME(@login_name);
+ exec('create login ' + @login_name + ' from windows;');
+end;
+
+select 'R Services has been configured for use. SQL Server service needs to be restarted!' as Message
+ true
+
+
+
+ message
+ System.Int32
+
+
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ SQL Server R Services - Enable Instance Settings
+
+
+
+
+
+
+ Title
+ ReportTitle
+ 0.4in
+ 7.53333in
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ Executed script:
+
+
+
+
+
+
+ Textbox1
+ 0.44167in
+ 0.02333in
+ 0.25in
+ 1.10333in
+ 1
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ =DataSets("Reconfigure").CommandText
+
+
+
+
+
+
+ 0.79584in
+ 0.02334in
+ 0.25in
+ 8.95333in
+ 2
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ =First(Fields!message.Value, "Reconfigure")
+
+
+
+
+
+
+ message
+ 1.11528in
+ 0.02333in
+ 0.25in
+ 8.95334in
+ 3
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ 1.42167in
+
+
+
+
+ 9in
+
+
+ 0.45in
+ true
+ true
+
+
+ true
+ true
+
+
+
+
+ =Globals!ExecutionTime
+
+
+
+
+
+
+ ExecutionTime
+ 0.2in
+ 7in
+ 0.25in
+ 2in
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 1in
+ 1in
+ 1in
+ 1in
+
+
+
+
+
+
+ String
+
+
+ .
+
+
+ ServerName
+ true
+
+
+ Inch
+ 2d6f122f-88fc-4fb4-9573-33bf83616a77
+
\ No newline at end of file
diff --git a/samples/features/r-services/SSMS-Custom-Reports/R Services - Execution Statistics.rdl b/samples/features/r-services/SSMS-Custom-Reports/R Services - Execution Statistics.rdl
new file mode 100644
index 00000000..3111f140
--- /dev/null
+++ b/samples/features/r-services/SSMS-Custom-Reports/R Services - Execution Statistics.rdl
@@ -0,0 +1,725 @@
+
+
+ This report provides execution statistics for SQL Server R Services.
+ Umachandar Jayachandran
+ 0
+
+
+
+ SQL
+ Data Source=.
+ true
+
+ Integrated
+ f68705bb-df33-493e-b2ea-e8070ba8d88b
+
+
+
+
+
+ SqlConnection
+ /*
+ Retrieve execution statistics for R runtime.
+ Only statistics of RevoScaleR package functions are currently available.
+*/
+select counter_name, counter_value
+ from sys.dm_external_script_execution_stats
+ where language = 'R'
+ and counter_value > 0;
+ true
+
+
+
+ counter_name
+ System.String
+
+
+ counter_value
+ System.Int64
+
+
+
+
+
+ SqlConnection
+ /*
+ Retrieve execution statistics for sp_execute_external_script calls.
+*/
+select rtrim(counter_name) as counter_name, cntr_value as counter_value
+ from sys.dm_os_performance_counters
+ where object_name like concat(case when serverproperty('InstanceName') is null
+ then 'SQLServer'
+ else concat('MSSQL$', cast(serverproperty('InstanceName') as varchar(60)))
+ end, ':External Scripts%');
+ true
+
+
+
+ counter_name
+ System.String
+
+
+ counter_value
+ System.Int64
+
+
+
+
+
+
+
+
+
+
+
+
+ 1in
+
+
+
+
+ 0.25in
+
+
+
+
+ true
+ true
+
+
+
+
+ Counter Value
+
+
+
+
+
+
+ Textbox9
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 0.25in
+
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!counter_value.Value)
+
+
+
+
+
+
+ counter_value1
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1.63334in
+
+
+ true
+ true
+
+
+
+
+ Counter Name
+
+
+
+
+
+
+ Textbox10
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+
+
+
+ =Fields!counter_name.Value
+
+
+
+
+ =Fields!counter_name.Value
+
+
+
+ 1.63334in
+
+
+ true
+ true
+
+
+
+
+ =Fields!counter_name.Value
+
+
+
+
+
+
+ counter_name1
+
+
+ #9eb6e4
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+
+
+ r_statistics
+ 1.08056in
+ 3.89166in
+ 0.5in
+ 2.63334in
+
+
+
+
+
+
+
+
+ 1in
+
+
+
+
+ 0.25in
+
+
+
+
+ true
+ true
+
+
+
+
+ Counter Value
+
+
+
+
+
+
+ Textbox3
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 0.25in
+
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!counter_value.Value)
+
+
+
+
+
+
+ counter_value
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2.25in
+
+
+ true
+ true
+
+
+
+
+ Counter Name
+
+
+
+
+
+
+ Textbox4
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+
+
+
+ =Fields!counter_name.Value
+
+
+
+
+ =Fields!counter_name.Value
+
+
+
+ 2.25in
+
+
+ true
+ true
+
+
+
+
+ =Fields!counter_name.Value
+
+
+
+
+
+
+ counter_name
+
+
+ #9eb6e4
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+
+
+ sp_execute_external_script_statistics
+ 1.08056in
+ 0.5in
+ 3.25in
+ 1
+
+
+
+
+
+ true
+ true
+
+
+
+
+ SQL Server R Services - Execution Statistics
+
+
+
+
+
+
+ Title
+ ReportTitle
+ 0.4in
+ 6.99167in
+ 2
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ This report provides the execution statistics of sp_execute_external_script system stored procedure and rx* functions in RevoScaleR package (Microsoft R Server).
+
+
+
+
+
+
+ Textbox1
+ 0.46944in
+ 0.25in
+ 9in
+ 3
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ View SQL script
+
+
+
+
+
+
+
+
+
+
+ =".\R Services - Script"
+
+
+ SQL Server R Services - Execution Statistics
+
+
+ =DataSets("r_statistics").CommandText & chr(13) & chr(10) & "go" & chr(13) & chr(10) & DataSets("sp_execute_external_script_statistics").CommandText
+
+
+
+
+
+
+ 0.78889in
+ 7.81667in
+ 0.25in
+ 1.05833in
+ 4
+ Click here to view the T-SQL script used to generate the data in the report.
+
+
+ LightGrey
+ Middle
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ Statistics for sp_execute_external_script:
+
+
+
+
+
+
+ Textbox6
+ 0.78889in
+ 0.01333in
+ 0.25in
+ 2.65in
+ 5
+
+
+ LightGrey
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ Statistics for RevoScaleR package:
+
+
+
+
+
+
+ Textbox6
+ 0.78889in
+ 3.89166in
+ 0.25in
+ 2.46667in
+ 6
+
+
+ LightGrey
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ 1.61389in
+
+
+
+
+ 9in
+
+
+ 0.45in
+ true
+ true
+
+
+ true
+ true
+
+
+
+
+ =Globals!ExecutionTime
+
+
+
+
+
+
+ ExecutionTime
+ 0.2in
+ 7in
+ 0.25in
+ 2in
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 1in
+ 1in
+ 1in
+ 1in
+
+
+
+
+
+
+ String
+
+
+ .
+
+
+ ServerName
+ true
+
+
+ Inch
+ 2d6f122f-88fc-4fb4-9573-33bf83616a77
+
\ No newline at end of file
diff --git a/samples/features/r-services/SSMS-Custom-Reports/R Services - Extended Events.rdl b/samples/features/r-services/SSMS-Custom-Reports/R Services - Extended Events.rdl
new file mode 100644
index 00000000..7a0ace5a
--- /dev/null
+++ b/samples/features/r-services/SSMS-Custom-Reports/R Services - Extended Events.rdl
@@ -0,0 +1,472 @@
+
+
+ 0
+
+
+
+ SQL
+ Data Source=.
+ true
+
+ Integrated
+ f68705bb-df33-493e-b2ea-e8070ba8d88b
+
+
+
+
+
+ SqlConnection
+ /*
+ Get list of extended events from SQLSatellite package.
+*/
+select o.name as event_name, o.description
+ from sys.dm_xe_objects o
+ join sys.dm_xe_packages p
+ on o.package_guid = p.guid
+ where o.object_type = 'event'
+ and p.name = 'SQLSatellite';
+ true
+
+
+
+ event_name
+ System.String
+
+
+ description
+ System.String
+
+
+
+
+
+
+
+
+
+
+
+
+ 5.89167in
+
+
+
+
+ 0.25in
+
+
+
+
+ true
+ true
+
+
+
+
+ Description
+
+
+
+
+
+
+ Textbox3
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 0.25in
+
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!description.Value
+
+
+
+
+
+
+ description
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2.98333in
+
+
+ true
+ true
+
+
+
+
+ Event Name
+
+
+
+
+
+
+ Textbox4
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ After
+
+
+
+
+ =Fields!event_name.Value
+
+
+
+
+ =Fields!event_name.Value
+
+
+
+ 2.98333in
+
+
+ true
+ true
+
+
+
+
+ =Fields!event_name.Value
+
+
+
+
+
+
+ event_name
+
+
+ #9eb6e4
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+
+
+
+
+ r_extended_events
+ 1.09167in
+ 0.5in
+ 8.875in
+
+
+
+
+
+ true
+ true
+
+
+
+
+ SQL Server R Services - Extended Events
+
+
+
+
+
+
+ Title
+ ReportTitle
+ 0.4in
+ 6in
+ 1
+
+
+ LightGrey
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ This report lists the extended events available for SQL Server R Services.The events are grouped in the package "SQLSatellite". Typically, the events of interest are satellite_data_receive_completion, satellite_data_send_completion, satellite_schema_received, and satellite_schema_sent to determine the stage of execution for the R script / sp_execute_external_script call.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Additionally, there are extented events that can be configured for Launchpad service & BxlServer process.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ More details can be found at https://msdn.microsoft.com/en-us/library/mt628054.aspx.
+
+
+
+
+
+
+ Textbox1
+ 0.46944in
+ 0.25in
+ 8.875in
+ 2
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ View SQL script
+
+
+
+
+
+
+
+
+
+
+ =".\R Services - Script"
+
+
+ SQL Server R Services - Extended Events
+
+
+ =DataSets("r_extended_events").CommandText
+
+
+
+
+
+
+ 0.78889in
+ 7.81667in
+ 0.25in
+ 1.05833in
+ 3
+ Click here to view the T-SQL script used to generate the data in the report.
+
+
+ LightGrey
+ Middle
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ 1.59167in
+
+
+
+
+ 8.90833in
+
+
+ 0.45in
+ true
+ true
+
+
+ true
+ true
+
+
+
+
+ =Globals!ExecutionTime
+
+
+
+
+
+
+ ExecutionTime
+ 0.2in
+ 6.875in
+ 0.25in
+ 2in
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 1in
+ 1in
+ 1in
+ 1in
+
+
+
+
+
+
+ String
+
+
+ .
+
+
+ ServerName
+ true
+
+
+ Inch
+ 2d6f122f-88fc-4fb4-9573-33bf83616a77
+
\ No newline at end of file
diff --git a/samples/features/r-services/SSMS-Custom-Reports/R Services - Packages.rdl b/samples/features/r-services/SSMS-Custom-Reports/R Services - Packages.rdl
new file mode 100644
index 00000000..95b82f47
--- /dev/null
+++ b/samples/features/r-services/SSMS-Custom-Reports/R Services - Packages.rdl
@@ -0,0 +1,807 @@
+
+
+ This report shows R packages installed on the SQL Server machine.
+ Umachandar Jayachandran
+ 0
+
+
+
+ SQL
+ Data Source=.
+ true
+
+ Integrated
+ 888cc098-f33d-44a7-9758-c75f85be1817
+
+
+
+
+
+ SqlConnection
+ /*
+ Get list of installed packages:
+*/
+if (select CAST(SERVERPROPERTY('IsAdvancedAnalyticsInstalled') as int) & CAST(value_in_use as int)
+ from sys.configurations
+ where name = 'external scripts enabled') = 1
+begin
+ exec sp_execute_external_script
+ @language = N'R'
+ , @script = N'
+ # Use installed packages to determine packages installed in the R directory
+ OutputDataSet <- data.frame(installed.packages()[,c("Package", "Version", "Depends", "License", "Built", "LibPath")]);
+ '
+ with result sets ((Package nvarchar(255), Version nvarchar(100), Depends nvarchar(4000), License nvarchar(1000), Built nvarchar(100), LibPath nvarchar(2000)));
+end;
+ true
+
+
+
+ Package
+ System.String
+
+
+ Version
+ System.String
+
+
+ Depends
+ System.String
+
+
+ License
+ System.String
+
+
+ Built
+ System.String
+
+
+ LibPath
+ System.String
+
+
+
+
+
+
+
+
+
+
+
+
+ 1.33056in
+
+
+ 0.84723in
+
+
+ 2.18331in
+
+
+ 1.725in
+
+
+ 0.53334in
+
+
+ 3.78891in
+
+
+
+
+ 0.25in
+
+
+
+
+ true
+ true
+
+
+
+
+ Package
+
+
+
+
+
+
+ Textbox2
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ Version
+
+
+
+
+
+
+ Textbox3
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ Depends
+
+
+
+
+
+
+ Textbox5
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ License
+
+
+
+
+
+
+ Textbox7
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ Built
+
+
+
+
+
+
+ Textbox9
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ Lib Path
+
+
+
+
+
+
+ Textbox11
+
+
+ #4c68a2
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 0.25in
+
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!Package.Value
+
+
+
+
+
+
+ Package
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!Version.Value
+
+
+
+
+
+
+ Version
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!Depends.Value
+
+
+
+
+
+
+ Depends
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!License.Value
+
+
+
+
+
+
+ License
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!Built.Value
+
+
+
+
+
+
+ Built
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!LibPath.Value
+
+
+
+
+
+
+ LibPath
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ After
+
+
+
+
+
+
+ true
+ true
+ true
+ true
+ R_Packages
+
+ Between
+
+ 1.15in
+ 0.5in
+ 10.40835in
+
+
+
+
+
+ true
+ true
+
+
+
+
+ SQL Server R Services - Installed Packages
+
+
+
+
+
+
+ Title
+ ReportTitle
+ 0.4in
+ 10.40835in
+ 1
+
+
+ LightGrey
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ This report displays few properties of the packages installed in the R_SERVICES directory of the SQL Server instance. Use this report to determine if a particular package is installed for use in SQL Server and the location of the package on the file system.
+
+
+
+
+
+
+ Textbox1
+ 0.41666in
+ 0.36667in
+ 10.40835in
+ 2
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ View SQL script
+
+
+
+
+
+
+
+
+
+
+ =".\R Services - Script"
+
+
+ SQL Server R Services - Installed Packages
+
+
+ =DataSets("R_Packages").CommandText
+
+
+
+
+
+
+ 0.825in
+ 9.35002in
+ 0.25in
+ 1.05833in
+ 3
+ Click here to view the T-SQL script used to generate the data in the report.
+
+
+ LightGrey
+ Middle
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ Total number of packages:
+
+
+
+
+
+
+ Textbox4
+ 0.85001in
+ 0.25in
+ 1.70833in
+ 4
+
+
+ LightGrey
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ =Count(Fields!Package.Value, "R_Packages")
+
+
+
+
+
+
+ 0.855in
+ 1.77167in
+ 0.25in
+ 1in
+ 5
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ 1.68333in
+
+
+
+
+ 10.43335in
+
+
+ 0.45in
+ true
+ true
+
+
+ true
+ true
+
+
+
+
+ =Globals!ExecutionTime
+
+
+
+
+
+
+ ExecutionTime
+ 0.2in
+ 8.40835in
+ 0.25in
+ 2in
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 1in
+ 1in
+ 1in
+ 1in
+
+
+
+
+
+
+ String
+
+
+ .
+
+
+ ServerName
+ true
+
+
+ Inch
+ 753a9ad3-917c-4031-85df-7d90218a26d3
+
\ No newline at end of file
diff --git a/samples/features/r-services/SSMS-Custom-Reports/R Services - Resource Usage.rdl b/samples/features/r-services/SSMS-Custom-Reports/R Services - Resource Usage.rdl
new file mode 100644
index 00000000..338d86c9
--- /dev/null
+++ b/samples/features/r-services/SSMS-Custom-Reports/R Services - Resource Usage.rdl
@@ -0,0 +1,1970 @@
+
+
+ This report shows resource usage of R Services.
+ Umachandar Jayachandran
+ 0
+
+
+
+ SQL
+ Data Source=.
+ true
+
+ Integrated
+ f68705bb-df33-493e-b2ea-e8070ba8d88b
+
+
+
+
+
+ SqlConnection
+ /*
+ Retrieve OS memory, SQL memory (current usage) & R Processes memory (peak)
+*/
+select physical_memory_kb
+ , committed_kb
+ , (select sum(peak_memory_kb)
+ from sys.dm_resource_governor_external_resource_pools as ep
+ ) as external_pool_peak_memory_kb
+ from sys.dm_os_sys_info;
+
+
+
+ physical_memory_kb
+ System.Int64
+
+
+ committed_kb
+ System.Int64
+
+
+ external_pool_peak_memory_kb
+ System.Int64
+
+
+
+
+
+ SqlConnection
+ /*
+ Get SQL resource pool & external resource pool statistics:
+*/
+select concat('SQL Server - ', p.name) as pool_name, p.total_cpu_usage_ms/60./60. as total_cpu_usage_hours, p.read_io_completed_total, p.write_io_completed_total
+ from sys.dm_resource_governor_resource_pools as p
+ union all
+select concat('External Pool - ', ep.name) as pool_name, ep.total_cpu_user_ms/60./60., ep.read_io_count, ep.write_io_count
+ from sys.dm_resource_governor_external_resource_pools as ep;
+ true
+
+
+
+ pool_name
+ System.String
+
+
+ total_cpu_usage_hours
+ System.Decimal
+
+
+ read_io_completed_total
+ System.Int64
+
+
+ write_io_completed_total
+ System.Int64
+
+
+
+
+
+ SqlConnection
+ /*
+ Retrieve memory configuration of SQL Server & External Resource Pools.
+ If SQL Sever is running with default then max_memory limit is considered as 100% of OS memory
+*/
+select 'SQL Server' as name
+ , case cast(c.value as bigint) when 2147483647 then 100 else (select physical_memory_kb from sys.dm_os_sys_info)/cast(c.value as bigint) end as max_memory_percent
+ from sys.configurations as c
+ where c.name like 'max server memory (MB)'
+ union all
+select concat('External Pool - ', ep.name) as pool_name, ep.max_memory_percent
+ from sys.dm_resource_governor_external_resource_pools as ep;
+ true
+
+
+
+ name
+ System.String
+
+
+ max_memory_percent
+ System.Int64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =Fields!pool_name.Value
+
+
+
+
+ =Fields!pool_name.Value
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =Sum(Fields!total_cpu_usage_hours.Value)
+
+
+
+
+ #VALY
+
+
+
+
+ Output
+
+
+ Bar
+
+
+
+
+
+
+
+
+
+
+ Primary
+ Primary
+
+ Black
+ 0pt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.5
+
+ NaN
+ NaN
+ NaN
+
+
+
+
+
+
+
+ Axis Title
+
+
+
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.5
+
+ NaN
+ Opposite
+ NaN
+ NaN
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.5
+
+ NaN
+ NaN
+ NaN
+
+
+
+
+
+
+
+ Axis Title
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.5
+
+ NaN
+ Opposite
+ NaN
+ NaN
+
+
+
+
+
+
+
+
+
+
+ CPU Usage (Hours)
+
+
+
+ BrightPastel
+
+ #4c68a2
+ #b5dddf
+ #7292cc
+ #89bcc5
+ #c4d5f3
+ #c6c595
+ #87acf3
+ #7b9291
+ #a8c4ec
+ #a49ed4
+
+
+ Emboss
+
+
+
+ No Data Available
+
+
+ pool_statistics
+ 4.43055in
+ 2.93056in
+ 4.25in
+
+ 2pt
+
+ #c6daf8
+ TopBottom
+ #e6eefc
+
+
+
+
+
+
+
+
+ =Fields!name.Value
+
+
+
+
+ =Fields!name.Value
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =Sum(Fields!max_memory_percent.Value)
+
+
+
+
+ #VALY
+
+
+
+
+ Output
+
+
+ Bar
+ Stacked
+
+
+
+
+
+
+
+
+
+
+
+ Max Percent
+
+ Primary
+ Primary
+
+ Black
+ 0pt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.5
+
+ NaN
+ NaN
+ NaN
+
+
+
+
+
+
+
+ Axis Title
+
+
+
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.5
+
+ NaN
+ Opposite
+ NaN
+ NaN
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.5
+
+ NaN
+ NaN
+ NaN
+
+
+
+
+
+
+
+ Axis Title
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.5
+
+ NaN
+ Opposite
+ NaN
+ NaN
+
+
+
+
+
+
+
+
+
+
+ Max Memory Setting (%)
+
+
+
+ BrightPastel
+
+ #4c68a2
+ #b5dddf
+ #7292cc
+ #89bcc5
+ #c4d5f3
+ #c6c595
+ #87acf3
+ #7b9291
+ #a8c4ec
+ #a49ed4
+
+
+ Emboss
+
+
+
+ No Data Available
+
+
+ memory_limits
+ 1.31944in
+ 4.31944in
+ 3in
+ 4.9in
+ 1
+
+ 2pt
+
+ #c6daf8
+ TopBottom
+ #e6eefc
+
+
+
+
+
+
+
+
+ =Fields!pool_name.Value
+
+
+
+
+ =Fields!pool_name.Value
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =Sum(Fields!read_io_completed_total.Value)
+
+
+
+
+ #VALY
+
+
+
+
+ Output
+
+
+ Bar
+
+
+
+
+
+
+
+
+
+
+
+ Reads
+
+ Primary
+ Primary
+
+ Black
+ 0pt
+
+
+
+
+
+
+ =Sum(Fields!write_io_completed_total.Value)
+
+
+
+
+ #VALY
+
+
+
+
+ Output
+
+
+ Bar
+
+
+
+
+
+
+
+
+
+
+
+ Writes
+
+ Primary
+ Primary
+
+ Black
+ 0pt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.5
+
+ NaN
+ NaN
+ NaN
+
+
+
+
+
+
+
+ Axis Title
+
+
+
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.5
+
+ NaN
+ Opposite
+ NaN
+ NaN
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.5
+
+ NaN
+ NaN
+ NaN
+
+
+
+
+
+
+
+ Axis Title
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.5
+
+ NaN
+ Opposite
+ NaN
+ NaN
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Black
+ Black
+
+
+
+
+ IO Statistics (Count)
+
+
+
+ BrightPastel
+
+ #4c68a2
+ #b5dddf
+ #7292cc
+ #89bcc5
+ #c4d5f3
+ #c6c595
+ #87acf3
+ #7b9291
+ #a8c4ec
+ #a49ed4
+
+
+ Emboss
+
+
+
+ No Data Available
+
+
+ pool_statistics
+ 4.43055in
+ 4.31944in
+ 3in
+ 4.9in
+ 2
+
+ 2pt
+
+ #c6daf8
+ TopBottom
+ #e6eefc
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =Sum(Fields!physical_memory_kb.Value)
+
+
+
+ true
+
+ #VALY
+
+
+
+
+ Output
+
+ = "OS (" & Round(Fields!physical_memory_kb.Value/1024) & " MB)"
+
+
+
+ Shape
+ ExplodedPie
+
+
+
+
+
+
+
+
+
+
+ Primary
+ Primary
+
+ Black
+ 0pt
+
+
+
+
+
+
+ =Sum(Fields!committed_kb.Value)
+
+
+
+ true
+
+ #VALY
+
+
+
+
+ Output
+
+ = "SQL Server (" & Round(Fields!committed_kb.Value/1024) & " MB)"
+
+
+
+ Shape
+
+
+
+
+
+
+
+
+
+
+
+
+ PieDrawingStyle
+ Concave
+
+
+ Primary
+ Primary
+
+ Black
+ 0pt
+
+
+
+
+
+
+
+
+
+
+ Axis Title
+
+
+
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.5
+
+ NaN
+ NaN
+ NaN
+
+
+
+
+
+
+
+ Axis Title
+
+
+
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.5
+
+ NaN
+ Opposite
+ NaN
+ NaN
+
+
+
+
+
+
+
+
+
+ Axis Title
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.5
+
+ NaN
+ NaN
+ NaN
+
+
+
+
+
+
+
+ Axis Title
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.5
+
+ NaN
+ Opposite
+ NaN
+ NaN
+
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+ Black
+ Black
+
+
+
+
+ Current Memory Consumption
+
+
+
+ BrightPastel
+
+ #4c68a2
+ #b5dddf
+ #7292cc
+ #89bcc5
+ #c4d5f3
+ #c6c595
+ #87acf3
+ #7b9291
+ #a8c4ec
+ #a49ed4
+
+
+ Emboss
+
+
+
+ No Data Available
+
+
+ sql_memory_usage
+ 1.31944in
+ 3in
+ 4.25in
+ 3
+
+ 2pt
+
+ #c6daf8
+ TopBottom
+ #e6eefc
+
+
+
+ true
+ true
+
+
+
+
+ SQL Server R Services - Resource Usage
+
+
+
+
+
+
+ Title
+ ReportTitle
+ 0.4in
+ 7.98333in
+ 4
+
+
+ LightGrey
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+ 1.65833in
+
+
+
+
+ 0.25in
+
+
+
+
+ true
+ true
+
+
+
+
+ =Round(Sum(Fields!external_pool_peak_memory_kb.Value, "sql_memory_usage")/1024) & " MB"
+
+
+
+
+
+
+ peak_memory_kb
+
+
+ LightGrey
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ sql_memory_usage
+ 1in
+ 2.43333in
+ 0.25in
+ 1.65833in
+ 5
+
+
+
+
+
+ true
+ true
+
+
+
+
+ R Scripts - Peak Memory Usage:
+
+
+
+
+
+
+ Textbox3
+ 0.98833in
+ 0.08in
+ 0.25in
+ 2.28389in
+ 6
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ This report provides detailed data on the resource consumption of R Services with respect to SQL Server. Use this report to adjust external resource pool setting for R scripts.
+
+
+
+
+
+
+ Textbox1
+ 0.46944in
+ 0.375in
+ 7.98333in
+ 7
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ View SQL script
+
+
+
+
+
+
+
+
+
+
+ =".\R Services - Script"
+
+
+ SQL Server R Services - Resource Usage
+
+
+ =DataSets("sql_memory_usage").CommandText & chr(13) & chr(10) & "go" & chr(13) & chr(10) & DataSets("memory_limits").CommandText & chr(13) & chr(10) & "go" & chr(13) & chr(10) & DataSets("pool_statistics").CommandText
+
+
+
+
+
+
+ 0.98833in
+ 8.075in
+ 0.25in
+ 1.05833in
+ 8
+ Click here to view the T-SQL script used to generate the data in the report.
+
+
+ LightGrey
+ Middle
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ 7.55555in
+
+
+
+
+ 9.275in
+
+
+ 0.45in
+ true
+ true
+
+
+ true
+ true
+
+
+
+
+ =Globals!ExecutionTime
+
+
+
+
+
+
+ ExecutionTime
+ 0.2in
+ 7.13333in
+ 0.25in
+ 2in
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 1in
+ 1in
+ 1in
+ 1in
+
+
+
+
+
+
+ String
+
+
+ .
+
+
+ ServerName
+ true
+
+
+ Inch
+ 2d6f122f-88fc-4fb4-9573-33bf83616a77
+
\ No newline at end of file
diff --git a/samples/features/r-services/SSMS-Custom-Reports/R Services - Script.rdl b/samples/features/r-services/SSMS-Custom-Reports/R Services - Script.rdl
new file mode 100644
index 00000000..6646dd22
--- /dev/null
+++ b/samples/features/r-services/SSMS-Custom-Reports/R Services - Script.rdl
@@ -0,0 +1,245 @@
+
+
+ 0
+
+
+
+ SQL
+ Data Source=.
+ true
+
+ Integrated
+ f68705bb-df33-493e-b2ea-e8070ba8d88b
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ SQL Server R Services - T-SQL Script
+
+
+
+
+
+
+ Title
+ ReportTitle
+ 0.4in
+ 6in
+
+
+ LightGrey
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ This is the T-SQL script for generating the data in report:
+
+
+
+
+
+
+ Textbox1
+ 0.46944in
+ 0.03in
+ 0.25in
+ 3.50333in
+ 1
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ =Parameters!SQLR_Script.Value
+
+
+
+
+
+
+ 0.80556in
+ 0.03in
+ 0.25in
+ 8.95333in
+ 2
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ =Parameters!SQLR_ReportName.Value
+
+
+
+
+
+
+ Textbox1
+ 0.46944in
+ 3.56111in
+ 0.25in
+ 5.42222in
+ 3
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ 1.125in
+
+
+
+
+ 9.01667in
+
+
+ 0.45in
+ true
+ true
+
+
+ true
+ true
+
+
+
+
+ =Globals!ExecutionTime
+
+
+
+
+
+
+ ExecutionTime
+ 0.2in
+ 6.98333in
+ 0.25in
+ 2in
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 1in
+ 1in
+ 1in
+ 1in
+
+
+
+
+
+
+ String
+
+
+ .
+
+
+ ServerName
+ true
+
+
+ String
+
+
+ No Report
+
+
+ true
+ SQLR_ReportName
+ true
+
+
+ String
+
+
+ -- SQL Script
+
+
+ SQLR_Script
+ true
+
+
+ Inch
+ 2d6f122f-88fc-4fb4-9573-33bf83616a77
+
\ No newline at end of file
diff --git a/samples/features/r-services/SSMS-Custom-Reports/README.md b/samples/features/r-services/SSMS-Custom-Reports/README.md
new file mode 100644
index 00000000..ac0cb62d
--- /dev/null
+++ b/samples/features/r-services/SSMS-Custom-Reports/README.md
@@ -0,0 +1,87 @@
+# SSMS Custom Reports
+
+This sample provides custom reports for SQL Server R Services that can be viewed from SQL Server Management Studio. The reports can be used to view configuration information, resource usage, execution statistics, active sessions and other information about R Services.
+
+### Contents
+
+[About this sample](#about-this-sample)
+[Before you begin](#before-you-begin)
+[Run this sample](#run-this-sample)
+[Sample details](#sample-details)
+[Related links](#related-links)
+
+
+
+
+## About this sample
+
+
+- **Applies to:** SQL Server 2016 (or higher)
+- **Key features:**
+- **Workload:** SQL Server R Services
+- **Programming Language:** T-SQL, R
+- **Authors:** Umachandar Jayachandran
+- **Update history:** Custom reports for R Services to show configuration, resource usage & model management.
+
+
+
+## Before you begin
+
+To run this sample, you need the following prerequisites.
+
+**Software prerequisites:**
+
+
+1. SQL Server 2016 (or higher) with R Services installed
+2. SQL Server Management Studio
+
+
+
+## Run this sample
+Installation instructions for R Services can be found [here](https://msdn.microsoft.com/en-us/library/mt696069.aspx).
+
+To use custom reports from SQL Server Management Studio, follow the instructions from "[Add a custom report to Management Studio](https://msdn.microsoft.com/en-us/library/bb153687.aspx)" topic in SQL Server Books Online.
+
+
+
+## Sample details
+
+Custom reports for R Services allow you to perform the following tasks from Object Explorer in SQL Server Management Studio. Add the reports to the server name in Object Explorer.
+
+1. Configuration of R Services feature after Installation
+2. View list of R packages installed on the SQL Server instance
+3. View resource usage of R scripts and resource governance settings
+4. View list of extended events for R Services
+5. View execution statistics for R scripts
+6. View sessions that are currently executing R scripts
+
+### R Services - Configuration.rdl
+
+This report can be used to view the installation settings of R Services and properties of the R runtime. You can also use this report to configure R Services after installation.
+
+### R Services - Packages.rdl
+
+This report lists the R packages installed on the SQL Server instance and properties like version, name.
+
+### R Services - Resource Usage.rdl
+
+This report can be used to view the CPU, Memory, IO consumption of SQL Server & R scripts execution. You can also view the memory setting of external resource pools.
+
+### R Services - Extended Events.rdl
+
+This report can be used to view the extended events that are available to get more insights into R scripts execution.
+
+### R Services - Execution Statistics.rdl
+
+This report can be used to view the execution statistics of R services. For example, you can get the total number of R scripts executions, number of parallel executions and frequently used RevoScaleR functions.
+
+
+
+## Related Links
+
+
+For additional content, see these articles:
+
+[SQL Server R Services - Upgrade and Installation FAQ](https://msdn.microsoft.com/en-us/library/mt653951.aspx)
+
+[SQL Server R Services Tutorials](https://msdn.microsoft.com/en-us/library/mt591993.aspx)
\ No newline at end of file