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

functionality to monitor process with minimal configuration #35

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

pabloa
Copy link

@pabloa pabloa commented Apr 17, 2015

I made several changes to:
a) create a jar with all its dependencies in 1 jar (with agent classifier)
b) added a default configuration inside the jar.
c) added some configurations to be applied 1 by one until one solves the name of the process.
d) replaced InputSoure with Document so we can read configuration files from files as before or from input streams.
Added a logging.properties that only reports errors in the logs. Using a property we could make that the agent read other configuration file so we can make logging more verbose.

The idea is that once the agent is installed, it could server several processes without configuration. Other scenario is to have a central configuration somewhere. This is useful for cluster monitoring like amazon, google, etc.

pabloa added 7 commits April 9, 2015 18:04
…ent.

- Replaced InputSource with Document for efficiency reasons and to support .xml configuration files loaded from the system classpath.
- Added some extra output so the initial state is known each time.
- Added process name resolvers. Useful to name a process using several criteria. Solvers are applied in order as they are declared in the configuration. The first that return a name wins.
- Added 3 process name resolvers implementations. They pick the name from a) an environment variable, b) a system property, c) a constant.
- Modified the configuration. Added a section: /jmxetric-config/jvm/process-name-solvers
Example:
<process-name-solvers>
	<process-name-solver type="environment-variable" value="APPNAME" />
	<process-name-solver type="property-variable" value="app_name" />
	<process-name-solver type="string" value="MyProcess" />
</process-name-solvers>
- Added a property warnNotFoundJmxEntries in MBeanAttribute, if true and there is an error when the agent look for a JMX property, it will print a warning in the logs.
  if it is false (default value) no warning is logged for not found values. Useful to have a generic XML configuration file that can be used with several JVMs.
  (Implementation of the setter is pending though).
- Removed unused methods in MBeanHolder
a) environment variable PROCESSNAME
b) environment variable PROCESSNAME
c) environment variable PROCESS_NAME
d) environment variable processName
e) property variable process_name

- Switched to UNICAST since that is what it is used in AWS and similar services.
- Updated jmxetric_test.xml
- Updated .gitignore to exclude intelliJ files.
… places.

Right now it tries:
a) find the given name in the classpath
b) find it in the path
c) find it in /etc/ganglia directory
d) try to get the default configuration that is stored in the same JAR with teh anme default_jxmetric.xml
e) throw an exception.
…the variable Djava.util.logging.config.file=myfile.

System.out.println are now log.info() and they are silenced.
Created jmxetric.logging.properties with a configuration that keeps all quiet except with SEVERE logs.
Imports are reorganized.
@dpocock
Copy link
Member

dpocock commented Apr 20, 2015

Thanks for this contribution, your efforts are really appreciated.

One initial thing that sticks out when I look at this is the logging stuff. I've been very tempted to remove logging from this project for a few reasons:

  • as it is loaded before the main class, the preferred logger may not be ready yet
  • different people prefer different loggers
  • we had some problems with JBoss and initialization order, I'm a bit worried that if we initialize logging too early, then similar problems could come back

What is your feeling about this?

We can still have logging in unit tests of course.

@pabloa
Copy link
Author

pabloa commented Apr 20, 2015

I believe we should replace java.util.logging classes used in the agent for
our simple implementation that logs to system.out, a file or does not log
at all.
I would remove it, but it is useful for debugging.

Pablo

On Mon, Apr 20, 2015 at 10:14 AM, Daniel Pocock [email protected]
wrote:

Thanks for this contribution, your efforts are really appreciated.

One initial thing that sticks out when I look at this is the logging
stuff. I've been very tempted to remove logging from this project for a few
reasons:

  • as it is loaded before the main class, the preferred logger may not
    be ready yet
  • different people prefer different loggers
  • we had some problems with JBoss and initialization order, I'm a bit
    worried that if we initialize logging too early, then similar problems
    could come back

What is your feeling about this?

We can still have logging in unit tests of course.


Reply to this email directly or view it on GitHub
#35 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants