Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
distribution: 'zulu'
cache: maven
- name: Build and Run Tests
run: mvn test --batch-mode --fail-at-end
run: mvn test --batch-mode --fail-at-end -DthemisExecutorVersion=1.0.0-SNAPSHOT
- name: Publish Test Report
if: success() || failure()
uses: scacap/action-surefire-report@v1
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ DOCKERHUB_USERNAME=k8loud
IMAGE_NAME=themis-executor
# w.x.y.z, one digit value each
# when tinkering add -<description> suffix
VER=0.0.4.4
VER=0.0.4.5

# targets that aren't annotated with ## are not supposed to be run on their own

Expand Down
7 changes: 5 additions & 2 deletions manifests/05-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
serviceAccountName: themis-executor
containers:
- name: executor
image: k8loud/themis-executor:0.0.4.4
image: k8loud/themis-executor:0.0.4.5
imagePullPolicy: "IfNotPresent"
# imagePullPolicy: "Always"
env:
Expand Down Expand Up @@ -68,7 +68,10 @@ spec:
name: themis-secrets
key: MAIL_PASSWORD
- name: OPENSTACK_USERNAME
value: plgppycia
valueFrom:
secretKeyRef:
name: themis-secrets
key: OPENSTACK_USERNAME
- name: OPENSTACK_PASSWORD
valueFrom:
secretKeyRef:
Expand Down
14 changes: 14 additions & 0 deletions manifests/06-svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: themis-executor-service
namespace: themis-executor
spec:
type: ClusterIP
selector:
name: themis-executor
ports:
- name: http
protocol: TCP
port: 80
targetPort: 8080
10 changes: 10 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,16 @@
<version>1.0</version>
</dependency>

<!-- Prometheus -->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
</dependency>

<!-- SSH -->
<dependency>
<groupId>com.hierynomus</groupId>
Expand Down
27 changes: 27 additions & 0 deletions src/main/java/org/k8loud/executor/drools/RuleTimeService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.k8loud.executor.drools;

import io.prometheus.client.CollectorRegistry;
import io.prometheus.client.Histogram;
import org.springframework.stereotype.Service;

import java.time.Instant;

@Service
public class RuleTimeService {
private final Histogram histogram;

public RuleTimeService(CollectorRegistry registry) {
this.histogram = Histogram.build()
.buckets(1, 2, 3, 5, 8, 13, 21, 34, 55, Double.POSITIVE_INFINITY)
.help("rule_processing_time_metric")
.name("rule_processing_time_metric")
.labelNames("Rule")
.register(registry);
}

public void reportTime(Instant startTime, String rule) {
Instant endTime = Instant.now();
Instant ruleProcessingTime = endTime.minusSeconds(startTime.getEpochSecond());
histogram.labels(rule).observe(ruleProcessingTime.getEpochSecond());
}
}
2 changes: 2 additions & 0 deletions src/main/java/org/k8loud/executor/drools/UsableServices.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ public class UsableServices {

private final HTTPService httpService;
private final MailService mailService;

private final RuleTimeService ruleTimeService;
}
2 changes: 2 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
drools.query.and.process.fixed.rate.seconds=${DROOLS_QUERY_AND_PROCESS_FIXED_RATE_SECONDS:10}
management.endpoints.web.exposure.include=*
management.endpoint.metrics.enabled=true
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package org.k8loud.executor;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.autoconfigure.actuate.observability.AutoConfigureObservability;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
@AutoConfigureObservability
class ExecutorApplicationTests {
@Test
void contextLoads() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.k8loud.executor.model.ExecutionRQ;
import org.k8loud.executor.model.Params;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.actuate.observability.AutoConfigureObservability;
import org.springframework.boot.test.context.SpringBootTest;

import java.lang.reflect.Field;
Expand All @@ -25,6 +26,7 @@
import static org.k8loud.executor.model.ExecutionRQ.createExecutionRQ;

@SpringBootTest
@AutoConfigureObservability
class MapperServiceImplTest {
private static final String INVALID = "invalidName";
private static final Params VALID_PARAMS = new Params(Map.of("param1", "val1"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.k8loud.executor.exception.ValidationException;
import org.k8loud.executor.exception.code.ValidationExceptionCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.actuate.observability.AutoConfigureObservability;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.Collections;
Expand All @@ -19,6 +20,7 @@
import static org.assertj.core.api.ThrowableAssert.catchThrowable;

@SpringBootTest
@AutoConfigureObservability
public class ValidationServiceTest {
private static final Params VALID_PARAMS = new Params(Map.of("param1", "val1"));
private static final Params EMPTY_PARAMS = new Params(Collections.emptyMap());
Expand Down