mirror of
https://github.com/navidrome/navidrome.git
synced 2025-07-14 07:31:28 +03:00
* Add prometheus metrics to subsonic and plugins * address feedback, do not log error if operation is not supported * add missing timestamp and client to stats * remove .view from subsonic route * directly inject DataStore in Prometheus, to avoid having to pass it in every call Signed-off-by: Deluan <deluan@navidrome.org> --------- Signed-off-by: Deluan <deluan@navidrome.org> Co-authored-by: Deluan <deluan@navidrome.org>
36 lines
1.1 KiB
Go
36 lines
1.1 KiB
Go
package plugins
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/navidrome/navidrome/log"
|
|
"github.com/navidrome/navidrome/plugins/api"
|
|
"github.com/tetratelabs/wazero"
|
|
)
|
|
|
|
// newWasmWebSocketCallback creates a new adapter for a WebSocketCallback plugin
|
|
func newWasmWebSocketCallback(wasmPath, pluginID string, m *Manager, runtime api.WazeroNewRuntime, mc wazero.ModuleConfig) WasmPlugin {
|
|
loader, err := api.NewWebSocketCallbackPlugin(context.Background(), api.WazeroRuntime(runtime), api.WazeroModuleConfig(mc))
|
|
if err != nil {
|
|
log.Error("Error creating WebSocket callback plugin", "plugin", pluginID, "path", wasmPath, err)
|
|
return nil
|
|
}
|
|
return &wasmWebSocketCallback{
|
|
wasmBasePlugin: newWasmBasePlugin[api.WebSocketCallback, *api.WebSocketCallbackPlugin](
|
|
wasmPath,
|
|
pluginID,
|
|
CapabilityWebSocketCallback,
|
|
m.metrics,
|
|
loader,
|
|
func(ctx context.Context, l *api.WebSocketCallbackPlugin, path string) (api.WebSocketCallback, error) {
|
|
return l.Load(ctx, path)
|
|
},
|
|
),
|
|
}
|
|
}
|
|
|
|
// wasmWebSocketCallback adapts a WebSocketCallback plugin
|
|
type wasmWebSocketCallback struct {
|
|
*wasmBasePlugin[api.WebSocketCallback, *api.WebSocketCallbackPlugin]
|
|
}
|