|
Packit |
c04fcb |
/*
|
|
Packit |
c04fcb |
* Copyright (C) 2015 - EfficiOS Inc., Alexandre Montplaisir <alexmonthy@efficios.com>
|
|
Packit |
c04fcb |
*
|
|
Packit |
c04fcb |
* This library is free software; you can redistribute it and/or modify it
|
|
Packit |
c04fcb |
* under the terms of the GNU Lesser General Public License, version 2.1 only,
|
|
Packit |
c04fcb |
* as published by the Free Software Foundation.
|
|
Packit |
c04fcb |
*
|
|
Packit |
c04fcb |
* This library is distributed in the hope that it will be useful, but WITHOUT
|
|
Packit |
c04fcb |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
Packit |
c04fcb |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
Packit |
c04fcb |
* for more details.
|
|
Packit |
c04fcb |
*
|
|
Packit |
c04fcb |
* You should have received a copy of the GNU Lesser General Public License
|
|
Packit |
c04fcb |
* along with this library; if not, write to the Free Software Foundation,
|
|
Packit |
c04fcb |
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
Packit |
c04fcb |
*/
|
|
Packit |
c04fcb |
|
|
Packit |
c04fcb |
package org.lttng.ust.agent;
|
|
Packit |
c04fcb |
|
|
Packit |
c04fcb |
import java.util.Collection;
|
|
Packit |
c04fcb |
import java.util.Map;
|
|
Packit |
c04fcb |
|
|
Packit |
c04fcb |
/**
|
|
Packit |
c04fcb |
* Interface to define LTTng Java agents.
|
|
Packit |
c04fcb |
*
|
|
Packit |
c04fcb |
* An "agent" is a representative of an LTTng session daemon in the Java world.
|
|
Packit |
c04fcb |
* It tracks the settings of a tracing session as they defined in the session
|
|
Packit |
c04fcb |
* daemon.
|
|
Packit |
c04fcb |
*
|
|
Packit |
c04fcb |
* It also track the current logging handlers that are sending events to UST.
|
|
Packit |
c04fcb |
*
|
|
Packit |
c04fcb |
* @author Alexandre Montplaisir
|
|
Packit |
c04fcb |
*
|
|
Packit |
c04fcb |
* @param <T>
|
|
Packit |
c04fcb |
* The type of logging handler that should register to this agent
|
|
Packit |
c04fcb |
*/
|
|
Packit |
c04fcb |
public interface ILttngAgent<T extends ILttngHandler> {
|
|
Packit |
c04fcb |
|
|
Packit |
c04fcb |
// ------------------------------------------------------------------------
|
|
Packit |
c04fcb |
// Agent configuration elements
|
|
Packit |
c04fcb |
// ------------------------------------------------------------------------
|
|
Packit |
c04fcb |
|
|
Packit |
c04fcb |
/**
|
|
Packit |
c04fcb |
* Tracing domains. Corresponds to domains defined by LTTng Tools.
|
|
Packit |
c04fcb |
*/
|
|
Packit |
c04fcb |
enum Domain {
|
|
Packit |
c04fcb |
JUL(3), LOG4J(4);
|
|
Packit |
c04fcb |
private int value;
|
|
Packit |
c04fcb |
|
|
Packit |
c04fcb |
private Domain(int value) {
|
|
Packit |
c04fcb |
this.value = value;
|
|
Packit |
c04fcb |
}
|
|
Packit |
c04fcb |
|
|
Packit |
c04fcb |
public int value() {
|
|
Packit |
c04fcb |
return value;
|
|
Packit |
c04fcb |
}
|
|
Packit |
c04fcb |
}
|
|
Packit |
c04fcb |
|
|
Packit |
c04fcb |
/**
|
|
Packit |
c04fcb |
* The tracing domain of this agent.
|
|
Packit |
c04fcb |
*
|
|
Packit |
c04fcb |
* @return The tracing domain.
|
|
Packit |
c04fcb |
*/
|
|
Packit |
c04fcb |
Domain getDomain();
|
|
Packit |
c04fcb |
|
|
Packit |
c04fcb |
// ------------------------------------------------------------------------
|
|
Packit |
c04fcb |
// Log handler registering
|
|
Packit |
c04fcb |
// ------------------------------------------------------------------------
|
|
Packit |
c04fcb |
|
|
Packit |
c04fcb |
/**
|
|
Packit |
c04fcb |
* Register a handler to this agent.
|
|
Packit |
c04fcb |
*
|
|
Packit |
c04fcb |
* @param handler
|
|
Packit |
c04fcb |
* The handler to register
|
|
Packit |
c04fcb |
*/
|
|
Packit |
c04fcb |
void registerHandler(T handler);
|
|
Packit |
c04fcb |
|
|
Packit |
c04fcb |
/**
|
|
Packit |
c04fcb |
* Deregister a handler from this agent.
|
|
Packit |
c04fcb |
*
|
|
Packit |
c04fcb |
* @param handler
|
|
Packit |
c04fcb |
* The handler to deregister.
|
|
Packit |
c04fcb |
*/
|
|
Packit |
c04fcb |
void unregisterHandler(T handler);
|
|
Packit |
c04fcb |
|
|
Packit |
c04fcb |
// ------------------------------------------------------------------------
|
|
Packit |
c04fcb |
// Tracing session parameters
|
|
Packit |
c04fcb |
// ------------------------------------------------------------------------
|
|
Packit |
c04fcb |
|
|
Packit |
c04fcb |
/**
|
|
Packit |
c04fcb |
* Query if a given event is currently enabled in a current tracing session,
|
|
Packit |
c04fcb |
* meaning it should be sent to UST.
|
|
Packit |
c04fcb |
*
|
|
Packit |
c04fcb |
* @param eventName
|
|
Packit |
c04fcb |
* The name of the event to check.
|
|
Packit |
c04fcb |
* @return True if the event is currently enabled, false if it is not.
|
|
Packit |
c04fcb |
*/
|
|
Packit |
c04fcb |
boolean isEventEnabled(String eventName);
|
|
Packit |
c04fcb |
|
|
Packit |
c04fcb |
/**
|
|
Packit |
c04fcb |
* Return the list of application contexts enabled in the tracing sessions.
|
|
Packit |
c04fcb |
*
|
|
Packit |
c04fcb |
* @return The application contexts, first indexed by retriever name, then
|
|
Packit |
c04fcb |
* by context name
|
|
Packit |
c04fcb |
*/
|
|
Packit |
c04fcb |
Collection<Map.Entry<String, Map<String, Integer>>> getEnabledAppContexts();
|
|
Packit |
c04fcb |
}
|