private boolean isGrafanaConfigured(String grafanaUrl, String apiToken) { return StringUtils.isNotEmpty(grafanaUrl) && StringUtils.isNotEmpty(apiToken); }
@Override public boolean isAvailable() { return StringUtils.isNotEmpty(alertingPlugin.getPushbulletAccessToken()); }
public boolean isReportToGraphite() { return StringUtils.isNotEmpty(getGraphiteHostName()); }
@Override public boolean isAvailable() { return isNotEmpty(alertingPlugin.getSmtpHost()) && isNotEmpty(alertingPlugin.getSmtpFrom()); }
private Session getSession() { Properties props = (Properties) System.getProperties().clone(); if (isNotEmpty(alertingPlugin.getSmtpUser()) && isNotEmpty(alertingPlugin.getSmtpPassword())) { props.setProperty("mail.smtps.auth", "true"); } int smtpPort = alertingPlugin.getSmtpPort(); props.setProperty("mail.smtp.port", Integer.toString(smtpPort)); if (smtpPort == 587) { props.put("mail.smtp.starttls.enable", "true"); } return Session.getInstance(props); }
private boolean isPasswordInShowWidgetHeaderCorrect(HttpServletRequest request) { String password = request.getHeader(STAGEMONITOR_SHOW_WIDGET); if (configurationPasswordChecker != null && configurationPasswordChecker.isPasswordCorrect(password)) { return true; } else { if (StringUtils.isNotEmpty(password)) { logger.error("The password transmitted via the header {} is not correct. " + "This might be a malicious attempt to guess the value of {}. " + "The request was initiated from the ip {}.", STAGEMONITOR_SHOW_WIDGET, STAGEMONITOR_PASSWORD, MonitoredHttpRequest.getClientIp(request)); } return false; } }
public static Timer getTimer(Metric2Registry metricRegistry, SpanContextInformation contextInformation) { final String operationName = contextInformation.getOperationName(); final String operationType = contextInformation.getOperationType(); if (StringUtils.isNotEmpty(operationName) && StringUtils.isNotEmpty(operationType)) { return (Timer) metricRegistry.getMetrics().get(getResponseTimeMetricName(operationName, operationType)); } return null; }
private boolean isAddCallTreeToSpan(SpanContextInformation info, String operationName) { return info.getCallTree() != null && info.getPostExecutionInterceptorContext() != null && !info.getPostExecutionInterceptorContext().isExcludeCallTree() && StringUtils.isNotEmpty(operationName); }
@Override public void onFinish(final SpanWrapper spanWrapper, final String operationName, final long durationNanos) { final SpanContextInformation contextInformation = SpanContextInformation.forSpan(spanWrapper); final String operationType = contextInformation.getOperationType(); final boolean trackMetricsByOperationName = spanWrapper.getBooleanTag(ENABLE_TRACKING_METRICS_TAG, false); if (StringUtils.isNotEmpty(operationName) && StringUtils.isNotEmpty(operationType)) { trackResponseTimeMetricsAsync(operationName, durationNanos, spanWrapper.getBooleanTag(Tags.ERROR.getKey(), false), operationType, trackMetricsByOperationName); if (SpanUtils.isServerRequest(spanWrapper)) { trackExternalRequestRate(spanWrapper, operationName, contextInformation, trackMetricsByOperationName); } else if (SpanUtils.isExternalRequest(spanWrapper)) { addExternalRequestToParent(durationNanos, contextInformation, operationType); } } }
info.addRequestAttribute(CONNECTION_ID_ATTRIBUTE, connectionId); info.addRequestAttribute(MONITORED_HTTP_REQUEST_ATTRIBUTE, this); if (tracingPlugin.isSampled(span) && servletPlugin.isParseUserAgent() && StringUtils.isNotEmpty(userAgentHeader)) { parseUserAgentAsync(span, info);
@Override public void onAfterAnyExecute(StatementInformation statementInformation, long timeElapsedNanos, SQLException e) { final Scope activeScope = tracingPlugin.getTracer().scopeManager().active(); if (activeScope != null) { final Span span = activeScope.span(); if (statementInformation.getConnectionInformation().getDataSource() instanceof DataSource && jdbcPlugin.isCollectSql()) { MetaData metaData = dataSourceUrlMap.get(statementInformation.getConnectionInformation().getDataSource()); Tags.PEER_SERVICE.set(span, metaData.serviceName); span.setTag("db.type", metaData.productName); span.setTag("db.user", metaData.userName); if (StringUtils.isNotEmpty(statementInformation.getSql())) { String sql = getSql(statementInformation.getSql(), statementInformation.getSqlWithValues()); Profiler.addIOCall(sql, timeElapsedNanos); span.setTag(AbstractExternalRequest.EXTERNAL_REQUEST_METHOD, getMethod(sql)); span.setTag(DB_STATEMENT, sql); } } tracingPlugin.getRequestMonitor().monitorStop(); } }
@Override public void onAfterAnyExecute(StatementInformation statementInformation, long timeElapsedNanos, SQLException e) { final Scope activeScope = tracingPlugin.getTracer().scopeManager().active(); if (activeScope != null) { final Span span = activeScope.span(); if (statementInformation.getConnectionInformation().getDataSource() instanceof DataSource && jdbcPlugin.isCollectSql()) { MetaData metaData = dataSourceUrlMap.get(statementInformation.getConnectionInformation().getDataSource()); Tags.PEER_SERVICE.set(span, metaData.serviceName); span.setTag("db.type", metaData.productName); span.setTag("db.user", metaData.userName); if (StringUtils.isNotEmpty(statementInformation.getSql())) { String sql = getSql(statementInformation.getSql(), statementInformation.getSqlWithValues()); Profiler.addIOCall(sql, timeElapsedNanos); span.setTag(AbstractExternalRequest.EXTERNAL_REQUEST_METHOD, getMethod(sql)); span.setTag(DB_STATEMENT, sql); } } tracingPlugin.getRequestMonitor().monitorStop(); } }