Skip to content

Support setting metrics_collection_enabled during deployment #4201

Description

@brooklynbagel

Summary

When deploying content to Posit Connect via Publisher, there is currently no way to configure metrics_collection_enabled for the content item. This means users must manually enable resource metrics collection after deployment via the Connect Dashboard or API.

Problem

Connect supports per-content resource metrics (CPU, memory, connection counts) via the metrics_collection_enabled field on content items. This can be set at creation time via POST /v1/content or updated afterward via PATCH /v1/content/{guid}. However, Publisher's configuration files (in .posit/publish/) don't expose this setting, so users deploying via Publisher cannot enable metrics collection as part of their deployment workflow.

Proposed Solution

Add support for a configuration option (e.g., in the .posit/publish/*.toml configuration file) that maps to the metrics_collection_enabled field in the Connect API. When deploying, Publisher would include this field in the content creation/update API call.

Example configuration:

[connect.runtime]
metrics_collection_enabled = true

Workarounds

  • Set Applications.MetricsCollectionEnabled = true server-wide in rstudio-connect.gcfg
  • Manually call PATCH /v1/content/{guid} after deployment
  • Use the Connect Dashboard to enable metrics after deployment

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    communityIssues with external community involvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions