Skip to content

WIP RFC: Open Telemetry Standardization#5384

Draft
MichaelDoyle wants to merge 6 commits into
mainfrom
md/otel-rfc
Draft

WIP RFC: Open Telemetry Standardization#5384
MichaelDoyle wants to merge 6 commits into
mainfrom
md/otel-rfc

Conversation

@MichaelDoyle
Copy link
Copy Markdown
Contributor

WIP

@github-actions github-actions Bot added the docs Improvements or additions to documentation label May 21, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds comprehensive documentation for Genkit's OpenTelemetry specification and provides an overview of existing instrumentation strategies. The documentation defines naming conventions, instrumentation scope, and specific span attributes for flows, agents, models, and tools to ensure cross-language consistency. Review feedback correctly identified that attribute types in the specification must align with OpenTelemetry standards, specifically recommending the use of JSON-stringified strings instead of 'any' types for complex data structures.

Comment thread docs/otel-genkit-spec.md
Comment on lines +113 to +116
| Gen AI | `gen_ai.input.messages` | Opt-In | any[] | Structured conversation history. | `[...]` |
| Gen AI | `gen_ai.output.messages` | Opt-In | any[] | Structured completion messages. | `[...]` |
| Gen AI | `gen_ai.system_instructions` | Opt-In | any[] | System-level instructions. | `[...]` |
| Gen AI | `gen_ai.tool.definitions` | Opt-In | any[] | List of tool definitions available to the model. | `[...]` |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The types any[] and any are not valid OpenTelemetry attribute types. According to the OpenTelemetry specification, attribute values must be a primitive type (string, boolean, double, or int64) or an array of primitive types. For complex structures like messages or tool definitions, these should be defined as string (JSON-stringified) to be compliant with OTel standards.

Suggested change
| Gen AI | `gen_ai.input.messages` | Opt-In | any[] | Structured conversation history. | `[...]` |
| Gen AI | `gen_ai.output.messages` | Opt-In | any[] | Structured completion messages. | `[...]` |
| Gen AI | `gen_ai.system_instructions` | Opt-In | any[] | System-level instructions. | `[...]` |
| Gen AI | `gen_ai.tool.definitions` | Opt-In | any[] | List of tool definitions available to the model. | `[...]` |
| Gen AI | `gen_ai.input.messages` | Opt-In | string | Structured conversation history (JSON). | `[...]` |
| Gen AI | `gen_ai.output.messages` | Opt-In | string | Structured completion messages (JSON). | `[...]` |
| Gen AI | `gen_ai.system_instructions` | Opt-In | string | System-level instructions (JSON). | `[...]` |
| Gen AI | `gen_ai.tool.definitions` | Opt-In | string | List of tool definitions available to the model (JSON). | `[...]` |

Comment thread docs/otel-genkit-spec.md
Comment on lines +139 to +140
| Gen AI | `gen_ai.tool.call.arguments` | Opt-In | any | Parameters passed to the tool. | `{"city": "Paris"}` |
| Gen AI | `gen_ai.tool.call.result` | Opt-In | any | Result returned by the tool. | `{"temp": 72}` |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

As noted previously, any is not a valid type for OpenTelemetry attributes. These should be specified as string (JSON-stringified) to ensure compatibility with OTel collectors and backends.

Suggested change
| Gen AI | `gen_ai.tool.call.arguments` | Opt-In | any | Parameters passed to the tool. | `{"city": "Paris"}` |
| Gen AI | `gen_ai.tool.call.result` | Opt-In | any | Result returned by the tool. | `{"temp": 72}` |
| Gen AI | `gen_ai.tool.call.arguments` | Opt-In | string | Parameters passed to the tool (JSON). | `{"city": "Paris"}` |
| Gen AI | `gen_ai.tool.call.result` | Opt-In | string | Result returned by the tool (JSON). | `{"temp": 72}` |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant