Hello!
You are correct that rsconnect::showMetrics returns the mean. Metrics are collected once per minute per application instance. The calculation is the sum of the metric (such as connect_count) over the number of points collected for the interval. This is the default behavior and unfortunately there is currently no parameter to change it.
However if you would like to know how many instances were running each minute for an application I think you should be able to calculate this using the data returned by rsconnect::showUsage. Application usage metrics count the number of instances running each minute and express this as instance hours. So to reverse the calculation and get instances per minute you can multiply each value of the hours column in that dataframe by 60 and round to the nearest integer. Here's an example:
df <- rsconnect::showUsage(account = 'ming', appName = 'myApp', usageType = 'hours', from = '1h', interval = '1m')
timestamp hours
1 1543592160 0.00
2 1543592220 0.02
3 1543592280 0.03
df$instances <- (round(df$hours * 60))
timestamp hours instances
1 1543592160 0.00 0
2 1543592220 0.02 1
3 1543592280 0.03 2
I will make a note about investigating improving the metrics API but I suspect that will not make it onto our roadmap for quite a while so I hope this workaround helps in the meantime.
Ming