Skip to content
Snippets Groups Projects
Commit dd2a6a7e authored by Daniel Gerhardt's avatar Daniel Gerhardt
Browse files

Add custom gauge metric for logged in user count

parent 4fd0b803
Branches
Tags
1 merge request!42Monitoring configuration
......@@ -17,6 +17,7 @@
*/
package de.thm.arsnova.services;
import com.codahale.metrics.annotation.Gauge;
import com.github.leleuj.ss.oauth.client.authentication.OAuthAuthenticationToken;
import de.thm.arsnova.dao.IDatabaseDao;
import de.thm.arsnova.entities.DbUser;
......@@ -50,6 +51,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.util.UriUtils;
import org.stagemonitor.core.metrics.MonitorGauges;
import javax.annotation.PreDestroy;
import javax.mail.MessagingException;
......@@ -65,6 +67,7 @@ import java.util.regex.Pattern;
* Performs all user related operations.
*/
@Service
@MonitorGauges
public class UserService implements IUserService {
private static final int LOGIN_TRY_RESET_DELAY_MS = 30 * 1000;
......@@ -325,6 +328,7 @@ public class UserService implements IUserService {
}
@Override
@Gauge
public int loggedInUsers() {
return user2session.size();
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment