Skip to content

Connect User Metrics #181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

jakubnowicki
Copy link

@jakubnowicki jakubnowicki commented Jun 17, 2025

Dashboard for presenting the adoption data for the content deployed on Posit Connect, created by Appsilon.

Standalone repository: https://github.com/Appsilon/ConnectUserMetrics

image

@dotNomad dotNomad self-requested a review June 17, 2025 16:20
Copy link
Collaborator

@dotNomad dotNomad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Howdy @jakubnowicki 👋

Thanks for submitting this PR to contribute to the Connect Gallery! I'm still working through this PR to give it a full review, but I figured I'd post my in progress comments and questions so we could start some back and forth while I work through it.

@@ -0,0 +1,55 @@
# Connect Insights Dashboard
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great README. I noticed you included a short description in the manifest.json, but it could be helpful to add a description here as well. Perhaps one even longer that gives an indication of what functionality to expect.

Additionally I see the "Connect Insights Dashboard" naming here, but the directory and manifest.json use "Connect User Metrics" I was curious about the difference in naming.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent idea! I will copy the content of the in-app "help button" here, so we have a better description of what the app really does.

About the naming convention: you are right, we will stick to "Connect User Metrics".

Confirm with your Posit Connect admin that instrumentation is enabled.

<!-- Links -->
[User Guide Vars]: https://docs.posit.com/connect/user/content-settings/#content-vars
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there is a typo here.

Suggested change
[User Guide Vars]: https://docs.posit.com/connect/user/content-settings/#content-vars
[User Guide Vars]: https://docs.posit.co/connect/user/content-settings/#content-vars

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed there are some features not included in the README that are in the Appsilon/ConnectUsersMetrics repo README. That totally makes sense given how the READMEs will be consumed for Gallery content.

It makes me wonder if there should be a CONTRIBUTING guide here that includes some of those details so this file, for example, is a bit easier to understand.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This app here is a simplified version of the origina Connect User Metrics; some of the features only make sense in the complete app, where the user is able to modify some configuration files.

I will add a CONTRIBUTE file pointing to the original branch.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the js file is empty other than this one file. Is there a reason to keep it around that I'm missing?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right! These files (together with Cypress testing) are automatically generated Rhino, the framework we used to make this app. I will delete it for the sake of simplicity.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the Cypress tests aren't used here and there isn't a package.json to setup Cypress with npm. Can we remove the Cypress config and this empty test file?

When Cypress tests are added in the future we can get them added back :)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Same answer as above; I will delete the file).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this is being generated from main.scss. but I'm curious how this is being generated. I don't see anything mentioned in the README here or over in https://github.com/Appsilon/ConnectUserMetrics

Forgive me this may be some of my own unfamiliarity with styling Shiny apps.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The minified CSS is generated by running rhino::build_sass(); it is a common practice when using Rhino, but we probably can make that more clear in the main repository of Connect User Metrics.

@vituri
Copy link

vituri commented Jun 24, 2025

Hey, @dotNomad , thank for the quick review! Jakub is on vacation right now, so I will try to answer some of your comments. I made a PR-to-this-branch fixing the issues you pointed. As soon as Marcin approves it, we can make a new round of reviews.

Copy changes from main-connect-extension
Copy link
Collaborator

@toph-allen toph-allen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This generally looks really cool, and thank you for submitting the PR! Not quite ready to approve yet. I have a few small comments in this review — not all are direct things that need to be changed, but a few are.

I'll sum a few things up here:

  • The file list in the manifest references at least one file that doesn't exist (app/js/index.js), so I couldn't test out the deploy as specified to a Connect server.
  • dependencies.R isn't needed any more (thanks @jonkeane for pointing that out).

Other things that I'll dig into more next week:

  • Running the app locally on my computer (with CONNECT_SERVER and CONNECT_API_KEY defined), I was unable to get the app to display data correctly. Like I said, I'll dig into this more at the start of next week to see if I can diagnose the issue.
  • I had trouble getting renv::restore() to run correctly. Some versions of certain packages recorded in renv.lock try to install from source from the Public Package Manager server, which results in compiler failures. I was able to get packages to install correctly with renv::install().

Again, thanks for submitting this, and looking forward to getting it in the Gallery!

Comment on lines +67 to +74
get_usage_from_client <- function(client, from = NULL, to = NULL, guids = NULL) {
usage <- get_usage_shiny(
client,
limit = Inf, content_guid = guids, from = from, to = to
)

usage
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a forthcoming get_usage() function in connectapi which will return usage from a newer endpoint which returns data in a slightly different format. Although the newer endpoint doesn't accept a guids argument, and so returns all hits between the provided dates, it isn't paginated, so it's almost always faster than the older usage endpoints.

This isn't an actionable change now, but it should be merged and released soon. (There is some code in the Usage Metrics Dashboard gallery app that calls this endpoint.

@@ -0,0 +1,24 @@
# This file allows packrat (used by rsconnect during deployment) to pick up dependencies.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rsconnect / packrat leverage renv for dependency detection now, so they pick up on box imports, so this file isn't needed.

Comment on lines 2733 to 5458
"Version": "0.9-40",
"Date": "2022-03-21",
"Authors@R": "c(person(given = \"Torsten\", family = \"Hothorn\", role = \"aut\", email = \"[email protected]\",\n comment = c(ORCID = \"0000-0001-8301-0471\")),\n person(given = \"Achim\", family = \"Zeileis\", role = c(\"aut\", \"cre\"), email = \"[email protected]\",\n comment = c(ORCID = \"0000-0003-0918-3766\")),\n person(given = c(\"Richard\", \"W.\"), family = \"Farebrother\", role = \"aut\", comment = \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file isn't present in the repo, so deployment via the manifest fails.

@toph-allen
Copy link
Collaborator

I wanted to add a bit more detail to my above reports of being unable to load data in the app. @dotNomad and I walked through these steps again today. Here are the steps we took:

  1. Clone this branch.

  2. Run renv::restore().

This failed, running on R 4.5.1 (for reference, the lockfile was generated under R 4.5.0), with a compile error from Matrix 1.7-2. The local R environment was configured to use the Posit Public Package Manager, which matches the lockfile.

  1. Run renv::install() to install detected dependencies.

Attaching the resulting renv.lock in case it's helpful: renv.lock.zip

  1. Ran the app with rhino::app().

We ran the app against two different Connect servers.

Against one server, users and applications appeared as GUIDs. Against another, users and applications show correctly in the filter lists but no data is loaded. We see errors in the browser's console like the following, and no output in the R console.

inputValidateDecorator.ts:16 Uncaught Error: Unexpected input value mode: 'undefined'
    at Oi (inputValidateDecorator.ts:16:13)
    at Ot.setInput (inputValidateDecorator.ts:37:21)
    at Co (bind.ts:42:12)
    at bind.ts:280:11
    at HTMLDivElement.<anonymous> (virtual-select.js:2:123801)
    at HTMLDivElement.dispatch (jquery.js:5145:27)
    at HTMLDivElement.<anonymous> (jquery.js:4949:28)
    at virtual-select.js:2:37123
    at Array.forEach (<anonymous>)
    at virtual-select.js:2:37100
Oi @ inputValidateDecorator.ts:16
setInput @ inputValidateDecorator.ts:37
Co @ bind.ts:42
(anonymous) @ bind.ts:280
(anonymous) @ virtual-select.js:2
dispatch @ jquery.js:5145
(anonymous) @ jquery.js:4949
(anonymous) @ virtual-select.js:2
(anonymous) @ virtual-select.js:2
setTimeout
value @ virtual-select.js:2
value @ virtual-select.js:2
value @ virtual-select.js:2
value @ virtual-select.js:2
receiveMessage @ virtual-select.js:2
(anonymous) @ shinyapp.ts:762
await in (anonymous)
_sendMessagesToHandlers @ shinyapp.ts:697
await in _sendMessagesToHandlers
dispatchMessage @ shinyapp.ts:672
(anonymous) @ shinyapp.ts:256
startActionQueueLoop @ shinyapp.ts:284
await in startActionQueueLoop
(anonymous) @ shinyapp.ts:253

Let us know if there’s something else we should try to get it working.

@toph-allen
Copy link
Collaborator

Hi @jakubnowicki — just wanted to ping you on this to see if there are any updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants