Skip to content

[Bug]: OpenMetrics: nextcloud_files does not include team folders #4986

Description

@ffried

⚠️ This issue respects the following points: ⚠️

Bug description

We're running an Otel-collector alongside nextcloud that regularly scrapes the /metrics endpoint (forwarding it to our Grafana Mimir (Prometheus) instance).
When creating queries against nextcloud_files, I noticed that the sum is way below the amount of files we're actually having. After a bit of investigation, it seems that nextcloud_files is only counting user files. Most of our files are shared in team folders. So all these files are missing in the count.

Steps to reproduce

  1. Install and configure NextCloud (including OpenMetrics)
  2. Setup Team Folders
  3. Add files in regular user folders as well as Team Folders
  4. Query /metrics (either manually or via Prometheus)
  5. Notice that the sum of files is equal to the amount of files in user folders.

Expected behavior

The sum of files is equal to all files present on the NextCloud instance, irrespective of whether they are stored in user's home folders or Team Folders.

Nextcloud Server version

34

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.5

Web server

Apache (supported)

Database engine version

PostgreSQL

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "version": "34.0.2.1",
        "installed": true,
        "maintenance": false,
        "logtimezone": "UTC",
        "loglevel": 2,
        "htaccess.RewriteBase": "\/",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "overwritehost": "<CENSORED>",
        "overwriteprotocol": "https",
        "overwrite.cli.url": "<CENSORED>",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "forwarded_for_headers": [
            "HTTP_X_FORWARDED_FOR"
        ],
        "mail_smtpmode": "smtp",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpsecure": "tls",
        "mail_smtpauth": true,
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "upgrade.disable-web": true,
        "dbtype": "pgsql",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "<CENSORED>"
        ],
        "lost_password_link": "<CENSORED>",
        "default_phone_region": "DE",
        "trashbin_retention_obligation": "auto, 30",
        "maintenance_window_start": "19",
        "tempdirectory": "\/tmp\/nextcloud",
        "serverid": "21",
        "openmetrics_allowed_clients": [
            "127.0.0.1\/8",
            "::1\/128",
            "172.16.0.0\/12"
        ],
        "data-fingerprint": "904e15d491c59d30b8ca705fa475c124",
        "TEMP_DIRECTORY": "\/tmp\/nextcloud",
        "SERVER_ID": "21"
    }
}

List of activated Apps

Enabled:
  - activity: 7.0.0
  - admin_audit: 1.24.0
  - appstore: 1.0.0
  - bruteforcesettings: 7.0.0
  - circles: 34.0.0
  - cloud_federation_api: 1.18.0
  - comments: 1.24.0
  - contactsinteraction: 1.15.0
  - dashboard: 7.14.0
  - dav: 1.39.0
  - external: 9.0.1
  - federatedfilesharing: 1.24.0
  - federation: 1.24.0
  - files: 2.6.0
  - files_downloadlimit: 5.2.0
  - files_lock: 34.0.1
  - files_pdfviewer: 7.0.0-dev.0
  - files_reminders: 1.7.0
  - files_sharing: 1.26.0
  - files_trashbin: 1.24.0
  - files_versions: 1.27.0
  - firstrunwizard: 7.0.0-dev.0
  - groupfolders: 22.0.6
  - logreader: 7.0.0
  - lookup_server_connector: 1.22.0
  - nextcloud_announcements: 6.0.0
  - notifications: 7.0.0-dev.1
  - notify_push: 1.3.5
  - oauth2: 1.22.0
  - office: 1.0.0
  - photos: 7.0.0
  - privacy: 6.0.0-dev.1
  - profile: 1.3.0
  - provisioning_api: 1.24.0
  - recommendations: 7.0.0
  - related_resources: 5.0.0-dev.0
  - serverinfo: 6.0.0
  - settings: 1.17.0
  - sharebymail: 1.24.0
  - support: 6.0.0
  - systemtags: 1.24.0
  - text: 8.0.0
  - theming: 2.9.0
  - twofactor_backupcodes: 1.23.0
  - updatenotification: 1.24.0
  - user_saml: 8.2.0
  - user_status: 1.14.0
  - viewer: 7.0.0-dev.0
  - weather_status: 1.14.0
  - webhook_listeners: 1.6.0
  - workflowengine: 2.16.0
Disabled:
  - app_api: 34.0.0 (installed 32.0.0)
  - calendar: 6.5.2 (installed 6.5.2)
  - encryption: 2.22.0
  - files_accesscontrol: 5.0.0 (installed 5.0.0)
  - files_external: 1.26.0
  - files_rightclick: 0.15.1 (installed 1.6.0)
  - password_policy: 6.0.0-dev.0 (installed 1.15.0)
  - socialsharing_email: 4.1.0 (installed 4.1.0)
  - survey_client: 6.0.0-dev.0 (installed 4.0.0)
  - suspicious_login: 12.0.0-dev.0
  - twofactor_nextcloud_notification: 8.0.0
  - twofactor_totp: 16.0.0 (installed 15.0.0)
  - user_ldap: 1.25.0 (installed 1.10.2)
  - workflow_script: 5.0.0 (installed 5.0.0)

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

[No relevant logs were generated.]

Additional info

Note that the number of files can also be compared to what NextCloud shows in Admin Settings -> System (/settings/admin/serverinfo).
In our case, the page reports a total of files of 237986 while the metric yields a sum of 46802.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status
    To triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions