Tabnine Logo
StringUtils.getLogstashStyleDate
Code IndexAdd Tabnine to your IDE (free)

How to use
getLogstashStyleDate
method
in
org.stagemonitor.util.StringUtils

Best Java code snippets using org.stagemonitor.util.StringUtils.getLogstashStyleDate (Showing top 11 results out of 315)

origin: stagemonitor/stagemonitor

static String getTodaysIndexName() {
  return "stagemonitor-spans-" + StringUtils.getLogstashStyleDate();
}
origin: stagemonitor/stagemonitor

public static String getTodaysIndexName() {
  return STAGEMONITOR_METRICS_INDEX_PREFIX + StringUtils.getLogstashStyleDate();
}
origin: stagemonitor/stagemonitor

public static String getLogstashStyleDate() {
  return getLogstashStyleDate(System.currentTimeMillis());
}
origin: stagemonitor/stagemonitor

private void excludeDays(String prefix, StringBuilder sb, GregorianCalendar lastDayToExclude, GregorianCalendar alreadyExcluded) {
  for (; alreadyExcluded.after(lastDayToExclude) || alreadyExcluded.equals(lastDayToExclude); alreadyExcluded.add(Calendar.DAY_OF_YEAR, -1)) {
    sb.append(",-").append(prefix).append(StringUtils.getLogstashStyleDate(alreadyExcluded.getTimeInMillis()));
  }
}
origin: stagemonitor/stagemonitor

@Override
public void report(SpanContextInformation spanContext, final SpanWrapper spanWrapper) {
  logger.debug("Reporting span");
  if (elasticsearchTracingPlugin.isOnlyLogElasticsearchSpanReports()) {
    final String spansIndex = "stagemonitor-spans-" + StringUtils.getLogstashStyleDate();
    spanLogger.info(ElasticsearchClient.getBulkHeader("index", spansIndex, SPANS_TYPE) + JsonUtils.toJson(spanWrapper));
  } else {
    scheduleSendBulk(new SpanBulkIndexOutputStreamHandler(spanWrapper));
  }
}
origin: stagemonitor/stagemonitor

@Test
public void testLogReportSpan() throws Exception {
  Mockito.when(elasticsearchTracingPlugin.isOnlyLogElasticsearchSpanReports()).thenReturn(true);
  final SpanContextInformation spanContext = reportSpanWithCallTree(1000, "Report Me");
  final List<MockSpan> sampledSpans = getSampledSpans();
  assertThat(sampledSpans).hasSize(1);
  Mockito.verify(httpClient, Mockito.times(0)).send(any(), any(), any(), any(), any());
  Mockito.verify(spanLogger).info(ArgumentMatchers.startsWith("{\"index\":{\"_index\":\"stagemonitor-spans-" + StringUtils.getLogstashStyleDate() + "\",\"_type\":\"spans\"}}\n"));
  Assert.assertTrue(reporter.isActive(spanContext));
}
origin: stagemonitor/stagemonitor

@Test
public void testSchedule() throws Exception {
  when(corePlugin.isOnlyLogElasticsearchMetricReports()).thenReturn(true);
  // this clock starts at 0 and then progresses normally
  when(clock.getTime()).then(new Answer<Long>() {
    long firstTimestamp;
    @Override
    public Long answer(InvocationOnMock invocation) throws Throwable {
      final long time = System.currentTimeMillis();
      if (firstTimestamp == 0) {
        firstTimestamp = time;
      }
      return (time - firstTimestamp);
    }
  });
  registry.register(name("test").build(), new Gauge<Integer>() {
    @Override
    public Integer getValue() {
      return 1;
    }
  });
  elasticsearchReporter.start(100, TimeUnit.MILLISECONDS);
  Thread.sleep(300);
  verify(metricsLogger).info(eq(String.format("{\"index\":{\"_index\":\"stagemonitor-metrics-%s\",\"_type\":\"metrics\"}}\n" +
      "{\"@timestamp\":100,\"name\":\"test\",\"app\":\"test\",\"value\":1.0}\n", StringUtils.getLogstashStyleDate())));
  verify(metricsLogger).info(eq(String.format("{\"index\":{\"_index\":\"stagemonitor-metrics-%s\",\"_type\":\"metrics\"}}\n" +
      "{\"@timestamp\":200,\"name\":\"test\",\"app\":\"test\",\"value\":1.0}\n", StringUtils.getLogstashStyleDate())));
}
origin: stagemonitor/stagemonitor

@Test
public void testReportToLog() throws Exception {
  when(corePlugin.isOnlyLogElasticsearchMetricReports()).thenReturn(true);
  elasticsearchReporter.reportMetrics(
      metricNameMap(name("gauge").build(), gauge(1)),
      metricNameMap(Counter.class),
      metricNameMap(Histogram.class),
      metricNameMap(Meter.class),
      metricNameMap(Timer.class));
  verify(metricsLogger).info(eq(String.format("{\"index\":{\"_index\":\"stagemonitor-metrics-%s\",\"_type\":\"metrics\"}}\n" +
      "{\"@timestamp\":%d,\"name\":\"gauge\",\"app\":\"test\",\"value\":1.0}\n", StringUtils.getLogstashStyleDate(), timestamp)));
}
origin: stagemonitor/stagemonitor

@Test
public void testReportGauges() throws Exception {
  elasticsearchReporter.reportMetrics(
      metricNameMap(
          name("cpu_usage").type("user").tag("core", "1").build(), gauge(3)
      ),
      metricNameMap(Counter.class),
      metricNameMap(Histogram.class),
      metricNameMap(Meter.class),
      metricNameMap(Timer.class));
  final String jsons = new String(out.toByteArray());
  assertEquals(jsons, 2, jsons.split("\n").length);
  assertEquals(
      objectMap("index", map("_type", "metrics")
          .add("_index", "stagemonitor-metrics-" + StringUtils.getLogstashStyleDate())),
      asMap(jsons.split("\n")[0]));
  assertEquals(
      objectMap("@timestamp", timestamp)
        .add("name", "cpu_usage")
        .add("app", "test")
        .add("type", "user")
        .add("core", "1")
        .add("value", 3.0),
      asMap(jsons.split("\n")[1]));
}
origin: org.stagemonitor/stagemonitor-tracing-elasticsearch

static String getTodaysIndexName() {
  return "stagemonitor-spans-" + StringUtils.getLogstashStyleDate();
}
origin: org.stagemonitor/stagemonitor-tracing-elasticsearch

@Override
public void report(SpanContextInformation spanContext, final SpanWrapper spanWrapper) {
  logger.debug("Reporting span");
  if (elasticsearchTracingPlugin.isOnlyLogElasticsearchSpanReports()) {
    final String spansIndex = "stagemonitor-spans-" + StringUtils.getLogstashStyleDate();
    spanLogger.info(ElasticsearchClient.getBulkHeader("index", spansIndex, SPANS_TYPE) + JsonUtils.toJson(spanWrapper));
  } else {
    scheduleSendBulk(new SpanBulkIndexOutputStreamHandler(spanWrapper));
  }
}
org.stagemonitor.utilStringUtilsgetLogstashStyleDate

Popular methods of StringUtils

  • isEmpty
  • isNotEmpty
  • sha1Hash
  • asCsv
  • removeStart
  • removeTrailingSlash
  • replaceWhitespacesWithDash
  • timestampAsIsoString
  • toCommaSeparatedString
  • bytesToHex
  • capitalize
  • dateAsIsoString
  • capitalize,
  • dateAsIsoString,
  • slugify,
  • split,
  • splitCamelCase

Popular in Java

  • Reactive rest calls using spring rest template
  • putExtra (Intent)
  • getApplicationContext (Context)
  • onCreateOptionsMenu (Activity)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now