You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Jason Rosenberg <jb...@squareup.com> on 2012/11/20 23:05:15 UTC

accessing stats programmatically (instead of via jmx)

Hi,

I would like to expose some of the kafka stats that appear in the current
kafka jmx mbeans.

In our system we are using the yammer metrics library (instead of polling
jmx), so I'd like to wrap the stats and expose them as yammer metrics
elements, etc.

Looking at the code, it doesn't seem easy to access the stats
programmatically, other than by just creating an internal jmx client within
the app and pulling out the values that way.  Is there an easier way?

Jason

Re: accessing stats programmatically (instead of via jmx)

Posted by Joel Koshy <jj...@gmail.com>.
branches/0.8@HEAD is reasonably stable, although if you see any issues,
please let us know.


On Tue, Nov 20, 2012 at 8:10 PM, Jason Rosenberg <jb...@squareup.com> wrote:

> Nice, ok, I need to start using 0.8 (is there a semi-stable revision to
> start playing with?).
>
> On Tue, Nov 20, 2012 at 2:45 PM, Jay Kreps <ja...@gmail.com> wrote:
>
> > In 0.7 there is no other way to access stats remotely. Technically the
> JMX
> > is accessible so you can certainly start the broker yourself
> >    new KafkaServer(...)
> > and just add a wrapper that calls the methods you are interested in, but
> if
> > you are doing this from java it may be a bit awkward to reach into the
> > scala code in this way.
> >
> > In 0.8 we are using the yammer metrics package, so that may be easier for
> > you.
> >
> > -Jay
> >
> >
> > On Tue, Nov 20, 2012 at 2:05 PM, Jason Rosenberg <jb...@squareup.com>
> wrote:
> >
> > > Hi,
> > >
> > > I would like to expose some of the kafka stats that appear in the
> current
> > > kafka jmx mbeans.
> > >
> > > In our system we are using the yammer metrics library (instead of
> polling
> > > jmx), so I'd like to wrap the stats and expose them as yammer metrics
> > > elements, etc.
> > >
> > > Looking at the code, it doesn't seem easy to access the stats
> > > programmatically, other than by just creating an internal jmx client
> > within
> > > the app and pulling out the values that way.  Is there an easier way?
> > >
> > > Jason
> > >
> >
>

Re: accessing stats programmatically (instead of via jmx)

Posted by Jason Rosenberg <jb...@squareup.com>.
Nice, ok, I need to start using 0.8 (is there a semi-stable revision to
start playing with?).

On Tue, Nov 20, 2012 at 2:45 PM, Jay Kreps <ja...@gmail.com> wrote:

> In 0.7 there is no other way to access stats remotely. Technically the JMX
> is accessible so you can certainly start the broker yourself
>    new KafkaServer(...)
> and just add a wrapper that calls the methods you are interested in, but if
> you are doing this from java it may be a bit awkward to reach into the
> scala code in this way.
>
> In 0.8 we are using the yammer metrics package, so that may be easier for
> you.
>
> -Jay
>
>
> On Tue, Nov 20, 2012 at 2:05 PM, Jason Rosenberg <jb...@squareup.com> wrote:
>
> > Hi,
> >
> > I would like to expose some of the kafka stats that appear in the current
> > kafka jmx mbeans.
> >
> > In our system we are using the yammer metrics library (instead of polling
> > jmx), so I'd like to wrap the stats and expose them as yammer metrics
> > elements, etc.
> >
> > Looking at the code, it doesn't seem easy to access the stats
> > programmatically, other than by just creating an internal jmx client
> within
> > the app and pulling out the values that way.  Is there an easier way?
> >
> > Jason
> >
>

Re: accessing stats programmatically (instead of via jmx)

Posted by Jay Kreps <ja...@gmail.com>.
In 0.7 there is no other way to access stats remotely. Technically the JMX
is accessible so you can certainly start the broker yourself
   new KafkaServer(...)
and just add a wrapper that calls the methods you are interested in, but if
you are doing this from java it may be a bit awkward to reach into the
scala code in this way.

In 0.8 we are using the yammer metrics package, so that may be easier for
you.

-Jay


On Tue, Nov 20, 2012 at 2:05 PM, Jason Rosenberg <jb...@squareup.com> wrote:

> Hi,
>
> I would like to expose some of the kafka stats that appear in the current
> kafka jmx mbeans.
>
> In our system we are using the yammer metrics library (instead of polling
> jmx), so I'd like to wrap the stats and expose them as yammer metrics
> elements, etc.
>
> Looking at the code, it doesn't seem easy to access the stats
> programmatically, other than by just creating an internal jmx client within
> the app and pulling out the values that way.  Is there an easier way?
>
> Jason
>