Skip to content

Commit

Permalink
Merge pull request #2100 from solliancenet/cp-python-logging
Browse files Browse the repository at this point in the history
Updated the start_as_current_span to start_span to ensure continuity
  • Loading branch information
ciprianjichici authored Dec 21, 2024
2 parents c1080f7 + 7b9002a commit 37d0d5c
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/python/AgentHubAPI/app/routers/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async def refresh_cache(name: str):
The name of the cache object to refresh.
"config", for example.
"""
with tracer.start_as_current_span('refresh_cache') as span:
with tracer.start_span('refresh_cache') as span:
span.set_attribute('cache_name', name)
span.add_event(f'{API_NAME} {name} cache refresh requested.')

Expand Down
2 changes: 1 addition & 1 deletion src/python/DataSourceHubAPI/app/routers/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async def refresh_cache(name: str):
The name of the cache object to refresh.
"config", for example.
"""
with tracer.start_as_current_span('refresh_cache') as span:
with tracer.start_span('refresh_cache') as span:
span.set_attribute('cache_name', name)
span.add_event(f'{API_NAME} {name} cache refresh requested.')

Expand Down
2 changes: 1 addition & 1 deletion src/python/GatekeeperIntegrationAPI/app/routers/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async def analyze(request: AnalyzeRequest) -> AnalyzeResponse:
If the request includes anonymize=True, the original content
will be returned anonymized.
"""
#with tracer.start_as_current_span('analyze') as span:
#with tracer.start_span('analyze') as span:
try:
analyzer = Analyzer(request)
return analyzer.analyze()
Expand Down
2 changes: 1 addition & 1 deletion src/python/GatekeeperIntegrationAPI/app/routers/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async def refresh_cache(name: str):
The name of the cache object to refresh.
"config", for example.
"""
#with tracer.start_as_current_span('refresh_cache') as span:
#with tracer.start_span('refresh_cache') as span:
# span.set_attribute('cache_name', name)
# span.add_event(f'{API_NAME} {name} cache refresh requested.')

Expand Down
10 changes: 5 additions & 5 deletions src/python/LangChainAPI/app/routers/completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ async def submit_completion_request(
CompletionOperation
Object containing the operation ID and status.
"""
with tracer.start_as_current_span('submit_completion_request') as span:
with tracer.start_span('submit_completion_request') as span:
try:
# Get the operation_id from the completion request.
operation_id = completion_request.operation_id
Expand Down Expand Up @@ -126,7 +126,7 @@ async def create_completion_response(
"""
Generates the completion response for the specified completion request.
"""
with tracer.start_as_current_span(f'create_completion_response') as span:
with tracer.start_span(f'create_completion_response') as span:
try:
span.set_attribute('operation_id', operation_id)
span.set_attribute('instance_id', instance_id)
Expand Down Expand Up @@ -209,7 +209,7 @@ async def get_operation_status(
instance_id: str,
operation_id: str
) -> LongRunningOperation:
with tracer.start_as_current_span(f'get_operation_status') as span:
with tracer.start_span(f'get_operation_status') as span:
# Create an operations manager to get the operation status.
operations_manager = OperationsManager(raw_request.app.extra['config'])

Expand Down Expand Up @@ -244,7 +244,7 @@ async def get_operation_result(
instance_id: str,
operation_id: str
) -> CompletionResponse:
with tracer.start_as_current_span(f'get_operation_result') as span:
with tracer.start_span(f'get_operation_result') as span:
# Create an operations manager to get the operation result.
operations_manager = OperationsManager(raw_request.app.extra['config'])

Expand Down Expand Up @@ -277,7 +277,7 @@ async def get_operation_logs(
instance_id: str,
operation_id: str
) -> List[LongRunningOperationLogEntry]:
with tracer.start_as_current_span(f'get_operation_log') as span:
with tracer.start_span(f'get_operation_log') as span:
# Create an operations manager to get the operation log.
operations_manager = OperationsManager(raw_request.app.extra['config'])

Expand Down
2 changes: 1 addition & 1 deletion src/python/LangChainAPI/app/routers/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async def refresh_cache(instance_id: str, name: str):
The name of the cache object to refresh.
"config", for example.
"""
with tracer.start_as_current_span('refresh_cache') as span:
with tracer.start_span('refresh_cache') as span:
span.set_attribute('instance_id', instance_id)
span.set_attribute('cache_name', name)
span.add_event(f'{API_NAME} {name} cache refresh requested.')
Expand Down
2 changes: 1 addition & 1 deletion src/python/PromptHubAPI/app/routers/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async def refresh_cache(name: str):
The name of the cache object to refresh.
"config", for example.
"""
with tracer.start_as_current_span('refresh_cache') as span:
with tracer.start_span('refresh_cache') as span:
span.set_attribute('cache_name', name)
span.add_event(f'{API_NAME} {name} cache refresh requested.')

Expand Down

0 comments on commit 37d0d5c

Please sign in to comment.