mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-11-10 13:24:05 +08:00
Feature: observability OSS stub (#22168)
This commit is contained in:
1 parent
4ba8d801e9
commit
80f3d4759e
5 files changed
+21
-2
No files matched your search
@@ -0,0 +1,5 @@
|
||||
//go:build !ee
|
||||
|
||||
package observability
|
||||
|
||||
func BeginRetrieval(_ string) func(*error) { return func(*error) {} }
|
||||
@@ -105,6 +105,8 @@ func Run(ctx context.Context, serverName string, args *bootstrap.ServerArgs) err
|
||||
validator := utility.NewScheduledTask("Admin validator", globalConfig.GetHeartbeatInterval(), adminapi.CheckServicePeriodically)
|
||||
validator.Start()
|
||||
defer validator.Stop()
|
||||
stopMetrics := startMetrics(ctx)
|
||||
defer stopMetrics()
|
||||
|
||||
// Start HTTP server in a goroutine
|
||||
go func() {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
//go:build !ee
|
||||
|
||||
package admin
|
||||
|
||||
import "context"
|
||||
|
||||
func startMetrics(context.Context) func() { return func() {} }
|
||||
@@ -25,6 +25,7 @@ import (
|
||||
|
||||
"ragflow/internal/common"
|
||||
"ragflow/internal/entity/models"
|
||||
"ragflow/internal/observability"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
@@ -51,6 +52,7 @@ func RerankByModel(
|
||||
rankFeature map[string]float64,
|
||||
language string,
|
||||
) (sim []float64, tsim []float64, vsim []float64, err error) {
|
||||
defer observability.BeginRetrieval("retrieval_rerank")(&err)
|
||||
if chunks == nil || len(chunks) == 0 {
|
||||
return []float64{}, []float64{}, []float64{}, nil
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import (
|
||||
"ragflow/internal/engine"
|
||||
"ragflow/internal/engine/types"
|
||||
"ragflow/internal/entity/models"
|
||||
"ragflow/internal/observability"
|
||||
"ragflow/internal/tokenizer"
|
||||
|
||||
"go.uber.org/zap"
|
||||
@@ -107,7 +108,8 @@ const (
|
||||
// - Calculate pagination to extract actual page returned from reranked results
|
||||
// - Build chunks
|
||||
// - Build document aggregation if specified
|
||||
func (s *RetrievalService) Retrieval(ctx context.Context, req *RetrievalRequest) (*RetrievalResult, error) {
|
||||
func (s *RetrievalService) Retrieval(ctx context.Context, req *RetrievalRequest) (result *RetrievalResult, err error) {
|
||||
defer observability.BeginRetrieval("retrieval")(&err)
|
||||
common.InfoCtx(ctx, "Retrieval START", zap.String("question", req.Question), zap.Int("page", req.Page), zap.Int("pageSize", req.PageSize))
|
||||
if req.Question == "" {
|
||||
return &RetrievalResult{Chunks: []map[string]interface{}{}, DocAggs: []map[string]interface{}{}, Total: 0}, nil
|
||||
@@ -1020,7 +1022,8 @@ func cloneDenseExpr(source *types.MatchDenseExpr) *types.MatchDenseExpr {
|
||||
}
|
||||
|
||||
// GetVector computes query vector and returns MatchDenseExpr for hybrid search
|
||||
func (s *RetrievalService) GetVector(ctx context.Context, txt string, embModel *models.EmbeddingModel, knnTopK, numCandidates int, similarity float64) (*types.MatchDenseExpr, error) {
|
||||
func (s *RetrievalService) GetVector(ctx context.Context, txt string, embModel *models.EmbeddingModel, knnTopK, numCandidates int, similarity float64) (result *types.MatchDenseExpr, err error) {
|
||||
defer observability.BeginRetrieval("retrieval_embedding")(&err)
|
||||
embeddingConfig := &models.EmbeddingConfig{
|
||||
Dimension: 0,
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user