Interface MetricsConfigManager


  • public interface MetricsConfigManager
    Provides information about whether a server has granted permission for server metric data to be transmitted on a per plugin basis.

    This manager may be injected into plugin classes.

    • Method Detail

      • globalCollectionState

        Tristate globalCollectionState()
        Gets the current global state of collection. The collection state determines how data collection should be handled.

        Global state determines how an undefined state for a specific plugin should be handled. If a plugin has a state specified then it will override the global state.

        Data Collection States
        State Data Collection Permitted Comment
        TRUE Allowed Server administrator enabled metrics globally.
        FALSE Disallowed (explicitly) Server administrator disabled metrics globally.
        UNDEFINED (default) Disallowed (implicitly) The server administrator has made no specific global choice on allowing plugins to perform data collection, and defaults to disallowed.

        The value returned from this should not be stored. As the configuration/permission can be updated at any time, it is best to check this each time server metric collection is due to occur.

        Returns:
        The global state of collection
      • collectionState

        Tristate collectionState​(org.spongepowered.plugin.PluginContainer container)
        Gets the current state of collection for the specified plugin. The collection state determines how data collection should be handled.

        The plugin collection state acts as an override of the global state, taking precedence when establishing whether a plugin is allowed to perform data collection.

        Data Collection States
        State Data Collection Permitted Comment
        TRUE Allowed Server administrator enabled metrics for the plugin specifically.
        FALSE Disallowed Server administrator disabled metrics for the plugin specifically.
        UNDEFINED (default) Refer to the global state The server administrator has made no specific choice for this plugin, and the global state should be used.

        The value returned from this should not be stored. As the configuration/permission can be updated at any time, it is best to check this each time server metric collection is due to occur.

        Plugin authors may wish to seek permission to perform data collection, noting that a false state is explicitly set by the server administrator, plugins should only seek permission when both the plugin and global states are undefined.

        Parameters:
        container - The PluginContainer
        Returns:
        The current collection state
      • effectiveCollectionState

        default Tristate effectiveCollectionState​(org.spongepowered.plugin.PluginContainer container)
        Gets the current effective state of collection for the specified plugin. The collection state determines how data collection should be handled.

        The effective collection state for a plugin falls back to the global collection state if the server administrator has not made an explicit decision for the plugin.

        Data Collection States
        State Data Collection Permitted Comment
        TRUE Allowed Server administrator enabled metrics either globally (if the plugin was undefined) or for the plugin.
        FALSE Disallowed (explicitly) Server administrator disabled metrics either globally (if the plugin was undefined) or for the plugin.
        UNDEFINED (default) Disallowed (implicitly) The server administrator has made no specific choice either globally or for the plugin.

        The value returned from this should not be stored. As the configuration/permission can be updated at any time, it is best to check this each time server metric collection is due to occur.

        Plugin authors may wish to seek permission to perform data collection, noting that a false state is explicitly set by the server administrator, we ask that permission is only sought if a undefined state is present. In doing this, server administrators are not asked for consent for something that have explicitly denied.

        Parameters:
        container - The PluginContainer
        Returns:
        The current collection state