Skip to content

feat: enhance insights collection with plugin awareness and expanded metrics #4391

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

Merged
merged 6 commits into from
Jul 28, 2025

Conversation

deluan
Copy link
Member

@deluan deluan commented Jul 28, 2025

Description

This update improves the insights data that Navidrome collects to better understand how the software is being used. The changes help the project maintainers make better decisions about future development.

What Changed

  • Plugin tracking: Now reports which plugins you have installed (plugin names only, no personal data)
  • Better feature detection: More accurately detects if you're using LastFM, Spotify, or Deezer integrations
  • Additional metrics: Tracks smart playlists, reverse proxy usage, custom tags, and library count
  • Privacy maintained: No personal or sensitive data is collected - only anonymous usage statistics

Related Issues

N/A - Proactive improvement to insights collection

Type of Change

  • New feature
  • Bug fix
  • Documentation update
  • Refactor
  • Other (please describe):

Checklist

Please review and check all that apply:

  • My code follows the project's coding style
  • I have tested the changes locally
  • I have added or updated documentation as needed
  • I have added tests that prove my fix/feature works (or explain why not)
  • All existing and new tests pass

How to Test

  1. Enable insights in your configuration (if not already enabled)
  2. Install plugins and verify they appear in insights data
  3. Configure external services (LastFM, Spotify, Deezer) to test detection
  4. Create smart playlists to verify detection
  5. Check that insights data includes new metrics

For Users

This change doesn't affect how Navidrome works - it only improves the anonymous data sent to help development. You can still disable insights collection completely if you prefer. No personal information, file names, or sensitive data is collected.

deluan added 3 commits July 28, 2025 10:37
Signed-off-by: Deluan <deluan@navidrome.org>
…metrics

Enhanced the insights collection system to provide more comprehensive telemetry data about Navidrome installations. This update adds plugin awareness through dependency injection integration, expands configuration detection capabilities, and includes additional library metrics.

Key improvements include:
- Added PluginLoader interface integration to collect plugin information when enabled
- Enhanced configuration detection with proper credential validation for LastFM, Spotify, and Deezer
- Added new library metrics including Libraries count and smart playlist detection
- Expanded configuration insights with reverse proxy, custom PID, and custom tags detection
- Updated Wire dependency injection to support the new plugin loader requirement
- Added corresponding data structures for plugin information collection

This enhancement provides valuable insights into feature usage patterns and plugin adoption while maintaining privacy and following existing telemetry practices.
Fixed type mismatch in test where PluginManifestCapabilitiesElem was being
compared with string literal. The test now properly casts the string to the
correct enum type for comparison.
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @deluan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances Navidrome's insights collection system by adding comprehensive telemetry data. It introduces plugin awareness, expands the detection of various configuration settings, and includes additional library-related metrics, all aimed at providing a more complete picture of Navidrome installations and feature usage while maintaining privacy-first principles.

Highlights

  • Plugin Awareness: The insights collection system now integrates with the PluginLoader interface to gather information about enabled plugins, providing valuable data on plugin adoption and usage.
  • Enhanced Configuration Detection: Improved detection for external service configurations, specifically for LastFM, Spotify, and Deezer, by validating the presence of necessary credentials rather than just enablement flags. This provides more accurate insights into actual service integration.
  • Expanded Library Metrics: New metrics have been added to track the total count of libraries configured in Navidrome and to detect the presence of smart playlists, offering deeper insights into content organization.
  • Additional Configuration Insights: The system now collects insights on whether a reverse proxy is configured, if custom PID (Per-Item Display) settings are in use, and if custom tags have been defined, helping to understand advanced server configurations.
  • Dependency Injection Update: The wire dependency injection setup has been updated to correctly provide the PluginManager to the insights collection module, facilitating the new plugin awareness feature and ensuring proper component wiring.
  • Data Structure Enhancements: New data structures have been introduced or updated to accommodate the expanded metrics, including fields for plugin information, library counts, and various new configuration flags, ensuring all new telemetry data can be properly stored and transmitted.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the insights collection by adding plugin information and several new metrics for configuration and library statistics. The changes are well-structured, introducing a PluginLoader interface for dependency injection and expanding the data model for insights.

Moved HasCustomTags, ReverseProxyConfigured, and HasCustomPID configuration checks from the dynamic collect() function to the static staticData() function where they belong. This eliminates redundant computation on every insights collection cycle and implements the actual logic for HasCustomTags instead of the hardcoded false value.

The HasCustomTags field now properly detects if custom tags are configured by checking the length of conf.Server.Tags. This change improves performance by computing static configuration values only once rather than on every insights collection.
Added DevEnablePluginsInsights configuration option to allow fine-grained control over whether plugin information is collected as part of the insights data. This change enhances privacy controls by allowing users to opt-out of plugin reporting while still participating in general insights collection.

The implementation includes:
- New configuration option DevEnablePluginsInsights with default value true
- Gated plugin collection in insights.go based on both plugin enablement and permission flag
- Enhanced plugin information to include version data alongside name
- Improved code organization with clearer conditional logic for data collection
@deluan deluan marked this pull request as ready for review July 28, 2025 16:50
@Copilot Copilot AI review requested due to automatic review settings July 28, 2025 16:50
@deluan
Copy link
Member Author

deluan commented Jul 28, 2025

/gemini review

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the insights collection system in Navidrome to gather more comprehensive anonymous usage statistics that help inform development decisions. The changes expand the metrics collected while maintaining user privacy by only tracking anonymous usage patterns.

  • Adds plugin awareness to track installed plugins (names and versions only)
  • Improves external service detection for LastFM, Spotify, and Deezer integrations
  • Expands metrics to include smart playlists, reverse proxy usage, custom tags, and library count

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
core/metrics/insights/data.go Adds new data structures for plugin info and expanded metrics fields
core/metrics/insights.go Implements plugin collection logic and enhanced service detection
plugins/manager.go Adds PluginList method and renames mutex for consistency
plugins/manager_test.go Updates tests for mutex rename and adds plugin list validation
conf/configuration.go Adds configuration option to control plugin insights collection
cmd/wire_injectors.go Adds dependency injection binding for plugin loader
cmd/wire_gen.go Updates generated wire code with new dependencies
Comments suppressed due to low confidence (1)

plugins/manager.go:101

  • [nitpick] The field name 'pluginsMu' is inconsistent with Go naming conventions. Consider using 'mu' or 'pluginsMutex' to be more explicit about its purpose.
	pluginsMu        sync.RWMutex                   // Protects plugins map

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the insights collection by adding tracking for installed plugins and several new metrics like smart playlist usage, reverse proxy configuration, and library count. The changes are well-implemented, with dependency injection used effectively to decouple the metrics and plugins packages. The logic for detecting external service integrations has also been improved for better accuracy. The code is clean and the addition of a new test for the plugin listing functionality is appreciated. I've found one minor issue regarding parameter name consistency. Overall, a great contribution to improving project insights.

@deluan deluan merged commit 9dbe0c1 into master Jul 28, 2025
35 checks passed
@deluan deluan deleted the additional-insights branch July 28, 2025 17:21
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.

1 participant