@@ -40,13 +40,24 @@ public abstract class StreamTransformerBase(ILogger logger) : IStreamTransformer
4040	/// </summary> 
4141	protected  abstract  string  GetAgentProvider ( ) ; 
4242
43+ 	/// <summary> 
44+ 	/// Public property to expose agent ID (implements IStreamTransformer) 
45+ 	/// </summary> 
46+ 	public  string  AgentId  =>  GetAgentId ( ) ; 
47+ 
48+ 	/// <summary> 
49+ 	/// Public property to expose agent provider (implements IStreamTransformer) 
50+ 	/// </summary> 
51+ 	public  string  AgentProvider  =>  GetAgentProvider ( ) ; 
52+ 
4353	public  Task < Stream >  TransformAsync ( Stream  rawStream ,  CancellationToken  cancellationToken  =  default ) 
4454	{ 
4555		using  var  activity  =  StreamTransformerActivitySource . StartActivity ( $ "chat { GetAgentId ( ) } ",  ActivityKind . Client ) ; 
4656		_  =  ( activity ? . SetTag ( "gen_ai.operation.name" ,  "chat" ) ) ; 
47- 		_  =  ( activity ? . SetTag ( "gen_ai.request.model" ,  GetAgentId ( ) ) ) ; 
48- 		_  =  ( activity ? . SetTag ( "gen_ai.agent.name" ,  GetAgentId ( ) ) ) ; 
49- 		_  =  ( activity ? . SetTag ( "gen_ai.provider.name" ,  GetAgentProvider ( ) ) ) ; 
57+ 
58+ 		// Custom attributes for tracking our abstraction layer 
59+ 		_  =  ( activity ? . SetTag ( "docs.ai.gateway" ,  GetAgentProvider ( ) ) ) ; 
60+ 		_  =  ( activity ? . SetTag ( "docs.ai.agent_name" ,  GetAgentId ( ) ) ) ; 
5061
5162		// Configure pipe for low-latency streaming 
5263		var  pipeOptions  =  new  PipeOptions ( 
@@ -160,8 +171,10 @@ private async Task ProcessPipeAsync(PipeReader reader, PipeWriter writer, Activi
160171	protected  virtual  async  Task  ProcessStreamAsync ( PipeReader  reader ,  PipeWriter  writer ,  Activity ?  parentActivity ,  CancellationToken  cancellationToken ) 
161172	{ 
162173		using  var  activity  =  StreamTransformerActivitySource . StartActivity ( "gen_ai.agent.stream" ) ; 
163- 		_  =  ( activity ? . SetTag ( "gen_ai.agent.name" ,  GetAgentId ( ) ) ) ; 
164- 		_  =  ( activity ? . SetTag ( "gen_ai.provider.name" ,  GetAgentProvider ( ) ) ) ; 
174+ 
175+ 		// Custom attributes for tracking our abstraction layer 
176+ 		_  =  ( activity ? . SetTag ( "docs.ai.gateway" ,  GetAgentProvider ( ) ) ) ; 
177+ 		_  =  ( activity ? . SetTag ( "docs.ai.agent_name" ,  GetAgentId ( ) ) ) ; 
165178
166179		var  eventCount  =  0 ; 
167180		var  jsonParseErrors  =  0 ; 
@@ -201,13 +214,10 @@ protected virtual async Task ProcessStreamAsync(PipeReader reader, PipeWriter wr
201214
202215			if  ( transformedEvent  !=  null ) 
203216			{ 
204- 				// Update parent activity with conversation ID and model info  when we receive ConversationStart events 
217+ 				// Update parent activity with conversation ID when we receive ConversationStart events 
205218				if  ( transformedEvent  is  AskAiEvent . ConversationStart  conversationStart ) 
206219				{ 
207220					_  =  ( parentActivity ? . SetTag ( "gen_ai.conversation.id" ,  conversationStart . ConversationId ) ) ; 
208- 					_  =  ( parentActivity ? . SetTag ( "gen_ai.request.model" ,  GetAgentId ( ) ) ) ; 
209- 					_  =  ( parentActivity ? . SetTag ( "gen_ai.agent.name" ,  GetAgentId ( ) ) ) ; 
210- 					_  =  ( parentActivity ? . SetTag ( "gen_ai.provider.name" ,  GetAgentProvider ( ) ) ) ; 
211221					_  =  ( activity ? . SetTag ( "gen_ai.conversation.id" ,  conversationStart . ConversationId ) ) ; 
212222				} 
213223
@@ -238,8 +248,10 @@ protected async Task WriteEventAsync(AskAiEvent? transformedEvent, PipeWriter wr
238248			return ; 
239249
240250		using  var  activity  =  StreamTransformerActivitySource . StartActivity ( "gen_ai.agent.token" ) ; 
241- 		_  =  ( activity ? . SetTag ( "gen_ai.agent.name" ,  GetAgentId ( ) ) ) ; 
242- 		_  =  ( activity ? . SetTag ( "gen_ai.provider.name" ,  GetAgentProvider ( ) ) ) ; 
251+ 
252+ 		// Custom attributes for tracking our abstraction layer 
253+ 		_  =  ( activity ? . SetTag ( "docs.ai.gateway" ,  GetAgentProvider ( ) ) ) ; 
254+ 		_  =  ( activity ? . SetTag ( "docs.ai.agent_name" ,  GetAgentId ( ) ) ) ; 
243255		_  =  ( activity ? . SetTag ( "gen_ai.response.token_type" ,  transformedEvent . GetType ( ) . Name ) ) ; 
244256
245257		try 
0 commit comments