shield360 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +310 -0
- package/dist/__tests__/manual-trace.test.d.ts +1 -0
- package/dist/__tests__/manual-trace.test.js +118 -0
- package/dist/__tests__/manual-trace.test.js.map +1 -0
- package/dist/__tests__/register.test.d.ts +0 -0
- package/dist/__tests__/register.test.js +90 -0
- package/dist/__tests__/register.test.js.map +1 -0
- package/dist/config.d.ts +28 -0
- package/dist/config.js +22 -0
- package/dist/config.js.map +1 -0
- package/dist/constant.d.ts +6 -0
- package/dist/constant.js +14 -0
- package/dist/constant.js.map +1 -0
- package/dist/evals/__tests__/offline.test.d.ts +1 -0
- package/dist/evals/__tests__/offline.test.js +427 -0
- package/dist/evals/__tests__/offline.test.js.map +1 -0
- package/dist/evals/index.d.ts +2 -0
- package/dist/evals/index.js +15 -0
- package/dist/evals/index.js.map +1 -0
- package/dist/evals/offline.d.ts +6 -0
- package/dist/evals/offline.js +350 -0
- package/dist/evals/offline.js.map +1 -0
- package/dist/evals/types.d.ts +74 -0
- package/dist/evals/types.js +23 -0
- package/dist/evals/types.js.map +1 -0
- package/dist/features/__tests__/rule-engine.test.d.ts +1 -0
- package/dist/features/__tests__/rule-engine.test.js +146 -0
- package/dist/features/__tests__/rule-engine.test.js.map +1 -0
- package/dist/features/base.d.ts +8 -0
- package/dist/features/base.js +15 -0
- package/dist/features/base.js.map +1 -0
- package/dist/features/prompt-hub.d.ts +4 -0
- package/dist/features/prompt-hub.js +66 -0
- package/dist/features/prompt-hub.js.map +1 -0
- package/dist/features/rule-engine.d.ts +6 -0
- package/dist/features/rule-engine.js +60 -0
- package/dist/features/rule-engine.js.map +1 -0
- package/dist/features/vault.d.ts +4 -0
- package/dist/features/vault.js +63 -0
- package/dist/features/vault.js.map +1 -0
- package/dist/guard/__tests__/findings.test.d.ts +1 -0
- package/dist/guard/__tests__/findings.test.js +79 -0
- package/dist/guard/__tests__/findings.test.js.map +1 -0
- package/dist/guard/__tests__/integration.test.d.ts +1 -0
- package/dist/guard/__tests__/integration.test.js +215 -0
- package/dist/guard/__tests__/integration.test.js.map +1 -0
- package/dist/guard/__tests__/pii.test.d.ts +1 -0
- package/dist/guard/__tests__/pii.test.js +131 -0
- package/dist/guard/__tests__/pii.test.js.map +1 -0
- package/dist/guard/__tests__/pipeline.test.d.ts +1 -0
- package/dist/guard/__tests__/pipeline.test.js +162 -0
- package/dist/guard/__tests__/pipeline.test.js.map +1 -0
- package/dist/guard/__tests__/prompt-injection.test.d.ts +1 -0
- package/dist/guard/__tests__/prompt-injection.test.js +92 -0
- package/dist/guard/__tests__/prompt-injection.test.js.map +1 -0
- package/dist/guard/__tests__/report.test.d.ts +1 -0
- package/dist/guard/__tests__/report.test.js +50 -0
- package/dist/guard/__tests__/report.test.js.map +1 -0
- package/dist/guard/base.d.ts +79 -0
- package/dist/guard/base.js +136 -0
- package/dist/guard/base.js.map +1 -0
- package/dist/guard/custom.d.ts +19 -0
- package/dist/guard/custom.js +46 -0
- package/dist/guard/custom.js.map +1 -0
- package/dist/guard/findings.d.ts +31 -0
- package/dist/guard/findings.js +156 -0
- package/dist/guard/findings.js.map +1 -0
- package/dist/guard/index.d.ts +24 -0
- package/dist/guard/index.js +42 -0
- package/dist/guard/index.js.map +1 -0
- package/dist/guard/integration.d.ts +44 -0
- package/dist/guard/integration.js +363 -0
- package/dist/guard/integration.js.map +1 -0
- package/dist/guard/moderation.d.ts +18 -0
- package/dist/guard/moderation.js +61 -0
- package/dist/guard/moderation.js.map +1 -0
- package/dist/guard/pii.d.ts +17 -0
- package/dist/guard/pii.js +114 -0
- package/dist/guard/pii.js.map +1 -0
- package/dist/guard/pipeline.d.ts +26 -0
- package/dist/guard/pipeline.js +139 -0
- package/dist/guard/pipeline.js.map +1 -0
- package/dist/guard/prompt-injection.d.ts +21 -0
- package/dist/guard/prompt-injection.js +70 -0
- package/dist/guard/prompt-injection.js.map +1 -0
- package/dist/guard/report.d.ts +34 -0
- package/dist/guard/report.js +182 -0
- package/dist/guard/report.js.map +1 -0
- package/dist/guard/schema.d.ts +20 -0
- package/dist/guard/schema.js +99 -0
- package/dist/guard/schema.js.map +1 -0
- package/dist/guard/sensitive-topic.d.ts +23 -0
- package/dist/guard/sensitive-topic.js +89 -0
- package/dist/guard/sensitive-topic.js.map +1 -0
- package/dist/guard/topic-restriction.d.ts +22 -0
- package/dist/guard/topic-restriction.js +54 -0
- package/dist/guard/topic-restriction.js.map +1 -0
- package/dist/helpers.d.ts +246 -0
- package/dist/helpers.js +903 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.js +234 -0
- package/dist/index.js.map +1 -0
- package/dist/instrumentation/__tests__/ai21-rag-trace-comparison.test.d.ts +13 -0
- package/dist/instrumentation/__tests__/ai21-rag-trace-comparison.test.js +176 -0
- package/dist/instrumentation/__tests__/ai21-rag-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/ai21-trace-comparison.test.d.ts +10 -0
- package/dist/instrumentation/__tests__/ai21-trace-comparison.test.js +203 -0
- package/dist/instrumentation/__tests__/ai21-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/anthropic-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/anthropic-wrapper.test.js +284 -0
- package/dist/instrumentation/__tests__/anthropic-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/assemblyai-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/assemblyai-wrapper.test.js +284 -0
- package/dist/instrumentation/__tests__/assemblyai-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/astra-trace-comparison.test.d.ts +7 -0
- package/dist/instrumentation/__tests__/astra-trace-comparison.test.js +160 -0
- package/dist/instrumentation/__tests__/astra-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/base-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/base-wrapper.test.js +171 -0
- package/dist/instrumentation/__tests__/base-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/bedrock-trace-comparison.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/bedrock-trace-comparison.test.js +422 -0
- package/dist/instrumentation/__tests__/bedrock-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/browser-use-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/browser-use-wrapper.test.js +284 -0
- package/dist/instrumentation/__tests__/browser-use-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/cache-pricing.test.d.ts +15 -0
- package/dist/instrumentation/__tests__/cache-pricing.test.js +155 -0
- package/dist/instrumentation/__tests__/cache-pricing.test.js.map +1 -0
- package/dist/instrumentation/__tests__/chroma-trace-comparison.test.d.ts +18 -0
- package/dist/instrumentation/__tests__/chroma-trace-comparison.test.js +209 -0
- package/dist/instrumentation/__tests__/chroma-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/cohere-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/cohere-wrapper.test.js +256 -0
- package/dist/instrumentation/__tests__/cohere-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/elevenlabs-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/elevenlabs-wrapper.test.js +282 -0
- package/dist/instrumentation/__tests__/elevenlabs-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/firecrawl-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/firecrawl-wrapper.test.js +238 -0
- package/dist/instrumentation/__tests__/firecrawl-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/google-ai-trace-comparison.test.d.ts +4 -0
- package/dist/instrumentation/__tests__/google-ai-trace-comparison.test.js +229 -0
- package/dist/instrumentation/__tests__/google-ai-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/gpu-collector.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/gpu-collector.test.js +247 -0
- package/dist/instrumentation/__tests__/gpu-collector.test.js.map +1 -0
- package/dist/instrumentation/__tests__/gradient-trace-comparison.test.d.ts +11 -0
- package/dist/instrumentation/__tests__/gradient-trace-comparison.test.js +391 -0
- package/dist/instrumentation/__tests__/gradient-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/groq-trace-comparison.test.d.ts +7 -0
- package/dist/instrumentation/__tests__/groq-trace-comparison.test.js +687 -0
- package/dist/instrumentation/__tests__/groq-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/helpers-genai.test.d.ts +14 -0
- package/dist/instrumentation/__tests__/helpers-genai.test.js +347 -0
- package/dist/instrumentation/__tests__/helpers-genai.test.js.map +1 -0
- package/dist/instrumentation/__tests__/huggingface-trace-comparison.test.d.ts +7 -0
- package/dist/instrumentation/__tests__/huggingface-trace-comparison.test.js +529 -0
- package/dist/instrumentation/__tests__/huggingface-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/langchain-role-map.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/langchain-role-map.test.js +19 -0
- package/dist/instrumentation/__tests__/langchain-role-map.test.js.map +1 -0
- package/dist/instrumentation/__tests__/langchain-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/langchain-wrapper.test.js +282 -0
- package/dist/instrumentation/__tests__/langchain-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/letta-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/letta-wrapper.test.js +285 -0
- package/dist/instrumentation/__tests__/letta-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/mem0-trace-comparison.test.d.ts +13 -0
- package/dist/instrumentation/__tests__/mem0-trace-comparison.test.js +208 -0
- package/dist/instrumentation/__tests__/mem0-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/milvus-trace-comparison.test.d.ts +17 -0
- package/dist/instrumentation/__tests__/milvus-trace-comparison.test.js +206 -0
- package/dist/instrumentation/__tests__/milvus-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/mistral-trace-comparison.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/mistral-trace-comparison.test.js +345 -0
- package/dist/instrumentation/__tests__/mistral-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/openai-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/openai-wrapper.test.js +179 -0
- package/dist/instrumentation/__tests__/openai-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/pg-trace-comparison.test.d.ts +21 -0
- package/dist/instrumentation/__tests__/pg-trace-comparison.test.js +455 -0
- package/dist/instrumentation/__tests__/pg-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/qdrant-trace-comparison.test.d.ts +17 -0
- package/dist/instrumentation/__tests__/qdrant-trace-comparison.test.js +182 -0
- package/dist/instrumentation/__tests__/qdrant-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/replicate-trace-comparison.test.d.ts +8 -0
- package/dist/instrumentation/__tests__/replicate-trace-comparison.test.js +346 -0
- package/dist/instrumentation/__tests__/replicate-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/together-trace-comparison.test.d.ts +4 -0
- package/dist/instrumentation/__tests__/together-trace-comparison.test.js +289 -0
- package/dist/instrumentation/__tests__/together-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/trace-comparison-utils.d.ts +67 -0
- package/dist/instrumentation/__tests__/trace-comparison-utils.js +255 -0
- package/dist/instrumentation/__tests__/trace-comparison-utils.js.map +1 -0
- package/dist/instrumentation/__tests__/transformers-trace-comparison.test.d.ts +11 -0
- package/dist/instrumentation/__tests__/transformers-trace-comparison.test.js +214 -0
- package/dist/instrumentation/__tests__/transformers-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/vercel-ai-trace-comparison.test.d.ts +8 -0
- package/dist/instrumentation/__tests__/vercel-ai-trace-comparison.test.js +446 -0
- package/dist/instrumentation/__tests__/vercel-ai-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/vertexai-trace-comparison.test.d.ts +6 -0
- package/dist/instrumentation/__tests__/vertexai-trace-comparison.test.js +409 -0
- package/dist/instrumentation/__tests__/vertexai-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/vllm-trace-comparison.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/vllm-trace-comparison.test.js +519 -0
- package/dist/instrumentation/__tests__/vllm-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/ai21/index.d.ts +11 -0
- package/dist/instrumentation/ai21/index.js +67 -0
- package/dist/instrumentation/ai21/index.js.map +1 -0
- package/dist/instrumentation/ai21/wrapper.d.ts +54 -0
- package/dist/instrumentation/ai21/wrapper.js +511 -0
- package/dist/instrumentation/ai21/wrapper.js.map +1 -0
- package/dist/instrumentation/anthropic/index.d.ts +11 -0
- package/dist/instrumentation/anthropic/index.js +45 -0
- package/dist/instrumentation/anthropic/index.js.map +1 -0
- package/dist/instrumentation/anthropic/wrapper.d.ts +34 -0
- package/dist/instrumentation/anthropic/wrapper.js +426 -0
- package/dist/instrumentation/anthropic/wrapper.js.map +1 -0
- package/dist/instrumentation/assemblyai/index.d.ts +12 -0
- package/dist/instrumentation/assemblyai/index.js +91 -0
- package/dist/instrumentation/assemblyai/index.js.map +1 -0
- package/dist/instrumentation/assemblyai/wrapper.d.ts +35 -0
- package/dist/instrumentation/assemblyai/wrapper.js +238 -0
- package/dist/instrumentation/assemblyai/wrapper.js.map +1 -0
- package/dist/instrumentation/astra/index.d.ts +11 -0
- package/dist/instrumentation/astra/index.js +87 -0
- package/dist/instrumentation/astra/index.js.map +1 -0
- package/dist/instrumentation/astra/wrapper.d.ts +39 -0
- package/dist/instrumentation/astra/wrapper.js +349 -0
- package/dist/instrumentation/astra/wrapper.js.map +1 -0
- package/dist/instrumentation/azure-ai-inference/index.d.ts +11 -0
- package/dist/instrumentation/azure-ai-inference/index.js +76 -0
- package/dist/instrumentation/azure-ai-inference/index.js.map +1 -0
- package/dist/instrumentation/azure-ai-inference/wrapper.d.ts +55 -0
- package/dist/instrumentation/azure-ai-inference/wrapper.js +580 -0
- package/dist/instrumentation/azure-ai-inference/wrapper.js.map +1 -0
- package/dist/instrumentation/base-wrapper.d.ts +16 -0
- package/dist/instrumentation/base-wrapper.js +139 -0
- package/dist/instrumentation/base-wrapper.js.map +1 -0
- package/dist/instrumentation/bedrock/index.d.ts +11 -0
- package/dist/instrumentation/bedrock/index.js +52 -0
- package/dist/instrumentation/bedrock/index.js.map +1 -0
- package/dist/instrumentation/bedrock/wrapper.d.ts +41 -0
- package/dist/instrumentation/bedrock/wrapper.js +494 -0
- package/dist/instrumentation/bedrock/wrapper.js.map +1 -0
- package/dist/instrumentation/browser-use/index.d.ts +11 -0
- package/dist/instrumentation/browser-use/index.js +98 -0
- package/dist/instrumentation/browser-use/index.js.map +1 -0
- package/dist/instrumentation/browser-use/wrapper.d.ts +12 -0
- package/dist/instrumentation/browser-use/wrapper.js +706 -0
- package/dist/instrumentation/browser-use/wrapper.js.map +1 -0
- package/dist/instrumentation/chroma/index.d.ts +11 -0
- package/dist/instrumentation/chroma/index.js +70 -0
- package/dist/instrumentation/chroma/index.js.map +1 -0
- package/dist/instrumentation/chroma/wrapper.d.ts +10 -0
- package/dist/instrumentation/chroma/wrapper.js +127 -0
- package/dist/instrumentation/chroma/wrapper.js.map +1 -0
- package/dist/instrumentation/claude-agent-sdk/index.d.ts +23 -0
- package/dist/instrumentation/claude-agent-sdk/index.js +83 -0
- package/dist/instrumentation/claude-agent-sdk/index.js.map +1 -0
- package/dist/instrumentation/claude-agent-sdk/wrapper.d.ts +13 -0
- package/dist/instrumentation/claude-agent-sdk/wrapper.js +1123 -0
- package/dist/instrumentation/claude-agent-sdk/wrapper.js.map +1 -0
- package/dist/instrumentation/cohere/index.d.ts +11 -0
- package/dist/instrumentation/cohere/index.js +53 -0
- package/dist/instrumentation/cohere/index.js.map +1 -0
- package/dist/instrumentation/cohere/wrapper.d.ts +50 -0
- package/dist/instrumentation/cohere/wrapper.js +452 -0
- package/dist/instrumentation/cohere/wrapper.js.map +1 -0
- package/dist/instrumentation/cursor-sdk/index.d.ts +21 -0
- package/dist/instrumentation/cursor-sdk/index.js +58 -0
- package/dist/instrumentation/cursor-sdk/index.js.map +1 -0
- package/dist/instrumentation/cursor-sdk/wrapper.d.ts +17 -0
- package/dist/instrumentation/cursor-sdk/wrapper.js +789 -0
- package/dist/instrumentation/cursor-sdk/wrapper.js.map +1 -0
- package/dist/instrumentation/elevenlabs/index.d.ts +12 -0
- package/dist/instrumentation/elevenlabs/index.js +92 -0
- package/dist/instrumentation/elevenlabs/index.js.map +1 -0
- package/dist/instrumentation/elevenlabs/wrapper.d.ts +34 -0
- package/dist/instrumentation/elevenlabs/wrapper.js +280 -0
- package/dist/instrumentation/elevenlabs/wrapper.js.map +1 -0
- package/dist/instrumentation/firecrawl/index.d.ts +13 -0
- package/dist/instrumentation/firecrawl/index.js +115 -0
- package/dist/instrumentation/firecrawl/index.js.map +1 -0
- package/dist/instrumentation/firecrawl/wrapper.d.ts +22 -0
- package/dist/instrumentation/firecrawl/wrapper.js +378 -0
- package/dist/instrumentation/firecrawl/wrapper.js.map +1 -0
- package/dist/instrumentation/google-adk/index.d.ts +57 -0
- package/dist/instrumentation/google-adk/index.js +371 -0
- package/dist/instrumentation/google-adk/index.js.map +1 -0
- package/dist/instrumentation/google-adk/utils.d.ts +45 -0
- package/dist/instrumentation/google-adk/utils.js +663 -0
- package/dist/instrumentation/google-adk/utils.js.map +1 -0
- package/dist/instrumentation/google-adk/wrapper.d.ts +11 -0
- package/dist/instrumentation/google-adk/wrapper.js +391 -0
- package/dist/instrumentation/google-adk/wrapper.js.map +1 -0
- package/dist/instrumentation/google-ai/index.d.ts +11 -0
- package/dist/instrumentation/google-ai/index.js +48 -0
- package/dist/instrumentation/google-ai/index.js.map +1 -0
- package/dist/instrumentation/google-ai/wrapper.d.ts +52 -0
- package/dist/instrumentation/google-ai/wrapper.js +466 -0
- package/dist/instrumentation/google-ai/wrapper.js.map +1 -0
- package/dist/instrumentation/gpu/index.d.ts +38 -0
- package/dist/instrumentation/gpu/index.js +233 -0
- package/dist/instrumentation/gpu/index.js.map +1 -0
- package/dist/instrumentation/gradient/index.d.ts +12 -0
- package/dist/instrumentation/gradient/index.js +74 -0
- package/dist/instrumentation/gradient/index.js.map +1 -0
- package/dist/instrumentation/gradient/utils.d.ts +14 -0
- package/dist/instrumentation/gradient/utils.js +119 -0
- package/dist/instrumentation/gradient/utils.js.map +1 -0
- package/dist/instrumentation/gradient/wrapper.d.ts +76 -0
- package/dist/instrumentation/gradient/wrapper.js +584 -0
- package/dist/instrumentation/gradient/wrapper.js.map +1 -0
- package/dist/instrumentation/groq/index.d.ts +11 -0
- package/dist/instrumentation/groq/index.js +43 -0
- package/dist/instrumentation/groq/index.js.map +1 -0
- package/dist/instrumentation/groq/wrapper.d.ts +35 -0
- package/dist/instrumentation/groq/wrapper.js +442 -0
- package/dist/instrumentation/groq/wrapper.js.map +1 -0
- package/dist/instrumentation/huggingface/index.d.ts +13 -0
- package/dist/instrumentation/huggingface/index.js +110 -0
- package/dist/instrumentation/huggingface/index.js.map +1 -0
- package/dist/instrumentation/huggingface/wrapper.d.ts +54 -0
- package/dist/instrumentation/huggingface/wrapper.js +514 -0
- package/dist/instrumentation/huggingface/wrapper.js.map +1 -0
- package/dist/instrumentation/index.d.ts +7 -0
- package/dist/instrumentation/index.js +176 -0
- package/dist/instrumentation/index.js.map +1 -0
- package/dist/instrumentation/langchain/index.d.ts +16 -0
- package/dist/instrumentation/langchain/index.js +91 -0
- package/dist/instrumentation/langchain/index.js.map +1 -0
- package/dist/instrumentation/langchain/wrapper.d.ts +41 -0
- package/dist/instrumentation/langchain/wrapper.js +1235 -0
- package/dist/instrumentation/langchain/wrapper.js.map +1 -0
- package/dist/instrumentation/langgraph/index.d.ts +12 -0
- package/dist/instrumentation/langgraph/index.js +99 -0
- package/dist/instrumentation/langgraph/index.js.map +1 -0
- package/dist/instrumentation/langgraph/wrapper.d.ts +20 -0
- package/dist/instrumentation/langgraph/wrapper.js +620 -0
- package/dist/instrumentation/langgraph/wrapper.js.map +1 -0
- package/dist/instrumentation/letta/index.d.ts +10 -0
- package/dist/instrumentation/letta/index.js +122 -0
- package/dist/instrumentation/letta/index.js.map +1 -0
- package/dist/instrumentation/letta/utils.d.ts +24 -0
- package/dist/instrumentation/letta/utils.js +343 -0
- package/dist/instrumentation/letta/utils.js.map +1 -0
- package/dist/instrumentation/letta/wrapper.d.ts +37 -0
- package/dist/instrumentation/letta/wrapper.js +180 -0
- package/dist/instrumentation/letta/wrapper.js.map +1 -0
- package/dist/instrumentation/llamaindex/index.d.ts +36 -0
- package/dist/instrumentation/llamaindex/index.js +221 -0
- package/dist/instrumentation/llamaindex/index.js.map +1 -0
- package/dist/instrumentation/llamaindex/wrapper.d.ts +36 -0
- package/dist/instrumentation/llamaindex/wrapper.js +811 -0
- package/dist/instrumentation/llamaindex/wrapper.js.map +1 -0
- package/dist/instrumentation/mcp/index.d.ts +20 -0
- package/dist/instrumentation/mcp/index.js +282 -0
- package/dist/instrumentation/mcp/index.js.map +1 -0
- package/dist/instrumentation/mcp/wrapper.d.ts +72 -0
- package/dist/instrumentation/mcp/wrapper.js +571 -0
- package/dist/instrumentation/mcp/wrapper.js.map +1 -0
- package/dist/instrumentation/mem0/index.d.ts +17 -0
- package/dist/instrumentation/mem0/index.js +113 -0
- package/dist/instrumentation/mem0/index.js.map +1 -0
- package/dist/instrumentation/mem0/wrapper.d.ts +37 -0
- package/dist/instrumentation/mem0/wrapper.js +298 -0
- package/dist/instrumentation/mem0/wrapper.js.map +1 -0
- package/dist/instrumentation/milvus/index.d.ts +11 -0
- package/dist/instrumentation/milvus/index.js +67 -0
- package/dist/instrumentation/milvus/index.js.map +1 -0
- package/dist/instrumentation/milvus/wrapper.d.ts +15 -0
- package/dist/instrumentation/milvus/wrapper.js +219 -0
- package/dist/instrumentation/milvus/wrapper.js.map +1 -0
- package/dist/instrumentation/mistral/index.d.ts +11 -0
- package/dist/instrumentation/mistral/index.js +66 -0
- package/dist/instrumentation/mistral/index.js.map +1 -0
- package/dist/instrumentation/mistral/wrapper.d.ts +49 -0
- package/dist/instrumentation/mistral/wrapper.js +482 -0
- package/dist/instrumentation/mistral/wrapper.js.map +1 -0
- package/dist/instrumentation/ollama/index.d.ts +11 -0
- package/dist/instrumentation/ollama/index.js +72 -0
- package/dist/instrumentation/ollama/index.js.map +1 -0
- package/dist/instrumentation/ollama/wrapper.d.ts +73 -0
- package/dist/instrumentation/ollama/wrapper.js +629 -0
- package/dist/instrumentation/ollama/wrapper.js.map +1 -0
- package/dist/instrumentation/openai/index.d.ts +11 -0
- package/dist/instrumentation/openai/index.js +79 -0
- package/dist/instrumentation/openai/index.js.map +1 -0
- package/dist/instrumentation/openai/wrapper.d.ts +80 -0
- package/dist/instrumentation/openai/wrapper.js +1121 -0
- package/dist/instrumentation/openai/wrapper.js.map +1 -0
- package/dist/instrumentation/openai-agents/index.d.ts +20 -0
- package/dist/instrumentation/openai-agents/index.js +174 -0
- package/dist/instrumentation/openai-agents/index.js.map +1 -0
- package/dist/instrumentation/openai-agents/processor.d.ts +35 -0
- package/dist/instrumentation/openai-agents/processor.js +249 -0
- package/dist/instrumentation/openai-agents/processor.js.map +1 -0
- package/dist/instrumentation/openai-agents/utils.d.ts +20 -0
- package/dist/instrumentation/openai-agents/utils.js +624 -0
- package/dist/instrumentation/openai-agents/utils.js.map +1 -0
- package/dist/instrumentation/pg/index.d.ts +20 -0
- package/dist/instrumentation/pg/index.js +74 -0
- package/dist/instrumentation/pg/index.js.map +1 -0
- package/dist/instrumentation/pg/wrapper.d.ts +66 -0
- package/dist/instrumentation/pg/wrapper.js +441 -0
- package/dist/instrumentation/pg/wrapper.js.map +1 -0
- package/dist/instrumentation/pinecone/index.d.ts +11 -0
- package/dist/instrumentation/pinecone/index.js +79 -0
- package/dist/instrumentation/pinecone/index.js.map +1 -0
- package/dist/instrumentation/pinecone/wrapper.d.ts +14 -0
- package/dist/instrumentation/pinecone/wrapper.js +198 -0
- package/dist/instrumentation/pinecone/wrapper.js.map +1 -0
- package/dist/instrumentation/qdrant/index.d.ts +11 -0
- package/dist/instrumentation/qdrant/index.js +67 -0
- package/dist/instrumentation/qdrant/index.js.map +1 -0
- package/dist/instrumentation/qdrant/wrapper.d.ts +14 -0
- package/dist/instrumentation/qdrant/wrapper.js +213 -0
- package/dist/instrumentation/qdrant/wrapper.js.map +1 -0
- package/dist/instrumentation/replicate/index.d.ts +11 -0
- package/dist/instrumentation/replicate/index.js +57 -0
- package/dist/instrumentation/replicate/index.js.map +1 -0
- package/dist/instrumentation/replicate/wrapper.d.ts +28 -0
- package/dist/instrumentation/replicate/wrapper.js +242 -0
- package/dist/instrumentation/replicate/wrapper.js.map +1 -0
- package/dist/instrumentation/strands/index.d.ts +21 -0
- package/dist/instrumentation/strands/index.js +83 -0
- package/dist/instrumentation/strands/index.js.map +1 -0
- package/dist/instrumentation/strands/processor.d.ts +51 -0
- package/dist/instrumentation/strands/processor.js +625 -0
- package/dist/instrumentation/strands/processor.js.map +1 -0
- package/dist/instrumentation/strands/utils.d.ts +24 -0
- package/dist/instrumentation/strands/utils.js +373 -0
- package/dist/instrumentation/strands/utils.js.map +1 -0
- package/dist/instrumentation/together/index.d.ts +11 -0
- package/dist/instrumentation/together/index.js +43 -0
- package/dist/instrumentation/together/index.js.map +1 -0
- package/dist/instrumentation/together/wrapper.d.ts +48 -0
- package/dist/instrumentation/together/wrapper.js +409 -0
- package/dist/instrumentation/together/wrapper.js.map +1 -0
- package/dist/instrumentation/transformers/index.d.ts +35 -0
- package/dist/instrumentation/transformers/index.js +119 -0
- package/dist/instrumentation/transformers/index.js.map +1 -0
- package/dist/instrumentation/transformers/wrapper.d.ts +49 -0
- package/dist/instrumentation/transformers/wrapper.js +472 -0
- package/dist/instrumentation/transformers/wrapper.js.map +1 -0
- package/dist/instrumentation/vercel-ai/index.d.ts +10 -0
- package/dist/instrumentation/vercel-ai/index.js +59 -0
- package/dist/instrumentation/vercel-ai/index.js.map +1 -0
- package/dist/instrumentation/vercel-ai/wrapper.d.ts +50 -0
- package/dist/instrumentation/vercel-ai/wrapper.js +539 -0
- package/dist/instrumentation/vercel-ai/wrapper.js.map +1 -0
- package/dist/instrumentation/vertexai/index.d.ts +11 -0
- package/dist/instrumentation/vertexai/index.js +70 -0
- package/dist/instrumentation/vertexai/index.js.map +1 -0
- package/dist/instrumentation/vertexai/wrapper.d.ts +67 -0
- package/dist/instrumentation/vertexai/wrapper.js +530 -0
- package/dist/instrumentation/vertexai/wrapper.js.map +1 -0
- package/dist/instrumentation/vllm/index.d.ts +13 -0
- package/dist/instrumentation/vllm/index.js +67 -0
- package/dist/instrumentation/vllm/index.js.map +1 -0
- package/dist/instrumentation/vllm/wrapper.d.ts +60 -0
- package/dist/instrumentation/vllm/wrapper.js +482 -0
- package/dist/instrumentation/vllm/wrapper.js.map +1 -0
- package/dist/llm/anthropic.d.ts +5 -0
- package/dist/llm/anthropic.js +39 -0
- package/dist/llm/anthropic.js.map +1 -0
- package/dist/llm/index.d.ts +10 -0
- package/dist/llm/index.js +93 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/llm/openai.d.ts +6 -0
- package/dist/llm/openai.js +52 -0
- package/dist/llm/openai.js.map +1 -0
- package/dist/llm/providers.d.ts +7 -0
- package/dist/llm/providers.js +10 -0
- package/dist/llm/providers.js.map +1 -0
- package/dist/manual-trace.d.ts +40 -0
- package/dist/manual-trace.js +103 -0
- package/dist/manual-trace.js.map +1 -0
- package/dist/otel/__tests__/metrics.test.d.ts +1 -0
- package/dist/otel/__tests__/metrics.test.js +40 -0
- package/dist/otel/__tests__/metrics.test.js.map +1 -0
- package/dist/otel/events.d.ts +11 -0
- package/dist/otel/events.js +74 -0
- package/dist/otel/events.js.map +1 -0
- package/dist/otel/metrics.d.ts +35 -0
- package/dist/otel/metrics.js +219 -0
- package/dist/otel/metrics.js.map +1 -0
- package/dist/otel/tracing.d.ts +12 -0
- package/dist/otel/tracing.js +93 -0
- package/dist/otel/tracing.js.map +1 -0
- package/dist/otel/utils.d.ts +11 -0
- package/dist/otel/utils.js +34 -0
- package/dist/otel/utils.js.map +1 -0
- package/dist/pricing.json +951 -0
- package/dist/prompt-hub.d.ts +4 -0
- package/dist/prompt-hub.js +66 -0
- package/dist/prompt-hub.js.map +1 -0
- package/dist/register.d.ts +4 -0
- package/dist/register.js +52 -0
- package/dist/register.js.map +1 -0
- package/dist/score/__tests__/score.test.d.ts +1 -0
- package/dist/score/__tests__/score.test.js +143 -0
- package/dist/score/__tests__/score.test.js.map +1 -0
- package/dist/score/index.d.ts +2 -0
- package/dist/score/index.js +6 -0
- package/dist/score/index.js.map +1 -0
- package/dist/score/score.d.ts +15 -0
- package/dist/score/score.js +135 -0
- package/dist/score/score.js.map +1 -0
- package/dist/semantic-convention.d.ts +555 -0
- package/dist/semantic-convention.js +630 -0
- package/dist/semantic-convention.js.map +1 -0
- package/dist/types.d.ts +131 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +136 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const instrumentation_1 = require("@opentelemetry/instrumentation");
|
|
7
|
+
const constant_1 = require("../../constant");
|
|
8
|
+
const wrapper_1 = __importDefault(require("./wrapper"));
|
|
9
|
+
class Shield360PineconeInstrumentation extends instrumentation_1.InstrumentationBase {
|
|
10
|
+
constructor(config = {}) {
|
|
11
|
+
super(`${constant_1.INSTRUMENTATION_PREFIX}/instrumentation-pinecone`, '1.0.0', config);
|
|
12
|
+
}
|
|
13
|
+
init() {
|
|
14
|
+
const module = new instrumentation_1.InstrumentationNodeModuleDefinition('@pinecone-database/pinecone', ['>=1.0.0'], (moduleExports) => {
|
|
15
|
+
this._patch(moduleExports);
|
|
16
|
+
return moduleExports;
|
|
17
|
+
}, (moduleExports) => {
|
|
18
|
+
if (moduleExports !== undefined) {
|
|
19
|
+
this._unpatch(moduleExports);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return [module];
|
|
23
|
+
}
|
|
24
|
+
manualPatch(pinecone) {
|
|
25
|
+
this._patch(pinecone);
|
|
26
|
+
}
|
|
27
|
+
_patch(moduleExports) {
|
|
28
|
+
try {
|
|
29
|
+
// Patch Index prototype directly
|
|
30
|
+
const IndexClass = moduleExports.Index;
|
|
31
|
+
if (IndexClass?.prototype) {
|
|
32
|
+
const methods = [
|
|
33
|
+
['query', 'query'],
|
|
34
|
+
['upsert', 'upsert'],
|
|
35
|
+
['deleteOne', 'one'],
|
|
36
|
+
['deleteMany', 'many'],
|
|
37
|
+
['update', 'update'],
|
|
38
|
+
];
|
|
39
|
+
for (const [method, opSuffix] of methods) {
|
|
40
|
+
if (typeof IndexClass.prototype[method] === 'function') {
|
|
41
|
+
if ((0, instrumentation_1.isWrapped)(IndexClass.prototype[method])) {
|
|
42
|
+
this._unwrap(IndexClass.prototype, method);
|
|
43
|
+
}
|
|
44
|
+
if (method === 'query') {
|
|
45
|
+
this._wrap(IndexClass.prototype, method, wrapper_1.default._patchQuery(this.tracer));
|
|
46
|
+
}
|
|
47
|
+
else if (method === 'upsert') {
|
|
48
|
+
this._wrap(IndexClass.prototype, method, wrapper_1.default._patchUpsert(this.tracer));
|
|
49
|
+
}
|
|
50
|
+
else if (method === 'update') {
|
|
51
|
+
this._wrap(IndexClass.prototype, method, wrapper_1.default._patchUpdate(this.tracer));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
this._wrap(IndexClass.prototype, method, wrapper_1.default._patchDelete(this.tracer, opSuffix));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
console.error('Error in Pinecone _patch method:', e);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
_unpatch(moduleExports) {
|
|
65
|
+
try {
|
|
66
|
+
const IndexClass = moduleExports.Index;
|
|
67
|
+
if (IndexClass?.prototype) {
|
|
68
|
+
['query', 'upsert', 'deleteOne', 'deleteMany', 'update'].forEach((method) => {
|
|
69
|
+
if (typeof IndexClass.prototype[method] === 'function') {
|
|
70
|
+
this._unwrap(IndexClass.prototype, method);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch { /* ignore */ }
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.default = Shield360PineconeInstrumentation;
|
|
79
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/instrumentation/pinecone/index.ts"],"names":[],"mappings":";;;;;AAAA,oEAKwC;AAExC,6CAAwD;AACxD,wDAAwC;AAIxC,MAAqB,gCAAiC,SAAQ,qCAAmB;IAC/E,YAAY,SAAwC,EAAE;QACpD,KAAK,CAAC,GAAG,iCAAsB,2BAA2B,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC/E,CAAC;IAES,IAAI;QACZ,MAAM,MAAM,GAAG,IAAI,qDAAmC,CACpD,6BAA6B,EAC7B,CAAC,SAAS,CAAC,EACX,CAAC,aAAa,EAAE,EAAE;YAChB,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;YAC3B,OAAO,aAAa,CAAC;QACvB,CAAC,EACD,CAAC,aAAa,EAAE,EAAE;YAChB,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;gBAChC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC,CACF,CAAC;QACF,OAAO,CAAC,MAAM,CAAC,CAAC;IA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I,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,iBAAe,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;wBACtF,CAAC;6BAAM,CAAC;4BACN,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,iBAAe,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;wBAChG,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,CAAC,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IAES,QAAQ,CAAC,aAAkB;QACnC,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC;YACvC,IAAI,UAAU,EAAE,SAAS,EAAE,CAAC;gBAC1B,CAAC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;oBAC1E,IAAI,OAAO,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC;wBACvD,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;oBAC7C,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;IAC1B,CAAC;CACF;AAzED,mDAyEC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Tracer } from '@opentelemetry/api';
|
|
2
|
+
import BaseWrapper from '../base-wrapper';
|
|
3
|
+
declare class PineconeWrapper extends BaseWrapper {
|
|
4
|
+
static dbSystem: string;
|
|
5
|
+
static serverAddress: string;
|
|
6
|
+
static serverPort: number;
|
|
7
|
+
static _resolveNamespace(indexInstance: any, paramsNamespace?: string): string;
|
|
8
|
+
static _setCommonAttributes(span: any, dbOperation: string, namespace: string): void;
|
|
9
|
+
static _patchQuery(tracer: Tracer): any;
|
|
10
|
+
static _patchUpsert(tracer: Tracer): any;
|
|
11
|
+
static _patchDelete(tracer: Tracer, operationName: string): any;
|
|
12
|
+
static _patchUpdate(tracer: Tracer): any;
|
|
13
|
+
}
|
|
14
|
+
export default PineconeWrapper;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const api_1 = require("@opentelemetry/api");
|
|
7
|
+
const config_1 = __importDefault(require("../../config"));
|
|
8
|
+
const helpers_1 = __importDefault(require("../../helpers"));
|
|
9
|
+
const semantic_convention_1 = __importDefault(require("../../semantic-convention"));
|
|
10
|
+
const base_wrapper_1 = __importDefault(require("../base-wrapper"));
|
|
11
|
+
class PineconeWrapper extends base_wrapper_1.default {
|
|
12
|
+
// Safely resolve the namespace string from the Index instance.
|
|
13
|
+
// `this.namespace` on a Pinecone Index is a METHOD that creates namespace-scoped
|
|
14
|
+
// sub-indices, not a string property. The actual namespace string may be stored
|
|
15
|
+
// internally in `this.target.namespace` depending on the SDK version.
|
|
16
|
+
static _resolveNamespace(indexInstance, paramsNamespace) {
|
|
17
|
+
if (paramsNamespace && typeof paramsNamespace === 'string')
|
|
18
|
+
return paramsNamespace;
|
|
19
|
+
const ns = indexInstance?.target?.namespace ?? indexInstance?._namespace ?? '';
|
|
20
|
+
return typeof ns === 'string' && ns ? ns : 'default';
|
|
21
|
+
}
|
|
22
|
+
static _setCommonAttributes(span, dbOperation, namespace) {
|
|
23
|
+
const applicationName = config_1.default.applicationName || '';
|
|
24
|
+
const environment = config_1.default.environment || '';
|
|
25
|
+
span.setAttribute(semantic_convention_1.default.DB_SYSTEM_NAME, PineconeWrapper.dbSystem);
|
|
26
|
+
span.setAttribute(semantic_convention_1.default.DB_OPERATION_NAME, dbOperation);
|
|
27
|
+
span.setAttribute(semantic_convention_1.default.DB_NAMESPACE, namespace);
|
|
28
|
+
span.setAttribute(semantic_convention_1.default.SERVER_ADDRESS, PineconeWrapper.serverAddress);
|
|
29
|
+
span.setAttribute(semantic_convention_1.default.SERVER_PORT, PineconeWrapper.serverPort);
|
|
30
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_ENVIRONMENT, environment);
|
|
31
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_APPLICATION_NAME, applicationName);
|
|
32
|
+
}
|
|
33
|
+
static _patchQuery(tracer) {
|
|
34
|
+
const dbOperation = semantic_convention_1.default.DB_OPERATION_QUERY;
|
|
35
|
+
return (originalMethod) => {
|
|
36
|
+
return async function (...args) {
|
|
37
|
+
const params = args[0] || {};
|
|
38
|
+
const namespace = PineconeWrapper._resolveNamespace(this, params.namespace);
|
|
39
|
+
const spanName = `${dbOperation} ${namespace}`;
|
|
40
|
+
const span = tracer.startSpan(spanName, { kind: api_1.SpanKind.CLIENT });
|
|
41
|
+
const startTime = Date.now();
|
|
42
|
+
return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), async () => {
|
|
43
|
+
try {
|
|
44
|
+
const response = await originalMethod.apply(this, args);
|
|
45
|
+
const duration = (Date.now() - startTime) / 1000;
|
|
46
|
+
PineconeWrapper._setCommonAttributes(span, dbOperation, namespace);
|
|
47
|
+
span.setAttribute(semantic_convention_1.default.DB_VECTOR_QUERY_TOP_K, params.topK || 0);
|
|
48
|
+
span.setAttribute(semantic_convention_1.default.DB_CLIENT_OPERATION_DURATION, duration);
|
|
49
|
+
if (params.filter) {
|
|
50
|
+
span.setAttribute(semantic_convention_1.default.DB_FILTER, JSON.stringify(params.filter));
|
|
51
|
+
}
|
|
52
|
+
const matchCount = response?.matches?.length || 0;
|
|
53
|
+
span.setAttribute(semantic_convention_1.default.DB_N_RESULTS, matchCount);
|
|
54
|
+
if (config_1.default.captureMessageContent && params.vector) {
|
|
55
|
+
span.setAttribute(semantic_convention_1.default.DB_QUERY_TEXT, JSON.stringify(params.vector?.slice(0, 10)));
|
|
56
|
+
}
|
|
57
|
+
span.setAttribute(semantic_convention_1.default.DB_QUERY_SUMMARY, `${dbOperation} ${namespace} top_k=${params.topK || 0} filtered=${params.filter ? 'true' : 'false'}`);
|
|
58
|
+
span.setStatus({ code: 1 }); // SpanStatusCode.OK
|
|
59
|
+
return response;
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
helpers_1.default.handleException(span, e);
|
|
63
|
+
throw e;
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
span.end();
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
static _patchUpsert(tracer) {
|
|
73
|
+
const dbOperation = semantic_convention_1.default.DB_OPERATION_UPSERT;
|
|
74
|
+
return (originalMethod) => {
|
|
75
|
+
return async function (...args) {
|
|
76
|
+
const namespace = PineconeWrapper._resolveNamespace(this);
|
|
77
|
+
const spanName = `${dbOperation} ${namespace}`;
|
|
78
|
+
const span = tracer.startSpan(spanName, { kind: api_1.SpanKind.CLIENT });
|
|
79
|
+
const startTime = Date.now();
|
|
80
|
+
return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), async () => {
|
|
81
|
+
try {
|
|
82
|
+
const response = await originalMethod.apply(this, args);
|
|
83
|
+
const records = Array.isArray(args[0]) ? args[0] : [];
|
|
84
|
+
const duration = (Date.now() - startTime) / 1000;
|
|
85
|
+
PineconeWrapper._setCommonAttributes(span, dbOperation, namespace);
|
|
86
|
+
span.setAttribute(semantic_convention_1.default.DB_VECTOR_COUNT, records.length);
|
|
87
|
+
span.setAttribute(semantic_convention_1.default.DB_CLIENT_OPERATION_DURATION, duration);
|
|
88
|
+
span.setAttribute(semantic_convention_1.default.DB_QUERY_SUMMARY, `${dbOperation} ${namespace} vectors_count=${records.length}`);
|
|
89
|
+
if (config_1.default.captureMessageContent && records.length > 0) {
|
|
90
|
+
span.setAttribute(semantic_convention_1.default.DB_QUERY_TEXT, JSON.stringify(records.map((r) => r.id)));
|
|
91
|
+
}
|
|
92
|
+
span.setStatus({ code: 1 });
|
|
93
|
+
return response;
|
|
94
|
+
}
|
|
95
|
+
catch (e) {
|
|
96
|
+
helpers_1.default.handleException(span, e);
|
|
97
|
+
throw e;
|
|
98
|
+
}
|
|
99
|
+
finally {
|
|
100
|
+
span.end();
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
static _patchDelete(tracer, operationName) {
|
|
107
|
+
const dbOperation = semantic_convention_1.default.DB_OPERATION_DELETE;
|
|
108
|
+
return (originalMethod) => {
|
|
109
|
+
return async function (...args) {
|
|
110
|
+
const namespace = PineconeWrapper._resolveNamespace(this);
|
|
111
|
+
const spanName = `${dbOperation} ${namespace}`;
|
|
112
|
+
const span = tracer.startSpan(spanName, { kind: api_1.SpanKind.CLIENT });
|
|
113
|
+
const startTime = Date.now();
|
|
114
|
+
return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), async () => {
|
|
115
|
+
try {
|
|
116
|
+
const response = await originalMethod.apply(this, args);
|
|
117
|
+
const params = args[0] || {};
|
|
118
|
+
const duration = (Date.now() - startTime) / 1000;
|
|
119
|
+
PineconeWrapper._setCommonAttributes(span, `${dbOperation}.${operationName}`, namespace);
|
|
120
|
+
span.setAttribute(semantic_convention_1.default.DB_CLIENT_OPERATION_DURATION, duration);
|
|
121
|
+
// deleteOne passes an id string; deleteMany passes an array of ids
|
|
122
|
+
let ids = [];
|
|
123
|
+
if (typeof params === 'string') {
|
|
124
|
+
ids = [params];
|
|
125
|
+
span.setAttribute(semantic_convention_1.default.DB_ID_COUNT, 1);
|
|
126
|
+
}
|
|
127
|
+
else if (Array.isArray(params)) {
|
|
128
|
+
ids = params;
|
|
129
|
+
span.setAttribute(semantic_convention_1.default.DB_ID_COUNT, params.length);
|
|
130
|
+
}
|
|
131
|
+
else if (params.ids) {
|
|
132
|
+
ids = Array.isArray(params.ids) ? params.ids : [params.ids];
|
|
133
|
+
span.setAttribute(semantic_convention_1.default.DB_ID_COUNT, ids.length);
|
|
134
|
+
}
|
|
135
|
+
if (params.deleteAll) {
|
|
136
|
+
span.setAttribute(semantic_convention_1.default.DB_DELETE_ALL, true);
|
|
137
|
+
}
|
|
138
|
+
if (params.filter) {
|
|
139
|
+
span.setAttribute(semantic_convention_1.default.DB_FILTER, JSON.stringify(params.filter));
|
|
140
|
+
}
|
|
141
|
+
span.setAttribute(semantic_convention_1.default.DB_QUERY_SUMMARY, `${dbOperation} ${namespace} ids=${JSON.stringify(ids)} delete_all=${params.deleteAll || false}`);
|
|
142
|
+
span.setStatus({ code: 1 });
|
|
143
|
+
return response;
|
|
144
|
+
}
|
|
145
|
+
catch (e) {
|
|
146
|
+
helpers_1.default.handleException(span, e);
|
|
147
|
+
throw e;
|
|
148
|
+
}
|
|
149
|
+
finally {
|
|
150
|
+
span.end();
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
static _patchUpdate(tracer) {
|
|
157
|
+
const dbOperation = semantic_convention_1.default.DB_OPERATION_UPDATE;
|
|
158
|
+
return (originalMethod) => {
|
|
159
|
+
return async function (...args) {
|
|
160
|
+
const namespace = PineconeWrapper._resolveNamespace(this);
|
|
161
|
+
const spanName = `${dbOperation} ${namespace}`;
|
|
162
|
+
const span = tracer.startSpan(spanName, { kind: api_1.SpanKind.CLIENT });
|
|
163
|
+
const startTime = Date.now();
|
|
164
|
+
return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), async () => {
|
|
165
|
+
try {
|
|
166
|
+
const response = await originalMethod.apply(this, args);
|
|
167
|
+
const params = args[0] || {};
|
|
168
|
+
const duration = (Date.now() - startTime) / 1000;
|
|
169
|
+
PineconeWrapper._setCommonAttributes(span, dbOperation, namespace);
|
|
170
|
+
span.setAttribute(semantic_convention_1.default.DB_CLIENT_OPERATION_DURATION, duration);
|
|
171
|
+
if (params.id)
|
|
172
|
+
span.setAttribute(semantic_convention_1.default.DB_UPDATE_ID, params.id);
|
|
173
|
+
if (params.values)
|
|
174
|
+
span.setAttribute(semantic_convention_1.default.DB_UPDATE_VALUES, String(params.values?.length || 0));
|
|
175
|
+
if (params.metadata) {
|
|
176
|
+
span.setAttribute(semantic_convention_1.default.DB_UPDATE_METADATA, JSON.stringify(params.metadata));
|
|
177
|
+
}
|
|
178
|
+
span.setAttribute(semantic_convention_1.default.DB_QUERY_SUMMARY, `${dbOperation} ${namespace} id=${params.id || ''} values=${params.values?.length || 0} set_metadata=${params.metadata ? JSON.stringify(params.metadata) : ''}`);
|
|
179
|
+
span.setStatus({ code: 1 });
|
|
180
|
+
return response;
|
|
181
|
+
}
|
|
182
|
+
catch (e) {
|
|
183
|
+
helpers_1.default.handleException(span, e);
|
|
184
|
+
throw e;
|
|
185
|
+
}
|
|
186
|
+
finally {
|
|
187
|
+
span.end();
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
PineconeWrapper.dbSystem = semantic_convention_1.default.DB_SYSTEM_PINECONE;
|
|
195
|
+
PineconeWrapper.serverAddress = 'pinecone.io';
|
|
196
|
+
PineconeWrapper.serverPort = 443;
|
|
197
|
+
exports.default = PineconeWrapper;
|
|
198
|
+
//# sourceMappingURL=wrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapper.js","sourceRoot":"","sources":["../../../src/instrumentation/pinecone/wrapper.ts"],"names":[],"mappings":";;;;;AAAA,4CAAsE;AACtE,0DAA2C;AAC3C,4DAA4C;AAC5C,oFAA2D;AAC3D,mEAA0C;AAE1C,MAA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AI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAChK,CAAC;wBAEF,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;wBAC5B,OAAO,QAAQ,CAAC;oBAClB,CAAC;oBAAC,OAAO,CAAM,EAAE,CAAC;wBAChB,iBAAe,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;wBACzC,MAAM,CAAC,CAAC;oBACV,CAAC;4BAAS,CAAC;wBACT,IAAI,CAAC,GAAG,EAAE,CAAC;oBACb,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;;AAlNM,wBAAQ,GAAG,6BAAkB,CAAC,kBAAkB,CAAC;AACjD,6BAAa,GAAG,aAAa,CAAC;AAC9B,0BAAU,GAAG,GAAG,CAAC;AAmN1B,kBAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { InstrumentationBase, InstrumentationModuleDefinition } from '@opentelemetry/instrumentation';
|
|
2
|
+
import { InstrumentationConfig } from '@opentelemetry/instrumentation';
|
|
3
|
+
export interface QdrantInstrumentationConfig extends InstrumentationConfig {
|
|
4
|
+
}
|
|
5
|
+
export default class Shield360QdrantInstrumentation extends InstrumentationBase {
|
|
6
|
+
constructor(config?: QdrantInstrumentationConfig);
|
|
7
|
+
protected init(): void | InstrumentationModuleDefinition | InstrumentationModuleDefinition[];
|
|
8
|
+
manualPatch(qdrant: any): void;
|
|
9
|
+
protected _patch(moduleExports: any): void;
|
|
10
|
+
protected _unpatch(moduleExports: any): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const instrumentation_1 = require("@opentelemetry/instrumentation");
|
|
7
|
+
const constant_1 = require("../../constant");
|
|
8
|
+
const wrapper_1 = __importDefault(require("./wrapper"));
|
|
9
|
+
class Shield360QdrantInstrumentation extends instrumentation_1.InstrumentationBase {
|
|
10
|
+
constructor(config = {}) {
|
|
11
|
+
super(`${constant_1.INSTRUMENTATION_PREFIX}/instrumentation-qdrant`, '1.0.0', config);
|
|
12
|
+
}
|
|
13
|
+
init() {
|
|
14
|
+
const module = new instrumentation_1.InstrumentationNodeModuleDefinition('@qdrant/js-client-rest', ['>=1.0.0'], (moduleExports) => {
|
|
15
|
+
this._patch(moduleExports);
|
|
16
|
+
return moduleExports;
|
|
17
|
+
}, (moduleExports) => {
|
|
18
|
+
if (moduleExports !== undefined) {
|
|
19
|
+
this._unpatch(moduleExports);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return [module];
|
|
23
|
+
}
|
|
24
|
+
manualPatch(qdrant) {
|
|
25
|
+
this._patch(qdrant);
|
|
26
|
+
}
|
|
27
|
+
_patch(moduleExports) {
|
|
28
|
+
try {
|
|
29
|
+
const QdrantClient = moduleExports.QdrantClient;
|
|
30
|
+
if (!QdrantClient?.prototype)
|
|
31
|
+
return;
|
|
32
|
+
const patchMap = [
|
|
33
|
+
['search', wrapper_1.default._patchSearch.bind(wrapper_1.default)],
|
|
34
|
+
['upsert', wrapper_1.default._patchUpsert.bind(wrapper_1.default)],
|
|
35
|
+
['delete', wrapper_1.default._patchDelete.bind(wrapper_1.default)],
|
|
36
|
+
['retrieve', wrapper_1.default._patchRetrieve.bind(wrapper_1.default)],
|
|
37
|
+
['scroll', wrapper_1.default._patchScroll.bind(wrapper_1.default)],
|
|
38
|
+
];
|
|
39
|
+
for (const [method, patchFn] of patchMap) {
|
|
40
|
+
if (typeof QdrantClient.prototype[method] === 'function') {
|
|
41
|
+
if ((0, instrumentation_1.isWrapped)(QdrantClient.prototype[method])) {
|
|
42
|
+
this._unwrap(QdrantClient.prototype, method);
|
|
43
|
+
}
|
|
44
|
+
this._wrap(QdrantClient.prototype, method, patchFn(this.tracer));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
console.error('Error in Qdrant _patch method:', e);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
_unpatch(moduleExports) {
|
|
53
|
+
try {
|
|
54
|
+
const QdrantClient = moduleExports.QdrantClient;
|
|
55
|
+
if (!QdrantClient?.prototype)
|
|
56
|
+
return;
|
|
57
|
+
for (const method of ['search', 'upsert', 'delete', 'retrieve', 'scroll']) {
|
|
58
|
+
if (typeof QdrantClient.prototype[method] === 'function') {
|
|
59
|
+
this._unwrap(QdrantClient.prototype, method);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch { /* ignore */ }
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.default = Shield360QdrantInstrumentation;
|
|
67
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/instrumentation/qdrant/index.ts"],"names":[],"mappings":";;;;;AAAA,oEAKwC;AAExC,6CAAwD;AACxD,wDAAsC;AAItC,MAAqB,8BAA+B,SAAQ,qCAAmB;IAC7E,YAAY,SAAsC,EAAE;QAClD,KAAK,CAAC,GAAG,iCAAsB,yBAAyB,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC7E,CAAC;IAES,IAAI;QACZ,MAAM,MAAM,GAAG,IAAI,qDAAmC,CACpD,wBAAwB,EACxB,CAAC,SAAS,CAAC,EACX,CAAC,aAAa,EAAE,EAAE;YAChB,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;YAC3B,OAAO,aAAa,CAAC;QACvB,CAAC,EACD,CAAC,aAAa,EAAE,EAAE;YAChB,IAAI,aAAa,KAAK,SAA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AC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;gBACnE,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,CAAC,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IAES,QAAQ,CAAC,aAAkB;QACnC,IAAI,CAAC;YACH,MAAM,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC;YAChD,IAAI,CAAC,YAAY,EAAE,SAAS;gBAAE,OAAO;YACrC,KAAK,MAAM,MAAM,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,CAAC;gBAC1E,IAAI,OAAO,YAAY,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC;oBACzD,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;gBAC/C,CAAC;YACH,CAAC;QACH,CAAC;QAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;IAC1B,CAAC;CACF;AA/DD,iDA+DC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Tracer } from '@opentelemetry/api';
|
|
2
|
+
import BaseWrapper from '../base-wrapper';
|
|
3
|
+
declare class QdrantWrapper extends BaseWrapper {
|
|
4
|
+
static dbSystem: string;
|
|
5
|
+
static serverAddress: string;
|
|
6
|
+
static serverPort: number;
|
|
7
|
+
static _setCommonAttributes(span: any, dbOperation: string, collectionName: string): void;
|
|
8
|
+
static _patchSearch(tracer: Tracer): any;
|
|
9
|
+
static _patchUpsert(tracer: Tracer): any;
|
|
10
|
+
static _patchDelete(tracer: Tracer): any;
|
|
11
|
+
static _patchRetrieve(tracer: Tracer): any;
|
|
12
|
+
static _patchScroll(tracer: Tracer): any;
|
|
13
|
+
}
|
|
14
|
+
export default QdrantWrapper;
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const api_1 = require("@opentelemetry/api");
|
|
7
|
+
const config_1 = __importDefault(require("../../config"));
|
|
8
|
+
const helpers_1 = __importDefault(require("../../helpers"));
|
|
9
|
+
const semantic_convention_1 = __importDefault(require("../../semantic-convention"));
|
|
10
|
+
const base_wrapper_1 = __importDefault(require("../base-wrapper"));
|
|
11
|
+
class QdrantWrapper extends base_wrapper_1.default {
|
|
12
|
+
static _setCommonAttributes(span, dbOperation, collectionName) {
|
|
13
|
+
const applicationName = config_1.default.applicationName || '';
|
|
14
|
+
const environment = config_1.default.environment || '';
|
|
15
|
+
span.setAttribute(semantic_convention_1.default.DB_SYSTEM_NAME, QdrantWrapper.dbSystem);
|
|
16
|
+
span.setAttribute(semantic_convention_1.default.DB_OPERATION_NAME, dbOperation);
|
|
17
|
+
span.setAttribute(semantic_convention_1.default.DB_COLLECTION_NAME, collectionName);
|
|
18
|
+
span.setAttribute(semantic_convention_1.default.SERVER_ADDRESS, QdrantWrapper.serverAddress);
|
|
19
|
+
span.setAttribute(semantic_convention_1.default.SERVER_PORT, QdrantWrapper.serverPort);
|
|
20
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_ENVIRONMENT, environment);
|
|
21
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_APPLICATION_NAME, applicationName);
|
|
22
|
+
}
|
|
23
|
+
static _patchSearch(tracer) {
|
|
24
|
+
const dbOperation = semantic_convention_1.default.DB_OPERATION_SEARCH;
|
|
25
|
+
return (originalMethod) => {
|
|
26
|
+
return async function (...args) {
|
|
27
|
+
// args[0] = collectionName, args[1] = searchParams
|
|
28
|
+
const collectionName = typeof args[0] === 'string' ? args[0] : 'unknown';
|
|
29
|
+
const params = args[1] || {};
|
|
30
|
+
const spanName = `${dbOperation} ${collectionName}`;
|
|
31
|
+
const span = tracer.startSpan(spanName, { kind: api_1.SpanKind.CLIENT });
|
|
32
|
+
const startTime = Date.now();
|
|
33
|
+
return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), async () => {
|
|
34
|
+
try {
|
|
35
|
+
const response = await originalMethod.apply(this, args);
|
|
36
|
+
const duration = (Date.now() - startTime) / 1000;
|
|
37
|
+
QdrantWrapper._setCommonAttributes(span, dbOperation, collectionName);
|
|
38
|
+
span.setAttribute(semantic_convention_1.default.DB_CLIENT_OPERATION_DURATION, duration);
|
|
39
|
+
span.setAttribute(semantic_convention_1.default.DB_VECTOR_QUERY_TOP_K, params.limit || 10);
|
|
40
|
+
if (params.filter) {
|
|
41
|
+
span.setAttribute(semantic_convention_1.default.DB_FILTER, JSON.stringify(params.filter));
|
|
42
|
+
}
|
|
43
|
+
if (params.with_payload !== undefined) {
|
|
44
|
+
span.setAttribute(semantic_convention_1.default.DB_WITH_PAYLOAD, String(params.with_payload));
|
|
45
|
+
}
|
|
46
|
+
const resultCount = Array.isArray(response) ? response.length : 0;
|
|
47
|
+
span.setAttribute(semantic_convention_1.default.DB_N_RESULTS, resultCount);
|
|
48
|
+
if (config_1.default.captureMessageContent && params.vector) {
|
|
49
|
+
const vectorPreview = Array.isArray(params.vector)
|
|
50
|
+
? JSON.stringify(params.vector.slice(0, 10))
|
|
51
|
+
: String(params.vector);
|
|
52
|
+
span.setAttribute(semantic_convention_1.default.DB_QUERY_TEXT, vectorPreview);
|
|
53
|
+
}
|
|
54
|
+
span.setAttribute(semantic_convention_1.default.DB_QUERY_SUMMARY, `${dbOperation} ${collectionName} limit=${params.limit || 10} filtered=${params.filter ? 'true' : 'false'}`);
|
|
55
|
+
span.setStatus({ code: 1 });
|
|
56
|
+
return response;
|
|
57
|
+
}
|
|
58
|
+
catch (e) {
|
|
59
|
+
helpers_1.default.handleException(span, e);
|
|
60
|
+
throw e;
|
|
61
|
+
}
|
|
62
|
+
finally {
|
|
63
|
+
span.end();
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
static _patchUpsert(tracer) {
|
|
70
|
+
const dbOperation = semantic_convention_1.default.DB_OPERATION_UPSERT;
|
|
71
|
+
return (originalMethod) => {
|
|
72
|
+
return async function (...args) {
|
|
73
|
+
const collectionName = typeof args[0] === 'string' ? args[0] : 'unknown';
|
|
74
|
+
const params = args[1] || {};
|
|
75
|
+
const spanName = `${dbOperation} ${collectionName}`;
|
|
76
|
+
const span = tracer.startSpan(spanName, { kind: api_1.SpanKind.CLIENT });
|
|
77
|
+
const startTime = Date.now();
|
|
78
|
+
return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), async () => {
|
|
79
|
+
try {
|
|
80
|
+
const response = await originalMethod.apply(this, args);
|
|
81
|
+
const duration = (Date.now() - startTime) / 1000;
|
|
82
|
+
const points = params.points || [];
|
|
83
|
+
QdrantWrapper._setCommonAttributes(span, dbOperation, collectionName);
|
|
84
|
+
span.setAttribute(semantic_convention_1.default.DB_CLIENT_OPERATION_DURATION, duration);
|
|
85
|
+
span.setAttribute(semantic_convention_1.default.DB_VECTOR_COUNT, points.length);
|
|
86
|
+
span.setAttribute(semantic_convention_1.default.DB_QUERY_SUMMARY, `${dbOperation} ${collectionName} points=${points.length}`);
|
|
87
|
+
span.setStatus({ code: 1 });
|
|
88
|
+
return response;
|
|
89
|
+
}
|
|
90
|
+
catch (e) {
|
|
91
|
+
helpers_1.default.handleException(span, e);
|
|
92
|
+
throw e;
|
|
93
|
+
}
|
|
94
|
+
finally {
|
|
95
|
+
span.end();
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
static _patchDelete(tracer) {
|
|
102
|
+
const dbOperation = semantic_convention_1.default.DB_OPERATION_DELETE;
|
|
103
|
+
return (originalMethod) => {
|
|
104
|
+
return async function (...args) {
|
|
105
|
+
const collectionName = typeof args[0] === 'string' ? args[0] : 'unknown';
|
|
106
|
+
const params = args[1] || {};
|
|
107
|
+
const spanName = `${dbOperation} ${collectionName}`;
|
|
108
|
+
const span = tracer.startSpan(spanName, { kind: api_1.SpanKind.CLIENT });
|
|
109
|
+
const startTime = Date.now();
|
|
110
|
+
return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), async () => {
|
|
111
|
+
try {
|
|
112
|
+
const response = await originalMethod.apply(this, args);
|
|
113
|
+
const duration = (Date.now() - startTime) / 1000;
|
|
114
|
+
QdrantWrapper._setCommonAttributes(span, dbOperation, collectionName);
|
|
115
|
+
span.setAttribute(semantic_convention_1.default.DB_CLIENT_OPERATION_DURATION, duration);
|
|
116
|
+
const points = params.points || [];
|
|
117
|
+
if (points.length > 0) {
|
|
118
|
+
span.setAttribute(semantic_convention_1.default.DB_ID_COUNT, points.length);
|
|
119
|
+
}
|
|
120
|
+
if (params.filter) {
|
|
121
|
+
span.setAttribute(semantic_convention_1.default.DB_FILTER, JSON.stringify(params.filter));
|
|
122
|
+
}
|
|
123
|
+
span.setAttribute(semantic_convention_1.default.DB_QUERY_SUMMARY, `${dbOperation} ${collectionName} points=${points.length}`);
|
|
124
|
+
span.setStatus({ code: 1 });
|
|
125
|
+
return response;
|
|
126
|
+
}
|
|
127
|
+
catch (e) {
|
|
128
|
+
helpers_1.default.handleException(span, e);
|
|
129
|
+
throw e;
|
|
130
|
+
}
|
|
131
|
+
finally {
|
|
132
|
+
span.end();
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
static _patchRetrieve(tracer) {
|
|
139
|
+
const dbOperation = semantic_convention_1.default.DB_OPERATION_GET;
|
|
140
|
+
return (originalMethod) => {
|
|
141
|
+
return async function (...args) {
|
|
142
|
+
const collectionName = typeof args[0] === 'string' ? args[0] : 'unknown';
|
|
143
|
+
const params = args[1] || {};
|
|
144
|
+
const spanName = `${dbOperation} ${collectionName}`;
|
|
145
|
+
const span = tracer.startSpan(spanName, { kind: api_1.SpanKind.CLIENT });
|
|
146
|
+
const startTime = Date.now();
|
|
147
|
+
return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), async () => {
|
|
148
|
+
try {
|
|
149
|
+
const response = await originalMethod.apply(this, args);
|
|
150
|
+
const duration = (Date.now() - startTime) / 1000;
|
|
151
|
+
QdrantWrapper._setCommonAttributes(span, dbOperation, collectionName);
|
|
152
|
+
span.setAttribute(semantic_convention_1.default.DB_CLIENT_OPERATION_DURATION, duration);
|
|
153
|
+
const ids = Array.isArray(params.ids) ? params.ids : [];
|
|
154
|
+
span.setAttribute(semantic_convention_1.default.DB_ID_COUNT, ids.length);
|
|
155
|
+
const resultCount = Array.isArray(response) ? response.length : 0;
|
|
156
|
+
span.setAttribute(semantic_convention_1.default.DB_RESPONSE_RETURNED_ROWS, resultCount);
|
|
157
|
+
span.setAttribute(semantic_convention_1.default.DB_QUERY_SUMMARY, `${dbOperation} ${collectionName} ids=${ids.length}`);
|
|
158
|
+
span.setStatus({ code: 1 });
|
|
159
|
+
return response;
|
|
160
|
+
}
|
|
161
|
+
catch (e) {
|
|
162
|
+
helpers_1.default.handleException(span, e);
|
|
163
|
+
throw e;
|
|
164
|
+
}
|
|
165
|
+
finally {
|
|
166
|
+
span.end();
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
static _patchScroll(tracer) {
|
|
173
|
+
const dbOperation = semantic_convention_1.default.DB_OPERATION_GET;
|
|
174
|
+
return (originalMethod) => {
|
|
175
|
+
return async function (...args) {
|
|
176
|
+
const collectionName = typeof args[0] === 'string' ? args[0] : 'unknown';
|
|
177
|
+
const params = args[1] || {};
|
|
178
|
+
const spanName = `${dbOperation} ${collectionName}`;
|
|
179
|
+
const span = tracer.startSpan(spanName, { kind: api_1.SpanKind.CLIENT });
|
|
180
|
+
const startTime = Date.now();
|
|
181
|
+
return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), async () => {
|
|
182
|
+
try {
|
|
183
|
+
const response = await originalMethod.apply(this, args);
|
|
184
|
+
const duration = (Date.now() - startTime) / 1000;
|
|
185
|
+
QdrantWrapper._setCommonAttributes(span, dbOperation, collectionName);
|
|
186
|
+
span.setAttribute(semantic_convention_1.default.DB_CLIENT_OPERATION_DURATION, duration);
|
|
187
|
+
span.setAttribute(semantic_convention_1.default.DB_QUERY_LIMIT, params.limit || 10);
|
|
188
|
+
if (params.filter) {
|
|
189
|
+
span.setAttribute(semantic_convention_1.default.DB_FILTER, JSON.stringify(params.filter));
|
|
190
|
+
}
|
|
191
|
+
const resultCount = response?.points?.length || 0;
|
|
192
|
+
span.setAttribute(semantic_convention_1.default.DB_RESPONSE_RETURNED_ROWS, resultCount);
|
|
193
|
+
span.setAttribute(semantic_convention_1.default.DB_QUERY_SUMMARY, `${dbOperation} ${collectionName} limit=${params.limit || 10}`);
|
|
194
|
+
span.setStatus({ code: 1 });
|
|
195
|
+
return response;
|
|
196
|
+
}
|
|
197
|
+
catch (e) {
|
|
198
|
+
helpers_1.default.handleException(span, e);
|
|
199
|
+
throw e;
|
|
200
|
+
}
|
|
201
|
+
finally {
|
|
202
|
+
span.end();
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
QdrantWrapper.dbSystem = semantic_convention_1.default.DB_SYSTEM_QDRANT;
|
|
210
|
+
QdrantWrapper.serverAddress = 'localhost';
|
|
211
|
+
QdrantWrapper.serverPort = 6333;
|
|
212
|
+
exports.default = QdrantWrapper;
|
|
213
|
+
//# sourceMappingURL=wrapper.js.map
|