While writing plugin what is the difference between extending InstrumentationBase and BasePlugin any difference.
When exactly BasePlugin.unpatch is called and for what purpose, do we have any lifecycle ?
You can find more details about the difference here. You should write plugin using the InstrumentationBase now and to answer your second question, patch is called when we enable the plugin and unpatch when we disable it (so we stop generating new spans).
Thanks for letting me know, I have started writing a plugin (https://github.com/mnadeem/opentelemetry-plugin-mssql) using the old mechanism, I will convert it into new mechanizm
I have converted plugin to instrumentation
However I see that, inspite of init method being called the patch method is not being called,

The plugin approach works like a charm, here is the test case.
Any suggestion would be greatly affected.
Hi @vmarchaud
I have written a blog on how to write plugin to auto instrument a library
P.S : Appreciate if you could help me with above query.
@mnadeem You need to instanciate the MssqlInstrumentation and .enable() it before requiring mssql so it get patched. You can refer to other instrumentation tests
Thanks a bundle @vmarchaud, you are just awesome
BasePlugin is deprecated and will be removed as soon as all plugins will be converted to new instrumentation class. With regards to naming the patch function is not present in instrumentation. The instrumentation also allows you to patch more packages and individual files - this was not possible with plugin so this is huge and the biggest difference between those 2 classes. The instrumentation is enabled by default unless you call it with config option to disable it. The most important is to load all instrumentations before a real usage - not event importing / requiring it so it can be patched correctly. The instrumentation needs to be loaded also, you can do it by either creating a new instance and setting things manually or you can use registerInstrumentations where you pass the new instance of your instrumentation there. In our main repo all plugins have been converted already, so you might have a look for details how all of this looks like.