Pass through organization/project headers to tracing backend, fix speech_group enum (#562)
This commit is contained in:
parent
942ba9840b
commit
2bdf9b7b11
3 changed files with 9 additions and 2 deletions
|
|
@ -137,9 +137,10 @@ class _MCPServerWithClientSession(MCPServer, abc.ABC):
|
||||||
async with self._cleanup_lock:
|
async with self._cleanup_lock:
|
||||||
try:
|
try:
|
||||||
await self.exit_stack.aclose()
|
await self.exit_stack.aclose()
|
||||||
self.session = None
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error cleaning up server: {e}")
|
logger.error(f"Error cleaning up server: {e}")
|
||||||
|
finally:
|
||||||
|
self.session = None
|
||||||
|
|
||||||
|
|
||||||
class MCPServerStdioParams(TypedDict):
|
class MCPServerStdioParams(TypedDict):
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,12 @@ class BackendSpanExporter(TracingExporter):
|
||||||
"OpenAI-Beta": "traces=v1",
|
"OpenAI-Beta": "traces=v1",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.organization:
|
||||||
|
headers["OpenAI-Organization"] = self.organization
|
||||||
|
|
||||||
|
if self.project:
|
||||||
|
headers["OpenAI-Project"] = self.project
|
||||||
|
|
||||||
# Exponential backoff loop
|
# Exponential backoff loop
|
||||||
attempt = 0
|
attempt = 0
|
||||||
delay = self.base_delay
|
delay = self.base_delay
|
||||||
|
|
|
||||||
|
|
@ -338,7 +338,7 @@ class SpeechGroupSpanData(SpanData):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def type(self) -> str:
|
def type(self) -> str:
|
||||||
return "speech-group"
|
return "speech_group"
|
||||||
|
|
||||||
def export(self) -> dict[str, Any]:
|
def export(self) -> dict[str, Any]:
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue