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

Enhancement: OpenTelemetry integration #180

Closed
Goldziher opened this issue Jun 26, 2022 · 22 comments · Fixed by #796
Closed

Enhancement: OpenTelemetry integration #180

Goldziher opened this issue Jun 26, 2022 · 22 comments · Fixed by #796
Assignees
Labels
Enhancement This is a new feature or request Good First Issue This is good for newcomers to take on Help Wanted 🆘 This is good for people to work on

Comments

@Goldziher
Copy link
Contributor

So, as the title says. We need to consider how to best support OpenTelemetry. We might need to add some hooks to allow for optimal instrumentation. We should also consider creating an OT instrumentationn library, see for example: https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/fastapi/fastapi.html

@Goldziher Goldziher added the Enhancement This is a new feature or request label Jun 26, 2022
@Goldziher Goldziher added Help Wanted 🆘 This is good for people to work on Good First Issue This is good for newcomers to take on labels Jul 6, 2022
@Goldziher Goldziher changed the title OpenTelemetry integration Enhancement: OpenTelemetry integration Jul 6, 2022
@Goldziher
Copy link
Contributor Author

@cofin do you want to take this one?

@cofin
Copy link
Member

cofin commented Jul 16, 2022

Yep. I'll take a look at it over the weekend.

@cofin cofin self-assigned this Jul 16, 2022
@cofin
Copy link
Member

cofin commented Jul 18, 2022

I've made some progress on a local branch. I'll submit a draft PR this evening after I write a few test cases.

@cofin cofin linked a pull request Jul 20, 2022 that will close this issue
@cofin cofin removed their assignment Aug 13, 2022
@cofin
Copy link
Member

cofin commented Aug 13, 2022

Un-assigning for now until we dial in the instrumentation enhancements we've been discussing.

@cofin
Copy link
Member

cofin commented Aug 29, 2022

depends on #350

@Goldziher
Copy link
Contributor Author

@cofin - are u doing this?

@cofin
Copy link
Member

cofin commented Sep 3, 2022

I had planned to, but I don't have the bandwidth currently. I can try to pick it back up soon or hand off.

@Goldziher
Copy link
Contributor Author

It would be good if you could do this when you have bandwidth. We need this - and I too am somewhat busy 😉

@cofin
Copy link
Member

cofin commented Sep 3, 2022

Understood. I need it soon as well, so I'll make some time for it. I'll ping you on discord when I'm getting started.

@Goldziher
Copy link
Contributor Author

@seladb you interested in picking this one perhaps?

@seladb
Copy link
Contributor

seladb commented Sep 26, 2022

Sure @Goldziher I think I can take it! Might take me some time though because I'm busy with other stuff at the moment

@seladb seladb self-assigned this Sep 26, 2022
@seladb
Copy link
Contributor

seladb commented Oct 13, 2022

@Goldziher @cofin I looked up the OT integration with FastAPI and here is what I understand:

I think this design doesn't fit Starlite. Do you have any design in mind?
What do you think should be implemented on the Starlite side what on the OT side?

@Goldziher
Copy link
Contributor Author

Hmm, we should start with opening an issue in the open telemtry app.

As for what to do - you can see this draft PR of mine in the sentry repository, it does basically the same: getsentry/sentry-python#1597

@seladb
Copy link
Contributor

seladb commented Oct 16, 2022

@Goldziher I have to say I don't fully understand the architecture of these integrations (both OT and Sentry) 😕

Wouldn't it be easier to add an "OT plugin" or "Sentry plugin" to the Starlite repo that handles the instrumentation (e.g add a middleware, listen to relevant events, etc.)? I'm not familiar with our current plugin system, but it sounds feasible...

Or maybe expose Starlite's plugin in easy-to-use APIs that will provide everything these integrations need?

I assume there are solid answers to why these suggestions are not feasible, so I apologize in advance for my lack of knowledge...

@Goldziher
Copy link
Contributor Author

I started work on this @seladb --> open-telemetry/opentelemetry-python-contrib#1388

If you find the time, you're welcome to help with this. Tests are not in place yet etc.

@seladb
Copy link
Contributor

seladb commented Oct 18, 2022

Thanks @Goldziher ! I can see you're on top of this so I can probably work on some other tasks 😃
Let me know if you need my help, but TBH I still don't really understand the design...

@srikanthccv
Copy link
Contributor

Hello 👋 ,

I am one of the co-maintainers of OpenTelemetry. The instrumentations are maintained in our repo for various reasons. We could provide some value fast without putting in a lot of effort to convince and implement the tracing directly in third-party libraries. Ideally, the direction we would like to see in the long term is the support baked directly, and users who install the SDK will have the real spans out of the box.

I think it's best for starlite to ship the support directly with some middleware or plugin mechanism. I am not very familiar with the starlite internal but I would be willing to review the OTEL parts if you decide to implement the changes here.

@srikanthccv
Copy link
Contributor

Fwiw, the falcon also showed interest in adding support directly falconry/falcon#1828. If package authors adopt OTEL gradually, we can start deprecating the instrumentation package that monkey patch the original packages, which is in the best interest of everyone.

@Goldziher
Copy link
Contributor Author

Fwiw, the falcon also showed interest in adding support directly falconry/falcon#1828. If package authors adopt OTEL gradually, we can start deprecating the instrumentation package that monkey patch the original packages, which is in the best interest of everyone.

Hi, sure this would be easier than finishing the OTEL instrumentation . We should make it a separate package in that case.

@Goldziher
Copy link
Contributor Author

@srikanthccv - can you assist with reviewing the PR linked above?

@srikanthccv
Copy link
Contributor

@Goldziher, I took a quick look at the pull request. I will review it again tomorrow when I am on my computer. I see that you are extending the ASGI instrumentation middleware. Are your contrib components also follow the rules of semver? because the upstream middleware is still in beta and can possibly introduce breaking changes as it gets improved.

@Goldziher
Copy link
Contributor Author

Goldziher commented Nov 12, 2022

@Goldziher, I took a quick look at the pull request. I will review it again tomorrow when I am on my computer. I see that you are extending the ASGI instrumentation middleware. Are your contrib components also follow the rules of semver? because the upstream middleware is still in beta and can possibly introduce breaking changes as it gets improved.

Hi, we are following semver of course. I am not actually extending the middleware- I am wrapping it. The middleware internals are not touched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement This is a new feature or request Good First Issue This is good for newcomers to take on Help Wanted 🆘 This is good for people to work on
Projects
None yet
4 participants