@azure/monitor-opentelemetry
Version:
Azure Monitor OpenTelemetry (Node.js)
60 lines • 2.63 kB
JavaScript
;
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.MAIN_AGENT_ONEND_MAPPING = exports.MAIN_AGENT_ONSTART_MAPPING = exports.MAIN_AGENT_TARGET_ATTRIBUTES = exports.MAIN_AGENT_CONVERSATION_ID = exports.MAIN_AGENT_VERSION = exports.MAIN_AGENT_ID = exports.MAIN_AGENT_NAME = exports.GEN_AI_OPERATION_INVOKE_AGENT = exports.GEN_AI_OPERATION_NAME = void 0;
/**
* Attribute name constants and mapping tables for GenAI main agent
* attribution.
*
* @internal
*/
exports.GEN_AI_OPERATION_NAME = "gen_ai.operation.name";
exports.GEN_AI_OPERATION_INVOKE_AGENT = "invoke_agent";
exports.MAIN_AGENT_NAME = "microsoft.gen_ai.main_agent.name";
exports.MAIN_AGENT_ID = "microsoft.gen_ai.main_agent.id";
exports.MAIN_AGENT_VERSION = "microsoft.gen_ai.main_agent.version";
exports.MAIN_AGENT_CONVERSATION_ID = "microsoft.gen_ai.main_agent.conversation_id";
/**
* The fixed set of `microsoft.gen_ai.main_agent.*` attribute keys defined by
* the spec. Used to copy/check just these keys instead of scanning the full
* attribute map.
*
* @internal
*/
exports.MAIN_AGENT_TARGET_ATTRIBUTES = [
exports.MAIN_AGENT_NAME,
exports.MAIN_AGENT_ID,
exports.MAIN_AGENT_VERSION,
exports.MAIN_AGENT_CONVERSATION_ID,
];
/**
* Mapping used by SpanProcessor.OnStart: copy primary attribute from the
* parent span if present, otherwise copy the fallback attribute.
*
* @internal
*/
exports.MAIN_AGENT_ONSTART_MAPPING = [
{ target: exports.MAIN_AGENT_NAME, primary: exports.MAIN_AGENT_NAME, fallback: "gen_ai.agent.name" },
{ target: exports.MAIN_AGENT_ID, primary: exports.MAIN_AGENT_ID, fallback: "gen_ai.agent.id" },
{ target: exports.MAIN_AGENT_VERSION, primary: exports.MAIN_AGENT_VERSION, fallback: "gen_ai.agent.version" },
{
target: exports.MAIN_AGENT_CONVERSATION_ID,
primary: exports.MAIN_AGENT_CONVERSATION_ID,
fallback: "gen_ai.conversation.id",
},
];
/**
* Mapping used by SpanProcessor.OnEnd for `invoke_agent` spans that do not
* already carry any `microsoft.gen_ai.main_agent.*` attribute: copy the
* source attribute from the span onto the corresponding target.
*
* @internal
*/
exports.MAIN_AGENT_ONEND_MAPPING = [
{ target: exports.MAIN_AGENT_NAME, source: "gen_ai.agent.name" },
{ target: exports.MAIN_AGENT_ID, source: "gen_ai.agent.id" },
{ target: exports.MAIN_AGENT_VERSION, source: "gen_ai.agent.version" },
{ target: exports.MAIN_AGENT_CONVERSATION_ID, source: "gen_ai.conversation.id" },
];
//# sourceMappingURL=genaiAttributes.js.map