(t *testing.T)
| 782 | } |
| 783 | |
| 784 | func TestNewServerProxyManagerTraces(t *testing.T) { |
| 785 | t.Parallel() |
| 786 | |
| 787 | sr, tracer := setupTracer(t) |
| 788 | |
| 789 | serverName := "serverName" |
| 790 | mockMCP := setupMCPForTestWithName(t, serverName, tracer) |
| 791 | tool := mockMCP.ListTools()[0] |
| 792 | |
| 793 | require.Len(t, sr.Ended(), 3) |
| 794 | verifyTraces(t, sr, []expectTrace{{"ServerProxyManager.Init", 1, codes.Unset}}, []attribute.KeyValue{}) |
| 795 | |
| 796 | attrs := []attribute.KeyValue{ |
| 797 | attribute.String(tracing.MCPProxyName, serverName), |
| 798 | attribute.String(tracing.MCPServerURL, tool.ServerURL), |
| 799 | attribute.String(tracing.MCPServerName, serverName), |
| 800 | } |
| 801 | verifyTraces(t, sr, []expectTrace{{"StreamableHTTPServerProxy.Init", 1, codes.Unset}}, attrs) |
| 802 | |
| 803 | attrs = append(attrs, attribute.Int(tracing.MCPToolCount, len(mockMCP.ListTools()))) |
| 804 | verifyTraces(t, sr, []expectTrace{{"StreamableHTTPServerProxy.Init.fetchTools", 1, codes.Unset}}, attrs) |
| 805 | } |
| 806 | |
| 807 | func cmpAttrKeyVal(a attribute.KeyValue, b attribute.KeyValue) int { |
| 808 | return strings.Compare(string(a.Key), string(b.Key)) |
nothing calls this directly
no test coverage detected