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,139 @@
|
|
|
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 config_1 = __importDefault(require("../config"));
|
|
7
|
+
const constant_1 = require("../constant");
|
|
8
|
+
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
|
|
9
|
+
const semantic_convention_1 = __importDefault(require("../semantic-convention"));
|
|
10
|
+
const api_1 = require("@opentelemetry/api");
|
|
11
|
+
const metrics_1 = __importDefault(require("../otel/metrics"));
|
|
12
|
+
const helpers_1 = require("../helpers");
|
|
13
|
+
class BaseWrapper {
|
|
14
|
+
static setBaseSpanAttributes(span, { genAIEndpoint: _genAIEndpoint, model, user, cost, aiSystem, serverAddress, serverPort }) {
|
|
15
|
+
const applicationName = config_1.default.applicationName;
|
|
16
|
+
const environment = config_1.default.environment;
|
|
17
|
+
if (!applicationName) {
|
|
18
|
+
throw new Error("[Shield360] Shield360Config.applicationName is not set. Please check your configuration.");
|
|
19
|
+
}
|
|
20
|
+
if (!environment) {
|
|
21
|
+
throw new Error("[Shield360] Shield360Config.environment is not set. Please check your configuration.");
|
|
22
|
+
}
|
|
23
|
+
span.setAttribute(semantic_conventions_1.ATTR_TELEMETRY_SDK_NAME, constant_1.SDK_NAME);
|
|
24
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_PROVIDER_NAME_OTEL, aiSystem);
|
|
25
|
+
span.setAttribute(semantic_convention_1.default.ATTR_DEPLOYMENT_ENVIRONMENT, environment);
|
|
26
|
+
span.setAttribute(semantic_conventions_1.ATTR_SERVICE_NAME, applicationName);
|
|
27
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_REQUEST_MODEL, model);
|
|
28
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_SDK_VERSION, constant_1.SDK_VERSION);
|
|
29
|
+
if (serverAddress) {
|
|
30
|
+
span.setAttribute(semantic_convention_1.default.SERVER_ADDRESS, serverAddress);
|
|
31
|
+
}
|
|
32
|
+
if (serverPort !== undefined) {
|
|
33
|
+
span.setAttribute(semantic_convention_1.default.SERVER_PORT, serverPort);
|
|
34
|
+
}
|
|
35
|
+
if (typeof user === 'string' || typeof user === 'number') {
|
|
36
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_REQUEST_USER, user);
|
|
37
|
+
}
|
|
38
|
+
if (cost !== undefined) {
|
|
39
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_USAGE_COST, cost);
|
|
40
|
+
}
|
|
41
|
+
(0, helpers_1.applyCustomSpanAttributes)(span);
|
|
42
|
+
span.setStatus({ code: api_1.SpanStatusCode.OK });
|
|
43
|
+
}
|
|
44
|
+
static recordMetrics(span, baseAttributes) {
|
|
45
|
+
const applicationName = config_1.default.applicationName;
|
|
46
|
+
const environment = config_1.default.environment;
|
|
47
|
+
const { model, aiSystem, cost, errorType } = baseAttributes;
|
|
48
|
+
const inputTokens = BaseWrapper.getSpanAttribute(span, semantic_convention_1.default.GEN_AI_USAGE_INPUT_TOKENS);
|
|
49
|
+
const outputTokens = BaseWrapper.getSpanAttribute(span, semantic_convention_1.default.GEN_AI_USAGE_OUTPUT_TOKENS);
|
|
50
|
+
const duration = BaseWrapper.getSpanAttribute(span, 'duration') ?? BaseWrapper.getSpanAttribute(span, semantic_convention_1.default.GEN_AI_DURATION_LEGACY);
|
|
51
|
+
const operationName = BaseWrapper.getSpanAttribute(span, semantic_convention_1.default.GEN_AI_OPERATION);
|
|
52
|
+
const responseModel = BaseWrapper.getSpanAttribute(span, semantic_convention_1.default.GEN_AI_RESPONSE_MODEL);
|
|
53
|
+
const serverAddress = BaseWrapper.getSpanAttribute(span, semantic_convention_1.default.SERVER_ADDRESS);
|
|
54
|
+
const serverPort = BaseWrapper.getSpanAttribute(span, semantic_convention_1.default.SERVER_PORT);
|
|
55
|
+
const attributes = {
|
|
56
|
+
[semantic_conventions_1.ATTR_TELEMETRY_SDK_NAME]: constant_1.SDK_NAME,
|
|
57
|
+
[semantic_conventions_1.ATTR_SERVICE_NAME]: applicationName,
|
|
58
|
+
[semantic_convention_1.default.ATTR_DEPLOYMENT_ENVIRONMENT]: environment,
|
|
59
|
+
[semantic_convention_1.default.GEN_AI_PROVIDER_NAME_OTEL]: aiSystem,
|
|
60
|
+
[semantic_convention_1.default.GEN_AI_REQUEST_MODEL]: model,
|
|
61
|
+
};
|
|
62
|
+
if (operationName)
|
|
63
|
+
attributes[semantic_convention_1.default.GEN_AI_OPERATION] = operationName;
|
|
64
|
+
if (responseModel)
|
|
65
|
+
attributes[semantic_convention_1.default.GEN_AI_RESPONSE_MODEL] = responseModel;
|
|
66
|
+
if (serverAddress)
|
|
67
|
+
attributes[semantic_convention_1.default.SERVER_ADDRESS] = serverAddress;
|
|
68
|
+
if (serverPort !== undefined)
|
|
69
|
+
attributes[semantic_convention_1.default.SERVER_PORT] = serverPort;
|
|
70
|
+
if (errorType)
|
|
71
|
+
attributes[semantic_convention_1.default.ERROR_TYPE] = errorType;
|
|
72
|
+
if (Number.isFinite(inputTokens)) {
|
|
73
|
+
metrics_1.default.genaiClientUsageTokens?.record(inputTokens, {
|
|
74
|
+
...attributes,
|
|
75
|
+
[semantic_convention_1.default.GEN_AI_TOKEN_TYPE]: semantic_convention_1.default.GEN_AI_TOKEN_TYPE_INPUT,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
if (Number.isFinite(outputTokens)) {
|
|
79
|
+
metrics_1.default.genaiClientUsageTokens?.record(outputTokens, {
|
|
80
|
+
...attributes,
|
|
81
|
+
[semantic_convention_1.default.GEN_AI_TOKEN_TYPE]: semantic_convention_1.default.GEN_AI_TOKEN_TYPE_OUTPUT,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
if (Number.isFinite(duration)) {
|
|
85
|
+
metrics_1.default.genaiClientOperationDuration?.record(duration / 1e9, attributes);
|
|
86
|
+
}
|
|
87
|
+
const tbt = BaseWrapper.getSpanAttribute(span, semantic_convention_1.default.GEN_AI_SERVER_TBT);
|
|
88
|
+
if (Number.isFinite(tbt))
|
|
89
|
+
metrics_1.default.genaiServerTbt?.record(tbt, attributes);
|
|
90
|
+
const ttft = BaseWrapper.getSpanAttribute(span, semantic_convention_1.default.GEN_AI_SERVER_TTFT);
|
|
91
|
+
if (Number.isFinite(ttft))
|
|
92
|
+
metrics_1.default.genaiServerTtft?.record(ttft, attributes);
|
|
93
|
+
if (Number.isFinite(ttft) && ttft > 0) {
|
|
94
|
+
metrics_1.default.genaiClientTimeToFirstChunk?.record(ttft, attributes);
|
|
95
|
+
}
|
|
96
|
+
if (Number.isFinite(tbt) && tbt > 0) {
|
|
97
|
+
metrics_1.default.genaiClientTimePerOutputChunk?.record(tbt, attributes);
|
|
98
|
+
const outputTokensVal = Number.isFinite(outputTokens) ? outputTokens : 0;
|
|
99
|
+
const serverRequestDuration = ttft + tbt * Math.max(outputTokensVal - 1, 0);
|
|
100
|
+
metrics_1.default.genaiServerRequestDuration?.record(serverRequestDuration, attributes);
|
|
101
|
+
}
|
|
102
|
+
if (cost !== undefined) {
|
|
103
|
+
const numericCost = typeof cost === 'number' ? cost : Number(cost);
|
|
104
|
+
if (Number.isFinite(numericCost)) {
|
|
105
|
+
metrics_1.default.genaiCost?.record(numericCost, attributes);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
static getSpanAttribute(span, key) {
|
|
110
|
+
if (key === 'duration') {
|
|
111
|
+
// Use duration if present, even if 0
|
|
112
|
+
const s = span;
|
|
113
|
+
if (s.attributes && typeof s.attributes.duration !== 'undefined') {
|
|
114
|
+
const attrDuration = s.attributes.duration;
|
|
115
|
+
if (typeof attrDuration === 'number' && !isNaN(attrDuration)) {
|
|
116
|
+
return attrDuration;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (typeof s.duration === 'number' && !isNaN(s.duration))
|
|
120
|
+
return s.duration;
|
|
121
|
+
if (typeof s._duration === 'number' && !isNaN(s._duration))
|
|
122
|
+
return s._duration;
|
|
123
|
+
if (s.endTime && s.startTime) {
|
|
124
|
+
const [endSec, endNano] = s.endTime;
|
|
125
|
+
const [startSec, startNano] = s.startTime;
|
|
126
|
+
const end = endSec * 1e9 + endNano;
|
|
127
|
+
const start = startSec * 1e9 + startNano;
|
|
128
|
+
if (end > start) {
|
|
129
|
+
return end - start;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
// @ts-expect-error: OpenTelemetry Span may have attributes property in some implementations
|
|
135
|
+
return typeof span.attributes === 'object' ? span.attributes[key] : undefined;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
exports.default = BaseWrapper;
|
|
139
|
+
//# sourceM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5E,IAAI,OAAO,CAAC,CAAC,SAAS,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;gBAAE,OAAO,CAAC,CAAC,SAAS,CAAC;YAE/E,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;gBAC7B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;gBACpC,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC;gBAC1C,MAAM,GAAG,GAAG,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC;gBACnC,MAAM,KAAK,GAAG,QAAQ,GAAG,GAAG,GAAG,SAAS,CAAC;gBACzC,IAAI,GAAG,GAAG,KAAK,EAAE,CAAC;oBAChB,OAAO,GAAG,GAAG,KAAK,CAAC;gBACrB,CAAC;YACH,CAAC;YACD,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,4FAA4F;QAC5F,OAAO,OAAO,IAAI,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAChF,CAAC;CACF;AAtID,8BAsIC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { InstrumentationBase, InstrumentationModuleDefinition } from '@opentelemetry/instrumentation';
|
|
2
|
+
import { InstrumentationConfig } from '@opentelemetry/instrumentation';
|
|
3
|
+
export interface BedrockInstrumentationConfig extends InstrumentationConfig {
|
|
4
|
+
}
|
|
5
|
+
export default class Shield360BedrockInstrumentation extends InstrumentationBase {
|
|
6
|
+
constructor(config?: BedrockInstrumentationConfig);
|
|
7
|
+
protected init(): void | InstrumentationModuleDefinition | InstrumentationModuleDefinition[];
|
|
8
|
+
manualPatch(bedrock: any): void;
|
|
9
|
+
protected _patch(moduleExports: any): void;
|
|
10
|
+
protected _unpatch(moduleExports: any): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
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 Shield360BedrockInstrumentation extends instrumentation_1.InstrumentationBase {
|
|
10
|
+
constructor(config = {}) {
|
|
11
|
+
super(`${constant_1.INSTRUMENTATION_PREFIX}/instrumentation-bedrock`, '1.0.0', config);
|
|
12
|
+
}
|
|
13
|
+
init() {
|
|
14
|
+
const module = new instrumentation_1.InstrumentationNodeModuleDefinition('@aws-sdk/client-bedrock-runtime', ['>=3.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(bedrock) {
|
|
25
|
+
this._patch(bedrock);
|
|
26
|
+
}
|
|
27
|
+
_patch(moduleExports) {
|
|
28
|
+
try {
|
|
29
|
+
const BedrockRuntimeClient = moduleExports.BedrockRuntimeClient;
|
|
30
|
+
if (!BedrockRuntimeClient?.prototype)
|
|
31
|
+
return;
|
|
32
|
+
if ((0, instrumentation_1.isWrapped)(BedrockRuntimeClient.prototype.send)) {
|
|
33
|
+
this._unwrap(BedrockRuntimeClient.prototype, 'send');
|
|
34
|
+
}
|
|
35
|
+
this._wrap(BedrockRuntimeClient.prototype, 'send', wrapper_1.default._patchSend(this.tracer));
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
console.error('Error in Bedrock _patch method:', e);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
_unpatch(moduleExports) {
|
|
42
|
+
try {
|
|
43
|
+
const BedrockRuntimeClient = moduleExports.BedrockRuntimeClient;
|
|
44
|
+
if (BedrockRuntimeClient?.prototype?.send) {
|
|
45
|
+
this._unwrap(BedrockRuntimeClient.prototype, 'send');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch { /* ignore */ }
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.default = Shield360BedrockInstrumentation;
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/instrumentation/bedrock/index.ts"],"names":[],"mappings":";;;;;AAAA,oEAKwC;AAExC,6CAAwD;AACxD,wDAAuC;AAIvC,MAAqB,+BAAgC,SAAQ,qCAAmB;IAC9E,YAAY,SAAuC,EAAE;QACnD,KAAK,CAAC,GAAG,iCAAsB,0BAA0B,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC9E,CAAC;IAES,IAAI;QACZ,MAAM,MAAM,GAAG,IAAI,qDAAmC,CACpD,iCAAiC,EACjC,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;IAClB,CAAC;IAEM,WAAW,CAAC,OAAY;QAC7B,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IAES,MAAM,CAAC,aAAkB;QACjC,IAAI,CAAC;YACH,MAAM,oBAAoB,GAAG,aAAa,CAAC,oBAAoB,CAAC;YAChE,IAAI,CAAC,oBAAoB,EAAE,SAAS;gBAAE,OAAO;YAE7C,IAAI,IAAA,2BAAS,EAAC,oBAAoB,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;gBACnD,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;YACvD,CAAC;YAED,IAAI,CAAC,KAAK,CACR,oBAAoB,CAAC,SAAS,EAC9B,MAAM,EACN,iBAAc,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CACvC,CAAC;QACJ,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,CAAC,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;IAES,QAAQ,CAAC,aAAkB;QACnC,IAAI,CAAC;YACH,MAAM,oBAAoB,GAAG,aAAa,CAAC,oBAAoB,CAAC;YAChE,IAAI,oBAAoB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;gBAC1C,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;YACvD,CAAC;QACH,CAAC;QAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;IAC1B,CAAC;CACF;AArDD,kDAqDC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Span, Tracer } from '@opentelemetry/api';
|
|
2
|
+
import BaseWrapper, { BaseSpanAttributes } from '../base-wrapper';
|
|
3
|
+
declare class BedrockWrapper extends BaseWrapper {
|
|
4
|
+
static aiSystem: string;
|
|
5
|
+
static serverAddress: string;
|
|
6
|
+
static serverPort: number;
|
|
7
|
+
/**
|
|
8
|
+
* Stamp `shield360.agent.version_hash` (auto) and `gen_ai.agent.version`
|
|
9
|
+
* (user override, if set) on the span and return the same attributes so
|
|
10
|
+
* the caller can merge them into the inference event extras.
|
|
11
|
+
*/
|
|
12
|
+
static _stampAgentVersion(span: Span, args: {
|
|
13
|
+
systemInstructionsJson?: string;
|
|
14
|
+
toolDefinitionsJson?: string;
|
|
15
|
+
primaryModel?: string;
|
|
16
|
+
temperature?: number | null;
|
|
17
|
+
top_p?: number | null;
|
|
18
|
+
max_tokens?: number | null;
|
|
19
|
+
}): Record<string, string>;
|
|
20
|
+
static _patchSend(tracer: Tracer): any;
|
|
21
|
+
static _handleConverseCommand(tracer: Tracer, originalMethod: any, instance: any, args: any[]): Promise<any>;
|
|
22
|
+
static _converseComplete({ input, genAIEndpoint, response, span, modelId, }: {
|
|
23
|
+
input: any;
|
|
24
|
+
genAIEndpoint: string;
|
|
25
|
+
response: any;
|
|
26
|
+
span: Span;
|
|
27
|
+
modelId: string;
|
|
28
|
+
}): Promise<any>;
|
|
29
|
+
static _handleConverseStreamCommand(tracer: Tracer, originalMethod: any, instance: any, args: any[]): Promise<any>;
|
|
30
|
+
static _converseCommonSetter({ input, genAIEndpoint, result, span, modelId, isStream, ttft, tbt, }: {
|
|
31
|
+
input: any;
|
|
32
|
+
genAIEndpoint: string;
|
|
33
|
+
result: any;
|
|
34
|
+
span: Span;
|
|
35
|
+
modelId: string;
|
|
36
|
+
isStream: boolean;
|
|
37
|
+
ttft?: number;
|
|
38
|
+
tbt?: number;
|
|
39
|
+
}): BaseSpanAttributes;
|
|
40
|
+
}
|
|
41
|
+
export default BedrockWrapper;
|