Enabling Metrics
Metrics must be enabled in your configuration:Configuration Options
FEATURES_METRICS- Enable/disable metrics collectionFEATURES_METRICS_ADMIN_ONLY- Restrict metrics access to administrators onlyFEATURES_METRICS_SHOW_USER_SPECIFIC- Show per-user statistics in metrics
Retrieving Metrics
Fetch metrics data via the API:Query Parameters
from- Start date (ISO 8601 format)to- End date (ISO 8601 format)all- Retrieve all metrics regardless of date range
Date Range Examples
Last 7 days (default):Metric Data Structure
Each metric snapshot contains:Metric Fields
System-Wide Metrics
users- Total number of usersfiles- Total number of files uploadedfileViews- Total file view counturls- Total number of shortened URLsurlViews- Total URL view countstorage- Total storage used in bytes
Per-User File Statistics
filesUsers array contains:
username- Username (null if anonymized)sum- Number of files uploadedstorage- Storage used in bytesviews- Total views on user’s files
Per-User URL Statistics
urlsUsers array contains:
username- Username (null if anonymized)sum- Number of URLs createdviews- Total views on user’s URLs
File Type Distribution
types array contains:
type- MIME typesum- Number of files of this type
Access Control
Metrics access is controlled by configuration and user role:Date Validation
When querying metrics with date ranges:fromdate must be beforetodatefromdate must be in the past- Invalid date formats return an error
- Default range is the last 7 days
Date validation is skipped when using
all=true to retrieve all metrics.Metric Collection
Metrics are automatically collected at regular intervals and stored in the database. Each snapshot represents the state of your Zipline instance at that point in time.Storage Format
Metrics are stored with:- Unique ID
- Creation timestamp
- Update timestamp
- JSON data object containing all statistics
Analyzing Metrics
Track Growth Over Time
Query metrics across different time periods to analyze trends:Identify Top Users
WhenFEATURES_METRICS_SHOW_USER_SPECIFIC is enabled, use filesUsers and urlsUsers arrays to identify:
- Highest storage consumers
- Most active uploaders
- Users with most views
- Top URL creators
Monitor File Types
Analyze thetypes array to understand:
- Most common file types
- Storage distribution by MIME type
- Content patterns
Exporting Metrics
Metrics are included in server exports by default. To export without metrics:Metrics in Backups
When creating backups:- All metric snapshots are included by default
- Metrics count is reported in export metadata
- Historical metrics are preserved during import
Export Counts
Get a count of all data including metrics:Privacy Considerations
Performance Considerations
- Metrics are ordered by creation date (descending)
- Large date ranges may return significant data
- Consider pagination or limiting queries for better performance
- Metrics collection has minimal impact on upload/access performance
Troubleshooting
”metrics are disabled” Error
EnsureFEATURES_METRICS=true in your configuration.
”admin only” Error
Metrics are restricted to administrators. Either:- Log in as an administrator
- Set
FEATURES_METRICS_ADMIN_ONLY=falseto allow all users access
Empty User Data
IffilesUsers and urlsUsers are empty, check that FEATURES_METRICS_SHOW_USER_SPECIFIC=true.