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,219 @@
|
|
|
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 sdk_metrics_1 = require("@opentelemetry/sdk-metrics");
|
|
7
|
+
const api_1 = require("@opentelemetry/api");
|
|
8
|
+
const semantic_convention_1 = __importDefault(require("../semantic-convention"));
|
|
9
|
+
const exporter_metrics_otlp_http_1 = require("@opentelemetry/exporter-metrics-otlp-http");
|
|
10
|
+
const utils_1 = require("./utils");
|
|
11
|
+
const DB_CLIENT_OPERATION_DURATION_BUCKETS = [0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1, 5, 10];
|
|
12
|
+
const GEN_AI_CLIENT_OPERATION_DURATION_BUCKETS = [
|
|
13
|
+
0.01, 0.02, 0.04, 0.08, 0.16, 0.32, 0.64, 1.28, 2.56, 5.12, 10.24, 20.48, 40.96, 81.92,
|
|
14
|
+
];
|
|
15
|
+
const GEN_AI_SERVER_TBT = [0.01, 0.025, 0.05, 0.075, 0.1, 0.15, 0.2, 0.3, 0.4, 0.5, 0.75, 1.0, 2.5];
|
|
16
|
+
const GEN_AI_SERVER_TFTT = [
|
|
17
|
+
0.001, 0.005, 0.01, 0.02, 0.04, 0.06, 0.08, 0.1, 0.25, 0.5, 0.75, 1.0, 2.5, 5.0, 7.5, 10.0,
|
|
18
|
+
];
|
|
19
|
+
const GEN_AI_CLIENT_TOKEN_USAGE_BUCKETS = [
|
|
20
|
+
1, 4, 16, 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216, 67108864,
|
|
21
|
+
];
|
|
22
|
+
let METER_SET = false;
|
|
23
|
+
class Metrics {
|
|
24
|
+
static initializeMetrics() {
|
|
25
|
+
this.genaiClientUsageTokens = this.meter.createHistogram(semantic_convention_1.default.GEN_AI_CLIENT_TOKEN_USAGE, {
|
|
26
|
+
description: 'Measures number of input and output tokens used',
|
|
27
|
+
unit: '{token}',
|
|
28
|
+
advice: {
|
|
29
|
+
explicitBucketBoundaries: GEN_AI_CLIENT_TOKEN_USAGE_BUCKETS,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
this.genaiClientOperationDuration = this.meter.createHistogram(semantic_convention_1.default.GEN_AI_CLIENT_OPERATION_DURATION, {
|
|
33
|
+
description: 'GenAI operation duration',
|
|
34
|
+
unit: 's',
|
|
35
|
+
advice: {
|
|
36
|
+
explicitBucketBoundaries: GEN_AI_CLIENT_OPERATION_DURATION_BUCKETS,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
this.genaiServerTbt = this.meter.createHistogram(semantic_convention_1.default.GEN_AI_SERVER_TBT, {
|
|
40
|
+
description: 'Time per output token generated after the first token for successful responses',
|
|
41
|
+
unit: 's',
|
|
42
|
+
advice: {
|
|
43
|
+
explicitBucketBoundaries: GEN_AI_SERVER_TBT,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
this.genaiServerTtft = this.meter.createHistogram(semantic_convention_1.default.GEN_AI_SERVER_TTFT, {
|
|
47
|
+
description: 'Time to generate first token for successful responses',
|
|
48
|
+
unit: 's',
|
|
49
|
+
advice: {
|
|
50
|
+
explicitBucketBoundaries: GEN_AI_SERVER_TFTT,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
this.genaiClientTimeToFirstChunk = this.meter.createHistogram(semantic_convention_1.default.GEN_AI_CLIENT_OPERATION_TIME_TO_FIRST_CHUNK, {
|
|
54
|
+
description: 'Time from client request to first response chunk',
|
|
55
|
+
unit: 's',
|
|
56
|
+
advice: {
|
|
57
|
+
explicitBucketBoundaries: GEN_AI_CLIENT_OPERATION_DURATION_BUCKETS,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
this.genaiClientTimePerOutputChunk = this.meter.createHistogram(semantic_convention_1.default.GEN_AI_CLIENT_OPERATION_TIME_PER_OUTPUT_CHUNK, {
|
|
61
|
+
description: 'Time between consecutive response chunks from client perspective',
|
|
62
|
+
unit: 's',
|
|
63
|
+
advice: {
|
|
64
|
+
explicitBucketBoundaries: GEN_AI_CLIENT_OPERATION_DURATION_BUCKETS,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
this.genaiServerRequestDuration = this.meter.createHistogram(semantic_convention_1.default.GEN_AI_SERVER_REQUEST_DURATION, {
|
|
68
|
+
description: 'Total server-side processing time from request receipt to response transmission',
|
|
69
|
+
unit: 's',
|
|
70
|
+
advice: {
|
|
71
|
+
explicitBucketBoundaries: GEN_AI_CLIENT_OPERATION_DURATION_BUCKETS,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
this.dbClientOperationDuration = this.meter.createHistogram(semantic_convention_1.default.DB_CLIENT_OPERATION_DURATION, {
|
|
75
|
+
description: 'DB operation duration',
|
|
76
|
+
unit: 's',
|
|
77
|
+
advice: {
|
|
78
|
+
explicitBucketBoundaries: DB_CLIENT_OPERATION_DURATION_BUCKETS,
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
this.genaiCost = this.meter.createHistogram(semantic_convention_1.default.GEN_AI_USAGE_COST, {
|
|
82
|
+
description: 'The distribution of GenAI request costs.',
|
|
83
|
+
unit: 'USD',
|
|
84
|
+
});
|
|
85
|
+
this.dbRequests = this.meter.createCounter(semantic_convention_1.default.DB_REQUESTS, {
|
|
86
|
+
description: 'Number of requests to VectorDBs.',
|
|
87
|
+
unit: '1',
|
|
88
|
+
});
|
|
89
|
+
this.guardRequests = this.meter.createCounter(semantic_convention_1.default.GUARD_REQUESTS_COUNTER, {
|
|
90
|
+
description: 'Number of guard evaluations.',
|
|
91
|
+
unit: '1',
|
|
92
|
+
});
|
|
93
|
+
// MCP metrics
|
|
94
|
+
this.mcpRequests = this.meter.createCounter(semantic_convention_1.default.MCP_REQUESTS, {
|
|
95
|
+
description: 'Number of MCP requests.',
|
|
96
|
+
unit: '1',
|
|
97
|
+
});
|
|
98
|
+
this.mcpClientOperationDuration = this.meter.createHistogram(semantic_convention_1.default.MCP_CLIENT_OPERATION_DURATION_METRIC, {
|
|
99
|
+
description: 'MCP client operation duration',
|
|
100
|
+
unit: 's',
|
|
101
|
+
advice: {
|
|
102
|
+
explicitBucketBoundaries: GEN_AI_CLIENT_OPERATION_DURATION_BUCKETS,
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
this.mcpRequestSize = this.meter.createHistogram(semantic_convention_1.default.MCP_REQUEST_SIZE, {
|
|
106
|
+
description: 'MCP request payload size in bytes',
|
|
107
|
+
unit: 'By',
|
|
108
|
+
});
|
|
109
|
+
this.mcpResponseSize = this.meter.createHistogram(semantic_convention_1.default.MCP_RESPONSE_SIZE_METRIC, {
|
|
110
|
+
description: 'MCP response payload size in bytes',
|
|
111
|
+
unit: 'By',
|
|
112
|
+
});
|
|
113
|
+
this.mcpToolCalls = this.meter.createCounter(semantic_convention_1.default.MCP_TOOL_CALLS, {
|
|
114
|
+
description: 'Number of MCP tool calls.',
|
|
115
|
+
unit: '1',
|
|
116
|
+
});
|
|
117
|
+
this.mcpResourceReads = this.meter.createCounter(semantic_convention_1.default.MCP_RESOURCE_READS, {
|
|
118
|
+
description: 'Number of MCP resource reads.',
|
|
119
|
+
unit: '1',
|
|
120
|
+
});
|
|
121
|
+
this.mcpPromptGets = this.meter.createCounter(semantic_convention_1.default.MCP_PROMPT_GETS, {
|
|
122
|
+
description: 'Number of MCP prompt gets.',
|
|
123
|
+
unit: '1',
|
|
124
|
+
});
|
|
125
|
+
this.mcpTransportUsage = this.meter.createCounter(semantic_convention_1.default.MCP_TRANSPORT_USAGE, {
|
|
126
|
+
description: 'Number of MCP transport operations.',
|
|
127
|
+
unit: '1',
|
|
128
|
+
});
|
|
129
|
+
this.mcpErrors = this.meter.createCounter(semantic_convention_1.default.MCP_ERRORS, {
|
|
130
|
+
description: 'Number of MCP errors.',
|
|
131
|
+
unit: '1',
|
|
132
|
+
});
|
|
133
|
+
this.mcpOperationSuccessRate = this.meter.createHistogram(semantic_convention_1.default.MCP_OPERATION_SUCCESS_RATE, {
|
|
134
|
+
description: 'MCP operation success rate (0.0 = failure, 1.0 = success)',
|
|
135
|
+
unit: '1',
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
static setup(options) {
|
|
139
|
+
if (options.meter) {
|
|
140
|
+
this.meter = options.meter;
|
|
141
|
+
this.initializeMetrics();
|
|
142
|
+
return this.meter;
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
if (!METER_SET) {
|
|
146
|
+
const existingProvider = api_1.metrics.getMeterProvider();
|
|
147
|
+
const isSDKProvider = existingProvider &&
|
|
148
|
+
typeof existingProvider.getMeter === 'function' &&
|
|
149
|
+
existingProvider.constructor.name !== 'NoopMeterProvider';
|
|
150
|
+
if (isSDKProvider) {
|
|
151
|
+
this.meterProvider = existingProvider;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
const readers = Metrics.buildMetricReaders(options);
|
|
155
|
+
this.meterProvider = new sdk_metrics_1.MeterProvider({
|
|
156
|
+
resource: options.resource,
|
|
157
|
+
readers,
|
|
158
|
+
});
|
|
159
|
+
api_1.metrics.setGlobalMeterProvider(this.meterProvider);
|
|
160
|
+
this.metricReaders.push(...readers);
|
|
161
|
+
}
|
|
162
|
+
this.meter = this.meterProvider.getMeter('shield360', '1.0.0');
|
|
163
|
+
this.initializeMetrics();
|
|
164
|
+
METER_SET = true;
|
|
165
|
+
}
|
|
166
|
+
return this.meter;
|
|
167
|
+
}
|
|
168
|
+
catch (e) {
|
|
169
|
+
console.error('[Metrics] Failed to initialize metrics:', e);
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
static buildMetricReaders(options) {
|
|
174
|
+
const readers = [];
|
|
175
|
+
const exporterList = (0, utils_1.parseExporters)('OTEL_METRICS_EXPORTER');
|
|
176
|
+
if (exporterList) {
|
|
177
|
+
for (const name of exporterList) {
|
|
178
|
+
if (name === 'otlp') {
|
|
179
|
+
readers.push(Metrics.createOTLPReader(options));
|
|
180
|
+
}
|
|
181
|
+
else if (name === 'console') {
|
|
182
|
+
readers.push(Metrics.createConsoleReader(options));
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
if (options.otlpEndpoint) {
|
|
188
|
+
readers.push(Metrics.createOTLPReader(options));
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
readers.push(Metrics.createConsoleReader(options));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return readers;
|
|
195
|
+
}
|
|
196
|
+
static createOTLPReader(options) {
|
|
197
|
+
const url = (options.otlpEndpoint || '') + '/v1/metrics';
|
|
198
|
+
const exporter = new exporter_metrics_otlp_http_1.OTLPMetricExporter({
|
|
199
|
+
url,
|
|
200
|
+
headers: options.otlpHeaders,
|
|
201
|
+
});
|
|
202
|
+
return new sdk_metrics_1.PeriodicExportingMetricReader({
|
|
203
|
+
exportIntervalMillis: options.exportIntervalMillis || 60000,
|
|
204
|
+
exporter,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
static createConsoleReader(options) {
|
|
208
|
+
return new sdk_metrics_1.PeriodicExportingMetricReader({
|
|
209
|
+
exportIntervalMillis: options.exportIntervalMillis || 60000,
|
|
210
|
+
exporter: new sdk_metrics_1.ConsoleMetricExporter(),
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
static resetForTesting() {
|
|
214
|
+
METER_SET = false;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
Metrics.metricReaders = [];
|
|
218
|
+
exports.default = Metrics;
|
|
219
|
+
//# sourceMappingURL=metrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/otel/metrics.ts"],"names":[],"mappings":";;;;;AAAA,4DAIoC;AACpC,4CAA6C;AAC7C,iFAAwD;AAExD,0FAA+E;AAC/E,mCAAyC;AAEzC,MAAM,oCAAoC,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AAE5F,MAAM,wCAAwC,GAAG;IAC/C,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;CACvF,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,E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TLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
4
|
+
export default class Tracing {
|
|
5
|
+
static traceProvider: NodeTracerProvider;
|
|
6
|
+
static traceExporter: OTLPTraceExporter | undefined;
|
|
7
|
+
static setup(options: SetupTracerOptions): NodeTracerProvider | import("@opentelemetry/api").Tracer | null;
|
|
8
|
+
private static buildSpanProcessors;
|
|
9
|
+
private static createOTLPExporter;
|
|
10
|
+
private static wrapProcessor;
|
|
11
|
+
static resetForTesting(): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
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 sdk_trace_node_1 = require("@opentelemetry/sdk-trace-node");
|
|
8
|
+
const exporter_trace_otlp_http_1 = require("@opentelemetry/exporter-trace-otlp-http");
|
|
9
|
+
const instrumentation_1 = __importDefault(require("../instrumentation"));
|
|
10
|
+
const config_1 = __importDefault(require("../config"));
|
|
11
|
+
const utils_1 = require("./utils");
|
|
12
|
+
let TRACER_SET = false;
|
|
13
|
+
class Tracing {
|
|
14
|
+
static setup(options) {
|
|
15
|
+
if (options.tracer)
|
|
16
|
+
return options.tracer;
|
|
17
|
+
try {
|
|
18
|
+
if (!TRACER_SET) {
|
|
19
|
+
const existingProvider = api_1.trace.getTracerProvider();
|
|
20
|
+
const isSDKProvider = existingProvider &&
|
|
21
|
+
typeof existingProvider.addSpanProcessor === 'function';
|
|
22
|
+
if (isSDKProvider) {
|
|
23
|
+
// Reuse existing SDK TracerProvider
|
|
24
|
+
this.traceProvider = existingProvider;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
const spanProcessors = Tracing.buildSpanProcessors(options);
|
|
28
|
+
this.traceProvider = new sdk_trace_node_1.NodeTracerProvider({
|
|
29
|
+
resource: options.resource,
|
|
30
|
+
spanProcessors,
|
|
31
|
+
});
|
|
32
|
+
this.traceProvider.register();
|
|
33
|
+
}
|
|
34
|
+
config_1.default.updateConfig({
|
|
35
|
+
...options,
|
|
36
|
+
tracer: options.tracer || Tracing.traceProvider,
|
|
37
|
+
});
|
|
38
|
+
instrumentation_1.default.setup(Tracing.traceProvider, options?.disabledInstrumentors, options?.instrumentations);
|
|
39
|
+
TRACER_SET = true;
|
|
40
|
+
}
|
|
41
|
+
return api_1.trace.getTracer('shield360');
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
console.error('[Traces] Failed to initialize traces:', e);
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
static buildSpanProcessors(options) {
|
|
49
|
+
const processors = [];
|
|
50
|
+
const exporterList = (0, utils_1.parseExporters)('OTEL_TRACES_EXPORTER');
|
|
51
|
+
if (exporterList) {
|
|
52
|
+
for (const name of exporterList) {
|
|
53
|
+
if (name === 'otlp') {
|
|
54
|
+
const exporter = Tracing.createOTLPExporter(options);
|
|
55
|
+
this.traceExporter = exporter;
|
|
56
|
+
processors.push(Tracing.wrapProcessor(exporter, options.disableBatch));
|
|
57
|
+
}
|
|
58
|
+
else if (name === 'console') {
|
|
59
|
+
processors.push(new sdk_trace_node_1.SimpleSpanProcessor(new sdk_trace_node_1.ConsoleSpanExporter()));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
// Default: OTLP if endpoint is set, otherwise Console
|
|
65
|
+
if (options.otlpEndpoint) {
|
|
66
|
+
const exporter = Tracing.createOTLPExporter(options);
|
|
67
|
+
this.traceExporter = exporter;
|
|
68
|
+
processors.push(Tracing.wrapProcessor(exporter, options.disableBatch));
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
processors.push(new sdk_trace_node_1.SimpleSpanProcessor(new sdk_trace_node_1.ConsoleSpanExporter()));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return processors;
|
|
75
|
+
}
|
|
76
|
+
static createOTLPExporter(options) {
|
|
77
|
+
const url = (options.otlpEndpoint || '') + '/v1/traces';
|
|
78
|
+
return new exporter_trace_otlp_http_1.OTLPTraceExporter({
|
|
79
|
+
url,
|
|
80
|
+
headers: options.otlpHeaders,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
static wrapProcessor(exporter, disableBatch) {
|
|
84
|
+
return disableBatch
|
|
85
|
+
? new sdk_trace_node_1.SimpleSpanProcessor(exporter)
|
|
86
|
+
: new sdk_trace_node_1.BatchSpanProcessor(exporter);
|
|
87
|
+
}
|
|
88
|
+
static resetForTesting() {
|
|
89
|
+
TRACER_SET = false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.default = Tracing;
|
|
93
|
+
//# sourceMappingURL=tracing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../src/otel/tracing.ts"],"names":[],"mappings":";;;;;AAAA,4CAA2C;AAE3C,kEAMuC;AACvC,sFAA4E;AAE5E,yEAAkD;AAClD,uDAAwC;AACxC,mCAAyC;AAEzC,IAAI,UAAU,GAAG,KAAK,CAAC;AAEvB,MAAqB,OAAO;IAI1B,MAAM,CAAC,KAAK,CAAC,OAA2B;QACtC,IAAI,OAAO,CAAC,MAAM;YAAE,OAAO,OAAO,CAAC,MAAM,CAAC;QAE1C,IAAI,CAAC;YACH,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,MAAM,gBAAgB,GAAG,WAAK,CAAC,iBAAiB,EAAE,CAAC;gBACnD,MAAM,aAAa,GACjB,gBAAgB;oBAChB,OAAQ,gBAAwB,CAAC,gBAAgB,KAAK,UAAU,CAAC;gBAEnE,IAAI,aAAa,EAAE,CAAC;oBAClB,oCAAoC;oBACpC,IAAI,CAAC,aAAa,GAAG,gBAAiD,CAAC;g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/**
|
|
2
|
+
* Parse a comma-separated OTel exporter env var into an array of exporter names.
|
|
3
|
+
* Returns null if the env var is not set (caller uses default logic).
|
|
4
|
+
* Matches Python's parse_exporters() in __helpers.py.
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseExporters(envVarName: string): string[] | null;
|
|
7
|
+
/**
|
|
8
|
+
* Parse a boolean-like env var (true/1/yes -> true, false/0/no -> false).
|
|
9
|
+
* Returns undefined if the env var is not set.
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseBoolEnv(envVarName: string): boolean | undefined;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseExporters = parseExporters;
|
|
4
|
+
exports.parseBoolEnv = parseBoolEnv;
|
|
5
|
+
/**
|
|
6
|
+
* Parse a comma-separated OTel exporter env var into an array of exporter names.
|
|
7
|
+
* Returns null if the env var is not set (caller uses default logic).
|
|
8
|
+
* Matches Python's parse_exporters() in __helpers.py.
|
|
9
|
+
*/
|
|
10
|
+
function parseExporters(envVarName) {
|
|
11
|
+
const val = process.env[envVarName];
|
|
12
|
+
if (!val)
|
|
13
|
+
return null;
|
|
14
|
+
return val
|
|
15
|
+
.split(',')
|
|
16
|
+
.map((e) => e.trim().toLowerCase())
|
|
17
|
+
.filter(Boolean);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Parse a boolean-like env var (true/1/yes -> true, false/0/no -> false).
|
|
21
|
+
* Returns undefined if the env var is not set.
|
|
22
|
+
*/
|
|
23
|
+
function parseBoolEnv(envVarName) {
|
|
24
|
+
const val = process.env[envVarName];
|
|
25
|
+
if (val === undefined || val === '')
|
|
26
|
+
return undefined;
|
|
27
|
+
const lower = val.trim().toLowerCase();
|
|
28
|
+
if (['true', '1', 'yes'].includes(lower))
|
|
29
|
+
return true;
|
|
30
|
+
if (['false', '0', 'no'].includes(lower))
|
|
31
|
+
return false;
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/otel/utils.ts"],"names":[],"mappings":";;AAKA,wCAOC;AAMD,oCAOC;AAzBD;;;;GAIG;AACH,SAAgB,cAAc,CAAC,UAAkB;IAC/C,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACpC,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACtB,OAAO,GAAG;SACP,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;SAClC,MAAM,CAAC,OAAO,CAAC,CAAC;AACrB,CAAC;AAED;;;GAGG;AACH,SAAgB,YAAY,CAAC,UAAkB;IAC7C,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACpC,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IACtD,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACvC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACtD,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACvD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|