Rocky_Mountain_Vending/.pnpm-store/v10/files/d7/0098f8ab5d770d1dd94c2ef857dc45da6e0dcbe8a5803f851bf12a8f4470c13a8f6a4fafc6d2cd0eda8b22f52bcc63cc94691bc2c11ec4d0754b923586bdc2
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

65 lines
1.6 KiB
Text

import { OPENAI_OPERATIONS } from '../gen-ai-attributes.js';
import { INSTRUMENTED_METHODS } from './constants.js';
/**
* Maps OpenAI method paths to Sentry operation names
*/
function getOperationName(methodPath) {
if (methodPath.includes('chat.completions')) {
return OPENAI_OPERATIONS.CHAT;
}
if (methodPath.includes('responses')) {
// The responses API is also a chat operation
return OPENAI_OPERATIONS.CHAT;
}
return methodPath.split('.').pop() || 'unknown';
}
/**
* Get the span operation for OpenAI methods
* Following Sentry's convention: "gen_ai.{operation_name}"
*/
function getSpanOperation(methodPath) {
return `gen_ai.${getOperationName(methodPath)}`;
}
/**
* Check if a method path should be instrumented
*/
function shouldInstrument(methodPath) {
return INSTRUMENTED_METHODS.includes(methodPath );
}
/**
* Build method path from current traversal
*/
function buildMethodPath(currentPath, prop) {
return currentPath ? `${currentPath}.${prop}` : prop;
}
/**
* Check if response is a Chat Completion object
*/
function isChatCompletionResponse(response) {
return (
response !== null &&
typeof response === 'object' &&
'object' in response &&
(response ).object === 'chat.completion'
);
}
/**
* Check if response is a Responses API object
*/
function isResponsesApiResponse(response) {
return (
response !== null &&
typeof response === 'object' &&
'object' in response &&
(response ).object === 'response'
);
}
export { buildMethodPath, getOperationName, getSpanOperation, isChatCompletionResponse, isResponsesApiResponse, shouldInstrument };
//# sourceMappingURL=utils.js.map