Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: start_span() got an unexpected keyword argument 'context' in microsoft-kiota-http #428

Open
JamesWordie opened this issue Dec 17, 2024 · 1 comment

Comments

@JamesWordie
Copy link

JamesWordie commented Dec 17, 2024

Below is the error I am encountering in my project and deployment - which relates to mircosoft-kiota-http. The error is stating a TypeError on start_span() relating to "context"

The error is occurring while using the microsoft graph package to read from a mailbox using the delta builder.

Package version with the error - 1.6.6
Python version - 3.9
Deployed onto AKS

2024-12-17 09:20:46.640 | INFO     | __main__:process_batch:31 |  - Processing batch https://graph.microsoft.com/v1.0/users/d6ee16a1-9859-4e21-ae34-5fef0bde9bd7/mailFolders('inbox')/messages/delta?$deltatoken=LztZwWjo5IivWBhyxw5rAEQFNVslxZX9kw4uNFtmZHtqvMY7FWDfDG-vmY6BPbJXfBg1tSsM0la3GHFCwg50-6GHOEgDNLxnRSeO2s8s6g0.PsEHluygtAkPvdgPYo3Wyumwi4eMRfYBpSw6d6T8MGs.
Traceback (most recent call last):
  File "/app/mailbox_reader/script.py", line 121, in <module>
    asyncio.run(main())
  File "/usr/local/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/app/mailbox_reader/script.py", line 118, in main
    more, link = await process_batch(graph_client, blob_container_client, link)
  File "/app/mailbox_reader/script.py", line 37, in process_batch
    delta_response : DeltaGetResponse = await builder.with_url(delta_link).get()
  File "/venv/lib/python3.9/site-packages/msgraph/generated/users/item/mail_folders/item/messages/delta/delta_request_builder.py", line 51, in get
    return await self.request_adapter.send_async(request_info, DeltaGetResponse, error_mapping)
  File "/venv/lib/python3.9/site-packages/kiota_http/httpx_request_adapter.py", line 182, in send_async
    response = await self.get_http_response_message(request_info, parent_span)
  File "/venv/lib/python3.9/site-packages/kiota_http/httpx_request_adapter.py", line 522, in get_http_response_message
    _get_http_resp_span = self._start_local_tracing_span(
  File "/venv/lib/python3.9/site-packages/kiota_http/httpx_request_adapter.py", line 155, in _start_local_tracing_span
    span = tracer.start_span(name, context=_context)
TypeError: start_span() got an unexpected keyword argument 'context'

Full requirement's txt is attached below.

requirements.txt

@github-project-automation github-project-automation bot moved this to Needs Triage 🔍 in Kiota Dec 17, 2024
@JamesWordie
Copy link
Author

It is failing specifically on this function in this file.

    def _start_local_tracing_span(self, name: str, parent_span: trace.Span) -> trace.Span:
        """Helper function to start a span locally with the parent context."""
        _context = trace.set_span_in_context(parent_span)
        span = tracer.start_span(name, context=_context)
        return span

Which comes from

"""Helper function to start a span locally with the parent context."""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs Triage 🔍
Development

No branches or pull requests

1 participant