Skip to content

Commit

Permalink
[HWKMETRICS-765] remove DeleteExpiredMetrics job and related code (ha…
Browse files Browse the repository at this point in the history
…wkular#923)

* [HWKMETRICS-765] remove DeleteExpiredMetrics job and related code

* [HWKMETRICS-765] remove more code related to metrics_expiration_idx

I have also disabled a test in MixedMetricsITest which fails
inconsistently.
  • Loading branch information
John Sanda authored and rubenvp8510 committed Apr 10, 2018
1 parent c8ae2bf commit 8216af9
Show file tree
Hide file tree
Showing 19 changed files with 44 additions and 673 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@
import static org.hawkular.metrics.api.jaxrs.config.ConfigurationKey.INGEST_MAX_RETRIES;
import static org.hawkular.metrics.api.jaxrs.config.ConfigurationKey.INGEST_MAX_RETRY_DELAY;
import static org.hawkular.metrics.api.jaxrs.config.ConfigurationKey.JMX_REPORTING_ENABLED;
import static org.hawkular.metrics.api.jaxrs.config.ConfigurationKey.METRICS_EXPIRATION_DELAY;
import static org.hawkular.metrics.api.jaxrs.config.ConfigurationKey.METRICS_EXPIRATION_JOB_ENABLED;
import static org.hawkular.metrics.api.jaxrs.config.ConfigurationKey.METRICS_EXPIRATION_JOB_FREQUENCY;
import static org.hawkular.metrics.api.jaxrs.config.ConfigurationKey.METRICS_REPORTING_COLLECTION_INTERVAL;
import static org.hawkular.metrics.api.jaxrs.config.ConfigurationKey.METRICS_REPORTING_ENABLED;
import static org.hawkular.metrics.api.jaxrs.config.ConfigurationKey.METRICS_REPORTING_HOSTNAME;
Expand Down Expand Up @@ -296,21 +293,6 @@ public enum State {
@ConfigurationProperty(METRICS_REPORTING_COLLECTION_INTERVAL)
private String collectionIntervalConfig;

@Inject
@Configurable
@ConfigurationProperty(METRICS_EXPIRATION_DELAY)
private String metricExpirationDelay;

@Inject
@Configurable
@ConfigurationProperty(METRICS_EXPIRATION_JOB_FREQUENCY)
private String metricsExpirationJobFrequency;

@Inject
@Configurable
@ConfigurationProperty(METRICS_EXPIRATION_JOB_ENABLED)
private String metricsExpirationJobEnabled;

@Inject
@ServiceReady
Event<ServiceReadyEvent> metricsServiceReady;
Expand Down Expand Up @@ -717,10 +699,7 @@ private boolean parseBooleanConfig(String value, ConfigurationKey configKey) {
private void initJobsService() {

RxSession rxSession = new RxSessionImpl(session);
jobsService = new JobsServiceImpl(
parseIntConfig(metricExpirationDelay, METRICS_EXPIRATION_DELAY),
parseIntConfig(metricsExpirationJobFrequency, METRICS_EXPIRATION_JOB_FREQUENCY),
parseBooleanConfig(metricsExpirationJobEnabled, METRICS_EXPIRATION_JOB_ENABLED));
jobsService = new JobsServiceImpl();
jobsService.setMetricsService(metricsService);
jobsService.setConfigurationService(configurationService);
jobsService.setSession(rxSession);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,6 @@ public enum ConfigurationKey {
METRICS_REPORTING_COLLECTION_INTERVAL("hawkular.metrics.reporting.collection-interval", "300",
"METRICS_REPORTING_COLLECTION_INTERVAL", false),

//Metric expiration job configuration
METRICS_EXPIRATION_DELAY("hawkular.metrics.expiration.delay", "1", "METRICS_EXPIRATION_DELAY", false),
METRICS_EXPIRATION_JOB_FREQUENCY("hawkular.metrics.jobs.expiration.frequency", "7",
"METRICS_EXPIRATION_JOB_FREQUENCY", false),
METRICS_EXPIRATION_JOB_ENABLED("hawkular.metrics.jobs.expiration.enabled", "true",
"METRICS_EXPIRATION_JOB_ENABLED", false),

// Request logging properties
// Useful for debugging
REQUEST_LOGGING_LEVEL("hawkular.metrics.request.logging.level", null, "REQUEST_LOGGING_LEVEL", false),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2017 Red Hat, Inc. and/or its affiliates
* Copyright 2014-2018 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -24,7 +24,6 @@

import org.hawkular.metrics.core.service.MetricsService;
import org.hawkular.metrics.datetime.DateTimeService;
import org.hawkular.metrics.model.Metric;
import org.hawkular.metrics.model.MetricId;
import org.hawkular.metrics.scheduler.api.JobDetails;
import org.hawkular.metrics.scheduler.api.RepeatingTrigger;
Expand All @@ -41,7 +40,6 @@
import rx.Completable;
import rx.Observable;
import rx.functions.Func1;
import rx.subjects.PublishSubject;

/**
* @author Michael Burman
Expand Down Expand Up @@ -124,25 +122,11 @@ public Completable call(JobDetails jobDetails) {
Observable<? extends MetricId<?>> metricIds = metricsService.findAllMetricIdentifiers()
.filter(m -> (m.getType() == GAUGE || m.getType() == COUNTER || m.getType() == AVAILABILITY));

PublishSubject<Metric<?>> subject = PublishSubject.create();
subject.subscribe(metric -> {
try {
this.metricsService.updateMetricExpiration(metric.getMetricId());
} catch (Exception e) {
logger.error("Could not update the metric expiration index for metric " + metric.getId()
+ " of tenant " + metric.getTenantId());
}
});

// Fetch all partition keys and compress the previous timeSlice
// TODO Optimization - new worker per token - use parallelism in Cassandra (with configured parallelism)
return metricsService.compressBlock(metricIds, startOfSlice, endOfSlice, pageSize, subject)
.doOnError(t -> {
subject.onCompleted();
logger.warn("Failed to compress data", t);
})
return metricsService.compressBlock(metricIds, startOfSlice, endOfSlice, pageSize)
.doOnError(t -> logger.warn("Failed to compress data", t))
.doOnCompleted(() -> {
subject.onCompleted();
stopwatch.stop();
logger.info("Finished compressing data in " + stopwatch.elapsed(TimeUnit.MILLISECONDS) +
" ms");
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2017 Red Hat, Inc. and/or its affiliates
* Copyright 2014-2018 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -33,5 +33,4 @@ public interface JobsService {

Single<? extends JobDetails> submitDeleteTenantJob(String tenantId, String jobName);

Single<? extends JobDetails> submitDeleteExpiredMetricsJob(long expiration, String jobName);
}
Loading

0 comments on commit 8216af9

Please sign in to comment.