fix(plugins): don't recording metrics for not implemented plugin calls
Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
@@ -73,7 +73,8 @@ func callPluginFunction[I any, O any](ctx context.Context, plugin *plugin, funcN
|
|||||||
if exit != 0 {
|
if exit != 0 {
|
||||||
if exit == notImplementedCode {
|
if exit == notImplementedCode {
|
||||||
log.Trace(ctx, "Plugin function not implemented", "plugin", plugin.name, "function", funcName, "pluginDuration", elapsed, "navidromeDuration", startCall.Sub(start))
|
log.Trace(ctx, "Plugin function not implemented", "plugin", plugin.name, "function", funcName, "pluginDuration", elapsed, "navidromeDuration", startCall.Sub(start))
|
||||||
plugin.metrics.RecordPluginRequest(ctx, plugin.name, funcName, true, elapsed.Milliseconds())
|
// TODO Should we record metrics for not implemented calls?
|
||||||
|
//plugin.metrics.RecordPluginRequest(ctx, plugin.name, funcName, true, elapsed.Milliseconds())
|
||||||
return result, fmt.Errorf("%w: %s", errNotImplemented, funcName)
|
return result, fmt.Errorf("%w: %s", errNotImplemented, funcName)
|
||||||
}
|
}
|
||||||
plugin.metrics.RecordPluginRequest(ctx, plugin.name, funcName, false, elapsed.Milliseconds())
|
plugin.metrics.RecordPluginRequest(ctx, plugin.name, funcName, false, elapsed.Milliseconds())
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ var _ = Describe("callPluginFunction metrics", Ordered, func() {
|
|||||||
Expect(calls[0].ok).To(BeFalse())
|
Expect(calls[0].ok).To(BeFalse())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("records metrics for not-implemented functions", func() {
|
It("does not record metrics for not-implemented functions", func() {
|
||||||
// Use partial metadata agent that doesn't implement GetArtistMBID
|
// Use partial metadata agent that doesn't implement GetArtistMBID
|
||||||
partialRecorder := &mockMetricsRecorder{}
|
partialRecorder := &mockMetricsRecorder{}
|
||||||
partialManager, _ := createTestManagerWithPluginsAndMetrics(
|
partialManager, _ := createTestManagerWithPluginsAndMetrics(
|
||||||
@@ -123,9 +123,6 @@ var _ = Describe("callPluginFunction metrics", Ordered, func() {
|
|||||||
Expect(err).To(MatchError(errNotImplemented))
|
Expect(err).To(MatchError(errNotImplemented))
|
||||||
|
|
||||||
calls := partialRecorder.getCalls()
|
calls := partialRecorder.getCalls()
|
||||||
Expect(calls).To(HaveLen(1))
|
Expect(calls).To(HaveLen(0))
|
||||||
Expect(calls[0].plugin).To(Equal("partial-metadata-agent"))
|
|
||||||
Expect(calls[0].method).To(Equal(FuncGetArtistMBID))
|
|
||||||
Expect(calls[0].ok).To(BeTrue())
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user