azure-sdk-for-python icon indicating copy to clipboard operation
azure-sdk-for-python copied to clipboard

I am unable to create events using python django

Open Rithwik-Bojja opened this issue 1 year ago • 4 comments

Describe the bug

I am unable to create events using python django

myapp/views.py

import logging
from opentelemetry import trace

class SomeView(LoginRequiredMixin, TemplateView):
    login_required = True
    template_name = "myapp/index.html"

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)

        tracer = trace.get_tracer(__name__)

        with tracer.start_as_current_span("SomeView") as span:
            if span.is_recording():
                span.set_attribute("user.id", self.request.user.id)
                span.set_attribute("user.email", self.request.user.email)

                span.add_event("log", {
                    "log.severity": "info",
                    "log.message": "Mark was here.",
                    "user.id": self.request.user.id,
                    "user.email": self.request.user.email,
                })

                span.add_event("This is a span event")
                logging.getLogger().error("This is a log message")

        context['something'] = SomeThing.objects.all()
        
        return context

To get more information on refer this SO-Thread

Expected behavior

enter image description here

Rithwik-Bojja avatar Mar 11 '24 06:03 Rithwik-Bojja

Thanks for reaching out.

Could you share which azure SDK/service are you using?

xiangyan99 avatar Mar 11 '24 15:03 xiangyan99

Hi @Rithwik-Bojja. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

github-actions[bot] avatar Mar 11 '24 15:03 github-actions[bot]

opentelemetry-api==1.23.0

scoopseven avatar Mar 11 '24 17:03 scoopseven

Thnaks @scoopseven, I am using opentelemetry-api==1.23.0

Rithwik-Bojja avatar Mar 12 '24 11:03 Rithwik-Bojja

Thanks for the information.

This repo is for Azure SDK libraries.

For opentelemetry-api library, maybe https://github.com/open-telemetry/opentelemetry-python/tree/main/opentelemetry-api is the right repo.

xiangyan99 avatar Mar 14 '24 15:03 xiangyan99