Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
regenerate src/semconv.ts with .../scripts/gen-semconv-ts.js (sorted …
…exports by name)
  • Loading branch information
trentm committed Mar 19, 2025
commit 8aaf08c9787eb756f00b8b9ba78392635a4440ef
88 changes: 47 additions & 41 deletions plugins/node/opentelemetry-instrumentation-aws-sdk/src/semconv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,23 @@
*/

/**
* The Generative AI product as identified by the client or server instrumentation.
*
* @example "openai"
*
* @note The `gen_ai.system` describes a family of GenAI models with specific model identified
* by `gen_ai.request.model` and `gen_ai.response.model` attributes.
*
* The actual GenAI product may differ from the one identified by the client.
* For example, when using OpenAI client libraries to communicate with Mistral, the `gen_ai.system`
* is set to `openai` based on the instrumentation's best knowledge.
* The name of the operation being performed.
*
* For custom model, a custom friendly name **SHOULD** be used.
* If none of these options apply, the `gen_ai.system` **SHOULD** be set to `_OTHER`.
* @note If one of the predefined values applies, but specific system uses a different name it's **RECOMMENDED** to document it in the semantic conventions for specific GenAI system and use system-specific name in the instrumentation. If a different name is not documented, instrumentation libraries **SHOULD** use applicable predefined value.
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_GEN_AI_SYSTEM = 'gen_ai.system';
export const ATTR_GEN_AI_OPERATION_NAME = 'gen_ai.operation.name' as const;

/**
* The name of the operation being performed.
* The maximum number of tokens the model generates for a request.
*
* @note If one of the predefined values applies, but specific system uses a different name it's **RECOMMENDED** to document it in the semantic conventions for specific GenAI system and use system-specific name in the instrumentation. If a different name is not documented, instrumentation libraries **SHOULD** use applicable predefined value.
* @example 100
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_GEN_AI_OPERATION_NAME = 'gen_ai.operation.name';
export const ATTR_GEN_AI_REQUEST_MAX_TOKENS =
'gen_ai.request.max_tokens' as const;

/**
* The name of the GenAI model a request is being made to.
Expand All @@ -55,16 +46,17 @@ export const ATTR_GEN_AI_OPERATION_NAME = 'gen_ai.operation.name';
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_GEN_AI_REQUEST_MODEL = 'gen_ai.request.model';
export const ATTR_GEN_AI_REQUEST_MODEL = 'gen_ai.request.model' as const;

/**
* The maximum number of tokens the model generates for a request.
* List of sequences that the model will use to stop generating further tokens.
*
* @example 100
* @example ["forest", "lived"]
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_GEN_AI_REQUEST_MAX_TOKENS = 'gen_ai.request.max_tokens';
export const ATTR_GEN_AI_REQUEST_STOP_SEQUENCES =
'gen_ai.request.stop_sequences' as const;

/**
* The temperature setting for the GenAI request.
Expand All @@ -73,7 +65,8 @@ export const ATTR_GEN_AI_REQUEST_MAX_TOKENS = 'gen_ai.request.max_tokens';
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_GEN_AI_REQUEST_TEMPERATURE = 'gen_ai.request.temperature';
export const ATTR_GEN_AI_REQUEST_TEMPERATURE =
'gen_ai.request.temperature' as const;

/**
* The top_p sampling setting for the GenAI request.
Expand All @@ -82,53 +75,66 @@ export const ATTR_GEN_AI_REQUEST_TEMPERATURE = 'gen_ai.request.temperature';
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_GEN_AI_REQUEST_TOP_P = 'gen_ai.request.top_p';
export const ATTR_GEN_AI_REQUEST_TOP_P = 'gen_ai.request.top_p' as const;

/**
* List of sequences that the model will use to stop generating further tokens.
* Array of reasons the model stopped generating tokens, corresponding to each generation received.
*
* @example ["forest", "lived"]
* @example ["stop"]
* @example ["stop", "length"]
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_GEN_AI_REQUEST_STOP_SEQUENCES =
'gen_ai.request.stop_sequences';
export const ATTR_GEN_AI_RESPONSE_FINISH_REASONS =
'gen_ai.response.finish_reasons' as const;

/**
* The number of tokens used in the GenAI input (prompt).
* The Generative AI product as identified by the client or server instrumentation.
*
* @example 100
* @example "openai"
*
* @note The `gen_ai.system` describes a family of GenAI models with specific model identified
* by `gen_ai.request.model` and `gen_ai.response.model` attributes.
*
* The actual GenAI product may differ from the one identified by the client.
* Multiple systems, including Azure OpenAI and Gemini, are accessible by OpenAI client
* libraries. In such cases, the `gen_ai.system` is set to `openai` based on the
* instrumentation's best knowledge, instead of the actual system. The `server.address`
* attribute may help identify the actual system in use for `openai`.
*
* For custom model, a custom friendly name **SHOULD** be used.
* If none of these options apply, the `gen_ai.system` **SHOULD** be set to `_OTHER`.
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_GEN_AI_USAGE_INPUT_TOKENS = 'gen_ai.usage.input_tokens';
export const ATTR_GEN_AI_SYSTEM = 'gen_ai.system' as const;

/**
* The number of tokens used in the GenAI response (completion).
* The number of tokens used in the GenAI input (prompt).
*
* @example 180
* @example 100
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_GEN_AI_USAGE_OUTPUT_TOKENS = 'gen_ai.usage.output_tokens';
export const ATTR_GEN_AI_USAGE_INPUT_TOKENS =
'gen_ai.usage.input_tokens' as const;

/**
* Array of reasons the model stopped generating tokens, corresponding to each generation received.
* The number of tokens used in the GenAI response (completion).
*
* @example ["stop"]
* @example ["stop", "length"]
* @example 180
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_GEN_AI_RESPONSE_FINISH_REASONS =
'gen_ai.response.finish_reasons';
export const ATTR_GEN_AI_USAGE_OUTPUT_TOKENS =
'gen_ai.usage.output_tokens' as const;

/**
* Enum value "aws.bedrock" for attribute {@link ATTR_GEN_AI_SYSTEM}.
* Enum value "chat" for attribute {@link ATTR_GEN_AI_OPERATION_NAME}.
*/
export const GEN_AI_SYSTEM_VALUE_AWS_BEDROCK = 'aws.bedrock';
export const GEN_AI_OPERATION_NAME_VALUE_CHAT = 'chat' as const;

/**
* Enum value "chat" for attribute {@link ATTR_GEN_AI_OPERATION_NAME}.
* Enum value "aws.bedrock" for attribute {@link ATTR_GEN_AI_SYSTEM}.
*/
export const GEN_AI_OPERATION_NAME_VALUE_CHAT = 'chat';
export const GEN_AI_SYSTEM_VALUE_AWS_BEDROCK = 'aws.bedrock' as const;