Re: Maven Runtime Metrics

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Maven Runtime Metrics

Hervé BOUTEMY
Le samedi 14 mars 2020, 15:14:17 CET Enrico Olivelli a écrit :
> I am starting this work.
> I have pushed a copy of current maven core master to maven-studies.
nice

[...]
> I don't know how classloading works very well in the case of Maven/Plexus.
your approach looks reasonable: you're adding extensions to the "core"
classloader [1]

Regards,

Hervé

[1] https://maven.apache.org/guides/mini/guide-maven-classloading.html



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Maven Runtime Metrics

Enrico Olivelli
Self answer: I had written the DefaultMetricsSystem file in the wrong
directory ! (in maven core tests!)
Sorry fo the noise

I have just one problem.
Currently I am using Jsr300 to plug the MetricsSystem to Maven Core
and this would be the expected way for Plugins.

Say now that I want to use my MetricsSystem bean (@Inject
MetricsSystem) in the Maven Compiler Plugin or in Wagon...
let's say we do a 3.8.2 Maven Compiler plugin and that we deliver this
MetricsSystem in Maven 3.7.0...
Will Maven compiler plugin 3.8.2 work on Maven 3.6.x that does not
bundle the definition of the MetricsSytem ?

Ideally I would like to have a "null" value or a Default NOOP
implementation when the plugin is not running on Maven 3.7.0
Will it work ?

I will continue with the POC then I will share my model.
The change to Maven Core is almost there.
Now my plan is:
- Create an independent "Maven Extension" (in my github space, non ASF
by now, to make it clear that this system is totally pluggable with
extensions) that wraps Dropwizard Metrics and outputs the results to
file at the end of the build
- Add some initial metrics in Maven runtime
- Try with some plugin




Enrico

Il giorno sab 28 mar 2020 alle ore 15:57 Enrico Olivelli
<[hidden email]> ha scritto:

>
> Hi,
> I have pushed a new version of my prof-of-concept
> https://github.com/apache/maven-studies/compare/maven-metrics?expand=1
>
> I am introducing a MetricsSystem interface and a DefaultMetricsSystem CDI bean.
> I am new to sisu/plexsus container.
> It looks like that DefaultMetricsSystem is getting instantiated in
> Maven Core tests
>
> This is my work:
> https://github.com/apache/maven-studies/compare/maven-metrics?expand=1
>
> But if I run Maven from the command line I get the error below
>
> Maybe I missing some config/annotation
>
> Any help is appreciated !
>
> Enrico
>
>
> eolivelli@LAPTOP-OODVV59Q apache-maven-3.7.0-SNAPSHOT]$ bin/mvn
> [WARNING] Error injecting: org.apache.maven.DefaultMaven
> com.google.inject.ProvisionException: Unable to provision, see the
> following errors:
>
> 1) No implementation for org.apache.maven.metrics.MetricsSystem was bound.
>   at ClassRealm[plexus.core, parent: null] (via modules:
> org.eclipse.sisu.wire.WireModule ->
> org.eclipse.sisu.plexus.PlexusBindingModule)
>   while locating org.apache.maven.lifecycle.internal.LifecycleStarter
>   while locating org.apache.maven.DefaultMaven
>
> 1 error
>     at com.google.inject.internal.InternalProvisionException.toProvisionException
> (InternalProvisionException.java:226)
>     at com.google.inject.internal.InjectorImpl$1.get (InjectorImpl.java:1053)
>     at com.google.inject.internal.InjectorImpl.getInstance
> (InjectorImpl.java:1086)
>     at org.eclipse.sisu.space.AbstractDeferredClass.get
> (AbstractDeferredClass.java:48)
>     at com.google.inject.internal.ProviderInternalFactory.provision
> (ProviderInternalFactory.java:85)
>     at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision
> (InternalFactoryToInitializableAdapter.java:57)
>     at com.google.inject.internal.ProviderInternalFactory$1.call
> (ProviderInternalFactory.java:66)
>     at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision
> (ProvisionListenerStackCallback.java:112)
>     at org.eclipse.sisu.bean.BeanScheduler$CycleActivator.onProvision
> (BeanScheduler.java:230)
>     at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision
> (ProvisionListenerStackCallback.java:120)
>     at com.google.inject.internal.ProvisionListenerStackCallback.provision
> (ProvisionListenerStackCallback.java:66)
>     at com.google.inject.internal.ProviderInternalFactory.circularGet
> (ProviderInternalFactory.java:61)
>     at com.google.inject.internal.InternalFactoryToInitializableAdapter.get
> (InternalFactoryToInitializableAdapter.java:47)
>     at com.google.inject.internal.ProviderToInternalFactoryAdapter.get
> (ProviderToInternalFactoryAdapter.java:40)
>     at com.google.inject.internal.SingletonScope$1.get (SingletonScope.java:168)
>     at com.google.inject.internal.InternalFactoryToProviderAdapter.get
> (InternalFactoryToProviderAdapter.java:39)
>     at com.google.inject.internal.InjectorImpl$1.get (InjectorImpl.java:1050)
>     at org.eclipse.sisu.inject.LazyBeanEntry.getValue (LazyBeanEntry.java:81)
>     at org.eclipse.sisu.plexus.LazyPlexusBean.getValue (LazyPlexusBean.java:51)
>     at org.codehaus.plexus.DefaultPlexusContainer.lookup
> (DefaultPlexusContainer.java:263)
>     at org.codehaus.plexus.DefaultPlexusContainer.lookup
> (DefaultPlexusContainer.java:255)
>     at org.codehaus.plexus.DefaultPlexusContainer.lookup
> (DefaultPlexusContainer.java:249)
>     at org.apache.maven.cli.MavenCli.container (MavenCli.java:696)
>     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:284)
>     at org.apache.maven.cli.MavenCli.main (MavenCli.java:195)
>     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
>     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.java:62)
>     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke (Method.java:564)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced
> (Launcher.java:282)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.launch
> (Launcher.java:225)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode
> (Launcher.java:406)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.main
> (Launcher.java:347)
> [ERROR] Error executing Maven.
> [ERROR] com.google.inject.ProvisionException: Unable to provision, see
> the following errors:
>
> 1) No implementation for org.apache.maven.metrics.MetricsSystem was bound.
>   at ClassRealm[plexus.core, parent: null] (via modules:
> org.eclipse.sisu.wire.WireModule ->
> org.eclipse.sisu.plexus.PlexusBindingModule)
>   while locating org.apache.maven.lifecycle.internal.LifecycleStarter
>   while locating org.apache.maven.DefaultMaven
>   at ClassRealm[plexus.core, parent: null] (via modules:
> org.eclipse.sisu.wire.WireModule ->
> org.eclipse.sisu.plexus.PlexusBindingModule)
>   while locating org.apache.maven.Maven
>
> 1 error
>       role: org.apache.maven.Maven
>
> Il giorno mar 17 mar 2020 alle ore 08:35 Hervé BOUTEMY
> <[hidden email]> ha scritto:
> >
> > Le samedi 14 mars 2020, 15:14:17 CET Enrico Olivelli a écrit :
> > > I am starting this work.
> > > I have pushed a copy of current maven core master to maven-studies.
> > nice
> >
> > [...]
> > > I don't know how classloading works very well in the case of Maven/Plexus.
> > your approach looks reasonable: you're adding extensions to the "core"
> > classloader [1]
> >
> > Regards,
> >
> > Hervé
> >
> > [1] https://maven.apache.org/guides/mini/guide-maven-classloading.html
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Maven Runtime Metrics

Romain Manni-Bucau
It depends how it is done.

@Inject MetricsSystem ms; will likely fail but if you inject the container
and do the lookup you can handle the absence of the metrics, less elegant
but working as well.

Alternative is to inject a custom compiler component and have 2 components
impl (hints being different), one with injected metrics, one with noop
metrics hardcoded.
Depending the current maven version you select the right hint.
Think it is more or less what we do to handle aether change in some earlier
maven version.

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>


Le dim. 29 mars 2020 à 10:33, Enrico Olivelli <[hidden email]> a
écrit :

> Self answer: I had written the DefaultMetricsSystem file in the wrong
> directory ! (in maven core tests!)
> Sorry fo the noise
>
> I have just one problem.
> Currently I am using Jsr300 to plug the MetricsSystem to Maven Core
> and this would be the expected way for Plugins.
>
> Say now that I want to use my MetricsSystem bean (@Inject
> MetricsSystem) in the Maven Compiler Plugin or in Wagon...
> let's say we do a 3.8.2 Maven Compiler plugin and that we deliver this
> MetricsSystem in Maven 3.7.0...
> Will Maven compiler plugin 3.8.2 work on Maven 3.6.x that does not
> bundle the definition of the MetricsSytem ?
>
> Ideally I would like to have a "null" value or a Default NOOP
> implementation when the plugin is not running on Maven 3.7.0
> Will it work ?
>
> I will continue with the POC then I will share my model.
> The change to Maven Core is almost there.
> Now my plan is:
> - Create an independent "Maven Extension" (in my github space, non ASF
> by now, to make it clear that this system is totally pluggable with
> extensions) that wraps Dropwizard Metrics and outputs the results to
> file at the end of the build
> - Add some initial metrics in Maven runtime
> - Try with some plugin
>
>
>
>
> Enrico
>
> Il giorno sab 28 mar 2020 alle ore 15:57 Enrico Olivelli
> <[hidden email]> ha scritto:
> >
> > Hi,
> > I have pushed a new version of my prof-of-concept
> > https://github.com/apache/maven-studies/compare/maven-metrics?expand=1
> >
> > I am introducing a MetricsSystem interface and a DefaultMetricsSystem
> CDI bean.
> > I am new to sisu/plexsus container.
> > It looks like that DefaultMetricsSystem is getting instantiated in
> > Maven Core tests
> >
> > This is my work:
> > https://github.com/apache/maven-studies/compare/maven-metrics?expand=1
> >
> > But if I run Maven from the command line I get the error below
> >
> > Maybe I missing some config/annotation
> >
> > Any help is appreciated !
> >
> > Enrico
> >
> >
> > eolivelli@LAPTOP-OODVV59Q apache-maven-3.7.0-SNAPSHOT]$ bin/mvn
> > [WARNING] Error injecting: org.apache.maven.DefaultMaven
> > com.google.inject.ProvisionException: Unable to provision, see the
> > following errors:
> >
> > 1) No implementation for org.apache.maven.metrics.MetricsSystem was
> bound.
> >   at ClassRealm[plexus.core, parent: null] (via modules:
> > org.eclipse.sisu.wire.WireModule ->
> > org.eclipse.sisu.plexus.PlexusBindingModule)
> >   while locating org.apache.maven.lifecycle.internal.LifecycleStarter
> >   while locating org.apache.maven.DefaultMaven
> >
> > 1 error
> >     at
> com.google.inject.internal.InternalProvisionException.toProvisionException
> > (InternalProvisionException.java:226)
> >     at com.google.inject.internal.InjectorImpl$1.get
> (InjectorImpl.java:1053)
> >     at com.google.inject.internal.InjectorImpl.getInstance
> > (InjectorImpl.java:1086)
> >     at org.eclipse.sisu.space.AbstractDeferredClass.get
> > (AbstractDeferredClass.java:48)
> >     at com.google.inject.internal.ProviderInternalFactory.provision
> > (ProviderInternalFactory.java:85)
> >     at
> com.google.inject.internal.InternalFactoryToInitializableAdapter.provision
> > (InternalFactoryToInitializableAdapter.java:57)
> >     at com.google.inject.internal.ProviderInternalFactory$1.call
> > (ProviderInternalFactory.java:66)
> >     at
> com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision
> > (ProvisionListenerStackCallback.java:112)
> >     at org.eclipse.sisu.bean.BeanScheduler$CycleActivator.onProvision
> > (BeanScheduler.java:230)
> >     at
> com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision
> > (ProvisionListenerStackCallback.java:120)
> >     at
> com.google.inject.internal.ProvisionListenerStackCallback.provision
> > (ProvisionListenerStackCallback.java:66)
> >     at com.google.inject.internal.ProviderInternalFactory.circularGet
> > (ProviderInternalFactory.java:61)
> >     at
> com.google.inject.internal.InternalFactoryToInitializableAdapter.get
> > (InternalFactoryToInitializableAdapter.java:47)
> >     at com.google.inject.internal.ProviderToInternalFactoryAdapter.get
> > (ProviderToInternalFactoryAdapter.java:40)
> >     at com.google.inject.internal.SingletonScope$1.get
> (SingletonScope.java:168)
> >     at com.google.inject.internal.InternalFactoryToProviderAdapter.get
> > (InternalFactoryToProviderAdapter.java:39)
> >     at com.google.inject.internal.InjectorImpl$1.get
> (InjectorImpl.java:1050)
> >     at org.eclipse.sisu.inject.LazyBeanEntry.getValue
> (LazyBeanEntry.java:81)
> >     at org.eclipse.sisu.plexus.LazyPlexusBean.getValue
> (LazyPlexusBean.java:51)
> >     at org.codehaus.plexus.DefaultPlexusContainer.lookup
> > (DefaultPlexusContainer.java:263)
> >     at org.codehaus.plexus.DefaultPlexusContainer.lookup
> > (DefaultPlexusContainer.java:255)
> >     at org.codehaus.plexus.DefaultPlexusContainer.lookup
> > (DefaultPlexusContainer.java:249)
> >     at org.apache.maven.cli.MavenCli.container (MavenCli.java:696)
> >     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:284)
> >     at org.apache.maven.cli.MavenCli.main (MavenCli.java:195)
> >     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native
> Method)
> >     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke
> > (NativeMethodAccessorImpl.java:62)
> >     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke
> > (DelegatingMethodAccessorImpl.java:43)
> >     at java.lang.reflect.Method.invoke (Method.java:564)
> >     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced
> > (Launcher.java:282)
> >     at org.codehaus.plexus.classworlds.launcher.Launcher.launch
> > (Launcher.java:225)
> >     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode
> > (Launcher.java:406)
> >     at org.codehaus.plexus.classworlds.launcher.Launcher.main
> > (Launcher.java:347)
> > [ERROR] Error executing Maven.
> > [ERROR] com.google.inject.ProvisionException: Unable to provision, see
> > the following errors:
> >
> > 1) No implementation for org.apache.maven.metrics.MetricsSystem was
> bound.
> >   at ClassRealm[plexus.core, parent: null] (via modules:
> > org.eclipse.sisu.wire.WireModule ->
> > org.eclipse.sisu.plexus.PlexusBindingModule)
> >   while locating org.apache.maven.lifecycle.internal.LifecycleStarter
> >   while locating org.apache.maven.DefaultMaven
> >   at ClassRealm[plexus.core, parent: null] (via modules:
> > org.eclipse.sisu.wire.WireModule ->
> > org.eclipse.sisu.plexus.PlexusBindingModule)
> >   while locating org.apache.maven.Maven
> >
> > 1 error
> >       role: org.apache.maven.Maven
> >
> > Il giorno mar 17 mar 2020 alle ore 08:35 Hervé BOUTEMY
> > <[hidden email]> ha scritto:
> > >
> > > Le samedi 14 mars 2020, 15:14:17 CET Enrico Olivelli a écrit :
> > > > I am starting this work.
> > > > I have pushed a copy of current maven core master to maven-studies.
> > > nice
> > >
> > > [...]
> > > > I don't know how classloading works very well in the case of
> Maven/Plexus.
> > > your approach looks reasonable: you're adding extensions to the "core"
> > > classloader [1]
> > >
> > > Regards,
> > >
> > > Hervé
> > >
> > > [1] https://maven.apache.org/guides/mini/guide-maven-classloading.html
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>