├── assets └── diagram.png ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ ├── maven-wrapper.properties │ └── MavenWrapperDownloader.java ├── name-client-service ├── src │ └── main │ │ ├── fabric8 │ │ ├── service.yml │ │ ├── serviceAccount.yml │ │ ├── configmap.yml │ │ └── deployment.yml │ │ ├── WEB-INF │ │ └── beans.xml │ │ ├── java │ │ └── com │ │ │ └── github │ │ │ └── jamesnetherton │ │ │ ├── servlet │ │ │ └── MetricsServlet.java │ │ │ └── client │ │ │ ├── producer │ │ │ ├── KubernetesClientProducer.java │ │ │ ├── JaxrsClientProducer.java │ │ │ └── PropertiesComponentProducer.java │ │ │ ├── ClientServiceRouteBuilder.java │ │ │ ├── generator │ │ │ └── NameGenerator.java │ │ │ └── watcher │ │ │ └── ConfigMapWatcher.java │ │ └── resources │ │ └── names.txt └── pom.xml ├── name-suffix-service ├── src │ └── main │ │ ├── resources │ │ ├── application.properties │ │ ├── words.txt │ │ └── lastnames.txt │ │ ├── fabric8 │ │ └── service.yml │ │ └── java │ │ └── com │ │ └── github │ │ └── jamesnetherton │ │ └── service │ │ └── suffix │ │ ├── SuffixServiceApplication.java │ │ ├── SuffixServiceRouteBuilder.java │ │ ├── processor │ │ └── LastNameProcessor.java │ │ └── OpenTracingConfig.java └── pom.xml ├── etc ├── grafana │ └── provisioning │ │ ├── dashboards │ │ ├── dashboard.yml │ │ └── camel-microservice-demo.json │ │ └── datasources │ │ └── datasource.yml └── prometheus │ ├── server │ ├── alert-rule-camel.yml │ └── prometheus.yml │ ├── alertmanager │ └── config.yml │ ├── prometheus-openshift.yml │ └── agent │ └── prometheus-config.yml ├── name-prefix-service ├── src │ └── main │ │ ├── resources │ │ ├── application.properties │ │ └── titles.txt │ │ ├── fabric8 │ │ └── service.yml │ │ └── java │ │ └── com │ │ └── github │ │ └── jamesnetherton │ │ └── service │ │ └── prefix │ │ ├── PrefixServiceApplication.java │ │ ├── PrefixServiceRouteBuilder.java │ │ ├── processor │ │ └── TitleProcessor.java │ │ └── OpenTracingConfig.java └── pom.xml ├── .gitignore ├── pom.xml ├── docker-compose.yml ├── deployment-kubernetes.yml ├── README.md ├── mvnw.cmd ├── deployment-openshift.yml └── mvnw /assets/diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesnetherton/camel-microservice-demo/HEAD/assets/diagram.png -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesnetherton/camel-microservice-demo/HEAD/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /name-client-service/src/main/fabric8/service.yml: -------------------------------------------------------------------------------- 1 | metadata: 2 | labels: 3 | hystrix.enabled: "true" 4 | spec: 5 | type: "NodePort" -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip -------------------------------------------------------------------------------- /name-client-service/src/main/fabric8/serviceAccount.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: "v1" 3 | kind: "ServiceAccount" 4 | metadata: 5 | name: "name-client-service" -------------------------------------------------------------------------------- /name-client-service/src/main/fabric8/configmap.yml: -------------------------------------------------------------------------------- 1 | kind: ConfigMap 2 | apiVersion: v1 3 | metadata: 4 | name: client-service-config 5 | data: 6 | timer.period: 10000 -------------------------------------------------------------------------------- /name-suffix-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | camel.springboot.name=name-suffix-service 2 | 3 | server.port=8082 4 | server.address=0.0.0.0 5 | management.address=0.0.0.0 6 | 7 | camel.component.servlet.mapping.context-path=/api/* 8 | -------------------------------------------------------------------------------- /etc/grafana/provisioning/dashboards/dashboard.yml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | providers: 4 | - name: 'Prometheus' 5 | orgId: 1 6 | folder: '' 7 | type: file 8 | disableDeletion: false 9 | editable: true 10 | options: 11 | path: /etc/grafana/provisioning/dashboards 12 | -------------------------------------------------------------------------------- /etc/prometheus/server/alert-rule-camel.yml: -------------------------------------------------------------------------------- 1 | groups: 2 | - name: camel-microservice-demo 3 | rules: 4 | - alert: PrefixServiceInstanceDown 5 | expr: up{instance="name-prefix-service:9779"} == 0 6 | for: 1m 7 | annotations: 8 | summary: Prefix Service Down 9 | -------------------------------------------------------------------------------- /name-prefix-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | camel.springboot.name=name-prefix-service 2 | suffix.service.host.name=name-suffix-service 3 | 4 | server.port=8081 5 | server.address=0.0.0.0 6 | management.address=0.0.0.0 7 | 8 | camel.component.servlet.mapping.context-path=/api/* 9 | -------------------------------------------------------------------------------- /etc/prometheus/alertmanager/config.yml: -------------------------------------------------------------------------------- 1 | global: 2 | resolve_timeout: 5m 3 | route: 4 | group_by: ['job'] 5 | group_wait: 30s 6 | group_interval: 1m 7 | receiver: 'webhook' 8 | receivers: 9 | - name: 'webhook' 10 | webhook_configs: 11 | - url: 'http://alert-webhook-logger:9876/' 12 | -------------------------------------------------------------------------------- /name-suffix-service/src/main/fabric8/service.yml: -------------------------------------------------------------------------------- 1 | metadata: 2 | name: "name-suffix-service" 3 | spec: 4 | ports: 5 | - port: 80 6 | protocol: "TCP" 7 | targetPort: 8082 8 | name: http 9 | - port: 9779 10 | protocol: "TCP" 11 | targetPort: 9779 12 | name: prometheus 13 | type: "NodePort" -------------------------------------------------------------------------------- /name-client-service/src/main/WEB-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /name-prefix-service/src/main/fabric8/service.yml: -------------------------------------------------------------------------------- 1 | metadata: 2 | labels: 3 | name: "name-prefix-service" 4 | spec: 5 | ports: 6 | - port: 80 7 | protocol: "TCP" 8 | targetPort: 8081 9 | name: http 10 | - port: 9779 11 | protocol: "TCP" 12 | targetPort: 9779 13 | name: prometheus 14 | type: "NodePort" -------------------------------------------------------------------------------- /name-client-service/src/main/java/com/github/jamesnetherton/servlet/MetricsServlet.java: -------------------------------------------------------------------------------- 1 | package com.github.jamesnetherton.servlet; 2 | 3 | import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; 4 | 5 | import javax.servlet.annotation.WebServlet; 6 | 7 | @WebServlet(name = "HystrixMetricsStreamServlet", urlPatterns = {"/hystrix.stream"}) 8 | public class MetricsServlet extends HystrixMetricsStreamServlet { 9 | } -------------------------------------------------------------------------------- /name-suffix-service/src/main/resources/words.txt: -------------------------------------------------------------------------------- 1 | Burp 2 | Hall 3 | Ice 4 | Nut 5 | Duck 6 | Stove 7 | Muscle 8 | Flame 9 | Egg 10 | Crook 11 | Drain 12 | Sneeze 13 | Hose 14 | Glove 15 | Wood 16 | Bone 17 | Tooth 18 | Hall 19 | Ice 20 | Nut 21 | Duck 22 | Toothbrush 23 | Stove 24 | Muscle 25 | Flame 26 | Honey 27 | Bird 28 | Beer 29 | Burger 30 | Stranger 31 | Cheek 32 | Hat 33 | River 34 | Ladder 35 | Driver 36 | Ear 37 | Dirt 38 | Steak 39 | Farmer 40 | Cookie -------------------------------------------------------------------------------- /name-suffix-service/src/main/java/com/github/jamesnetherton/service/suffix/SuffixServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.github.jamesnetherton.service.suffix; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SuffixServiceApplication { 8 | 9 | public static void main(String args[]) { 10 | SpringApplication.run(SuffixServiceApplication.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /name-client-service/src/main/resources/names.txt: -------------------------------------------------------------------------------- 1 | Crissy 2 | Lynnette 3 | Concepcion 4 | Gearldine 5 | Tari 6 | Sherie 7 | Loria 8 | Magdalene 9 | Crystal 10 | Kacey 11 | Golda 12 | Thea 13 | Shavonda 14 | Renda 15 | Rebecka 16 | Maddie 17 | Ligia 18 | Dominque 19 | Joycelyn 20 | Bambi 21 | Bryan 22 | Kirk 23 | Desmond 24 | Willard 25 | Rene 26 | Domingo 27 | Brad 28 | Denny 29 | Teddy 30 | Junior 31 | Josh 32 | Nathaniel 33 | Reyes 34 | Eusebio 35 | Guillermo 36 | Emmanuel 37 | Wilburn 38 | Garfield 39 | Brenton 40 | Buford -------------------------------------------------------------------------------- /name-suffix-service/src/main/resources/lastnames.txt: -------------------------------------------------------------------------------- 1 | Seibold 2 | Morganella 3 | Boix 4 | Farneti 5 | Sabatello 6 | Conlon 7 | Harbron 8 | Forsberg 9 | Nakkula 10 | Berson 11 | Vorhaus 12 | Kotter 13 | Milenkovic 14 | Castagna 15 | Mann 16 | Rundlett 17 | Higonnet 18 | Strominger 19 | Jeffery 20 | Caligor 21 | Sailer 22 | Kubacki 23 | Adam 24 | Charrette 25 | Towne 26 | Mccall 27 | Meller 28 | Rankine 29 | Mahood 30 | Tabler 31 | Przekop 32 | Godoy 33 | Aisner 34 | Hartman 35 | Katsos 36 | Solc 37 | Ristich 38 | Josselson 39 | Alcantar 40 | Wiltse -------------------------------------------------------------------------------- /name-client-service/src/main/java/com/github/jamesnetherton/client/producer/KubernetesClientProducer.java: -------------------------------------------------------------------------------- 1 | package com.github.jamesnetherton.client.producer; 2 | 3 | import io.fabric8.kubernetes.client.DefaultKubernetesClient; 4 | import io.fabric8.kubernetes.client.KubernetesClient; 5 | 6 | import javax.enterprise.context.ApplicationScoped; 7 | import javax.enterprise.inject.Produces; 8 | 9 | @ApplicationScoped 10 | public class KubernetesClientProducer { 11 | 12 | @Produces 13 | public KubernetesClient kubernetesClient() { 14 | return new DefaultKubernetesClient(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /name-prefix-service/src/main/java/com/github/jamesnetherton/service/prefix/PrefixServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.github.jamesnetherton.service.prefix; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.web.servlet.ServletComponentScan; 6 | 7 | @SpringBootApplication 8 | @ServletComponentScan(basePackages = "com.github.jamesnetherton.service.prefix.servlet") 9 | public class PrefixServiceApplication { 10 | 11 | public static void main(String args[]) { 12 | SpringApplication.run(PrefixServiceApplication.class, args); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /etc/grafana/provisioning/datasources/datasource.yml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | deleteDatasources: 4 | - name: Prometheus 5 | orgId: 1 6 | 7 | datasources: 8 | - name: Prometheus 9 | type: prometheus 10 | access: proxy 11 | orgId: 1 12 | url: http://prometheus:9090 13 | password: 14 | user: 15 | database: 16 | basicAuth: false 17 | basicAuthUser: 18 | basicAuthPassword: 19 | withCredentials: 20 | isDefault: true 21 | jsonData: 22 | graphiteVersion: "1.1" 23 | tlsAuth: false 24 | tlsAuthWithCACert: false 25 | secureJsonData: 26 | tlsCACert: "..." 27 | tlsClientCert: "..." 28 | tlsClientKey: "..." 29 | version: 1 30 | editable: true 31 | -------------------------------------------------------------------------------- /name-client-service/src/main/java/com/github/jamesnetherton/client/producer/JaxrsClientProducer.java: -------------------------------------------------------------------------------- 1 | package com.github.jamesnetherton.client.producer; 2 | 3 | import io.opentracing.contrib.jaxrs2.client.ClientTracingFeature; 4 | 5 | import javax.enterprise.context.ApplicationScoped; 6 | import javax.enterprise.inject.Produces; 7 | import javax.ws.rs.client.Client; 8 | import javax.ws.rs.client.ClientBuilder; 9 | 10 | @ApplicationScoped 11 | public class JaxrsClientProducer { 12 | 13 | @Produces 14 | public Client resteasyClient() { 15 | return ClientBuilder.newBuilder() 16 | .register(ClientTracingFeature.class) 17 | .build(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.java.hsp 2 | *.sonarj 3 | *.sw* 4 | .DS_Store 5 | .settings 6 | .springBeans 7 | bin 8 | build.sh 9 | integration-repo 10 | ivy-cache 11 | jxl.log 12 | jmx.log 13 | derby.log 14 | spring-test/test-output/ 15 | .gradle 16 | argfile* 17 | activemq-data/ 18 | 19 | classes/ 20 | /build 21 | buildSrc/build 22 | /spring-*/build 23 | /src/asciidoc/build 24 | target/ 25 | 26 | # Eclipse artifacts, including WTP generated manifests 27 | .classpath 28 | .project 29 | spring-*/src/main/java/META-INF/MANIFEST.MF 30 | 31 | # IDEA artifacts and output dirs 32 | *.iml 33 | *.ipr 34 | *.iws 35 | .idea 36 | out 37 | test-output 38 | atlassian-ide-plugin.xml 39 | .gradletasknamecache 40 | 41 | etc/prometheus/alertmanager/data -------------------------------------------------------------------------------- /name-suffix-service/src/main/java/com/github/jamesnetherton/service/suffix/SuffixServiceRouteBuilder.java: -------------------------------------------------------------------------------- 1 | package com.github.jamesnetherton.service.suffix; 2 | 3 | import com.github.jamesnetherton.service.suffix.processor.LastNameProcessor; 4 | import org.apache.camel.builder.RouteBuilder; 5 | import org.springframework.stereotype.Component; 6 | 7 | @Component 8 | public class SuffixServiceRouteBuilder extends RouteBuilder { 9 | 10 | @Override 11 | public void configure() throws Exception { 12 | restConfiguration() 13 | .component("servlet") 14 | .contextPath("/api"); 15 | 16 | rest() 17 | .post("/name/suffix") 18 | .route().id("name-suffix-service") 19 | .process(new LastNameProcessor()); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /etc/prometheus/server/prometheus.yml: -------------------------------------------------------------------------------- 1 | global: 2 | scrape_interval: 15s 3 | evaluation_interval: 15s 4 | 5 | rule_files: 6 | - 'alert-rule-camel.yml' 7 | 8 | alerting: 9 | alertmanagers: 10 | - scheme: http 11 | static_configs: 12 | - targets: 13 | - 'alertmanager:9093' 14 | 15 | scrape_configs: 16 | 17 | - job_name: 'prometheus' 18 | 19 | static_configs: 20 | - targets: 21 | - 'localhost:9090' 22 | 23 | - job_name: 'cadvisor' 24 | 25 | static_configs: 26 | - targets: 27 | - 'cadvisor:8080' 28 | 29 | - job_name: 'node-exporter' 30 | 31 | static_configs: 32 | - targets: 33 | - 'node-exporter:9100' 34 | 35 | - job_name: 'camel-microservice-demo' 36 | 37 | static_configs: 38 | - targets: 39 | - 'name-client-service:9779' 40 | - 'name-prefix-service:9779' 41 | - 'name-suffix-service:9779' -------------------------------------------------------------------------------- /name-prefix-service/src/main/java/com/github/jamesnetherton/service/prefix/PrefixServiceRouteBuilder.java: -------------------------------------------------------------------------------- 1 | package com.github.jamesnetherton.service.prefix; 2 | 3 | import com.github.jamesnetherton.service.prefix.processor.TitleProcessor; 4 | import org.apache.camel.builder.RouteBuilder; 5 | import org.springframework.stereotype.Component; 6 | 7 | @Component 8 | public class PrefixServiceRouteBuilder extends RouteBuilder { 9 | 10 | @Override 11 | public void configure() throws Exception { 12 | restConfiguration() 13 | .contextPath("/api") 14 | .component("servlet"); 15 | 16 | rest() 17 | .post("/name/prefix") 18 | .route().routeId("name-prefix-service") 19 | .removeHeaders("CamelHttp*") 20 | .process(new TitleProcessor()) 21 | .to("http://{{suffix.service.host.name}}/api/name/suffix") 22 | .end(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /name-client-service/src/main/java/com/github/jamesnetherton/client/producer/PropertiesComponentProducer.java: -------------------------------------------------------------------------------- 1 | package com.github.jamesnetherton.client.producer; 2 | 3 | import org.apache.camel.component.properties.PropertiesComponent; 4 | 5 | import javax.enterprise.context.ApplicationScoped; 6 | import javax.enterprise.inject.Produces; 7 | import javax.inject.Named; 8 | import java.util.Map; 9 | import java.util.Properties; 10 | 11 | @ApplicationScoped 12 | public class PropertiesComponentProducer { 13 | 14 | @Produces 15 | @Named("properties") 16 | public PropertiesComponent propertiesComponent() { 17 | PropertiesComponent component = new PropertiesComponent(); 18 | Properties properties = new Properties(); 19 | 20 | for (Map.Entry env : System.getenv().entrySet()) { 21 | properties.put(env.getKey(), env.getValue()); 22 | } 23 | 24 | component.setInitialProperties(properties); 25 | return component; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /name-client-service/src/main/java/com/github/jamesnetherton/client/ClientServiceRouteBuilder.java: -------------------------------------------------------------------------------- 1 | package com.github.jamesnetherton.client; 2 | 3 | import com.github.jamesnetherton.lolcat4j.Lol; 4 | import org.apache.camel.builder.RouteBuilder; 5 | import org.apache.camel.cdi.ContextName; 6 | 7 | import javax.enterprise.context.ApplicationScoped; 8 | 9 | @ApplicationScoped 10 | @ContextName("client-camel-context") 11 | public class ClientServiceRouteBuilder extends RouteBuilder { 12 | 13 | @Override 14 | public void configure() throws Exception { 15 | from("timer:generateName?period=10000").id("name-client-service") 16 | .hystrix() 17 | .bean("nameGenerator") 18 | .onFallback() 19 | .setBody(constant("Sorry. Name could not be generated.")) 20 | .end() 21 | .process(exchange -> { 22 | String name = exchange.getIn().getBody(String.class); 23 | Lol lol = Lol.builder() 24 | .text(name) 25 | .build(); 26 | lol.cat(); 27 | }); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /name-client-service/src/main/fabric8/deployment.yml: -------------------------------------------------------------------------------- 1 | metadata: 2 | labels: 3 | hystrix.enabled: "true" 4 | spec: 5 | selector: 6 | matchLabels: 7 | hystrix.enabled: "true" 8 | template: 9 | metadata: 10 | labels: 11 | hystrix.enabled: "true" 12 | spec: 13 | serviceAccountName: "camel-microservice-demo" 14 | containers: 15 | - env: 16 | - name: "AB_OFF" 17 | value: "true" 18 | - name: "JAVA_OPTIONS" 19 | value: "-Djava.net.preferIPv4Stack=true" 20 | - name: "JAEGER_SERVICE_NAME" 21 | value: "camel-microservice-demo" 22 | - name: "JAEGER_REPORTER_LOG_SPANS" 23 | value: "false" 24 | - name: "JAEGER_SAMPLER_TYPE" 25 | value: "const" 26 | - name: "JAEGER_SAMPLER_PARAM" 27 | value: "1" 28 | - name: "JAEGER_AGENT_HOST" 29 | value: "opentracing" 30 | - name: "JAEGER_AGENT_PORT" 31 | value: "6831" 32 | readinessProbe: 33 | httpGet: 34 | path: /health 35 | port: 8080 36 | scheme: HTTP 37 | livenessProbe: 38 | httpGet: 39 | path: /health 40 | port: 8080 41 | scheme: HTTP 42 | initialDelaySeconds: 180 -------------------------------------------------------------------------------- /name-prefix-service/src/main/java/com/github/jamesnetherton/service/prefix/processor/TitleProcessor.java: -------------------------------------------------------------------------------- 1 | package com.github.jamesnetherton.service.prefix.processor; 2 | 3 | import org.apache.camel.Exchange; 4 | import org.apache.camel.Processor; 5 | 6 | import java.io.BufferedReader; 7 | import java.io.IOException; 8 | import java.io.InputStream; 9 | import java.io.InputStreamReader; 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | import java.util.Random; 13 | 14 | public class TitleProcessor implements Processor { 15 | private List titles = new ArrayList<>(); 16 | private Random random = new Random(); 17 | 18 | public TitleProcessor() { 19 | InputStream resource = TitleProcessor.class.getClassLoader().getResourceAsStream("titles.txt"); 20 | if (resource == null) { 21 | throw new IllegalStateException("Unable to load titles"); 22 | } 23 | 24 | try(BufferedReader reader = new BufferedReader(new InputStreamReader(resource))) { 25 | String line; 26 | while((line = reader.readLine()) != null) { 27 | titles.add(line); 28 | } 29 | } catch (IOException e) { 30 | throw new IllegalStateException("Error reading titles", e); 31 | } 32 | } 33 | 34 | @Override 35 | public void process(Exchange exchange) throws Exception { 36 | String name = exchange.getIn().getHeader("name", String.class); 37 | String randomTitle = titles.get(random.nextInt(titles.size() - 1)); 38 | 39 | exchange.getOut().setBody(randomTitle + " " + name); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /name-suffix-service/src/main/java/com/github/jamesnetherton/service/suffix/processor/LastNameProcessor.java: -------------------------------------------------------------------------------- 1 | package com.github.jamesnetherton.service.suffix.processor; 2 | 3 | import org.apache.camel.Exchange; 4 | import org.apache.camel.Processor; 5 | 6 | import java.io.BufferedReader; 7 | import java.io.IOException; 8 | import java.io.InputStream; 9 | import java.io.InputStreamReader; 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | import java.util.Random; 13 | 14 | public class LastNameProcessor implements Processor { 15 | private List lastNames = new ArrayList<>(); 16 | private List words = new ArrayList<>(); 17 | private Random random = new Random(); 18 | 19 | public LastNameProcessor() { 20 | buildList(lastNames, "lastnames.txt"); 21 | buildList(words, "words.txt"); 22 | } 23 | 24 | @Override 25 | public void process(Exchange exchange) throws Exception { 26 | String name = exchange.getIn().getBody(String.class); 27 | String randomLastName = lastNames.get(random.nextInt(lastNames.size() - 1)); 28 | String randomWord = words.get(random.nextInt(words.size() - 1)); 29 | 30 | exchange.getIn().setBody(name + " " + randomLastName + "-" + randomWord); 31 | } 32 | 33 | private void buildList(List list, String resource) { 34 | InputStream inputStream = LastNameProcessor.class.getClassLoader().getResourceAsStream(resource); 35 | 36 | if (inputStream == null) { 37 | throw new IllegalStateException("InputStream is null"); 38 | } 39 | 40 | try(BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) { 41 | String line; 42 | while((line = reader.readLine()) != null) { 43 | list.add(line); 44 | } 45 | } catch (IOException e) { 46 | throw new IllegalStateException("Error reading from InputStream", e); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /name-suffix-service/src/main/java/com/github/jamesnetherton/service/suffix/OpenTracingConfig.java: -------------------------------------------------------------------------------- 1 | package com.github.jamesnetherton.service.suffix; 2 | 3 | import io.jaegertracing.samplers.ConstSampler; 4 | import org.apache.camel.CamelContext; 5 | import org.apache.camel.opentracing.OpenTracingTracer; 6 | import org.springframework.beans.factory.annotation.Value; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | 10 | @Configuration 11 | public class OpenTracingConfig { 12 | 13 | @Bean 14 | public io.jaegertracing.Configuration jaegerConfiguration(@Value("#{environment['OPENTRACING_SERVICE_HOST'] ?: 'localhost'}") String host, 15 | @Value("#{environment['OPENTRACING_SERVICE_PORT_OPENTRACING_DATA'] ?: 6831}") int port) { 16 | io.jaegertracing.Configuration.SamplerConfiguration samplerConfig = new io.jaegertracing.Configuration.SamplerConfiguration() 17 | .withType(ConstSampler.TYPE) 18 | .withParam(1); 19 | io.jaegertracing.Configuration.SenderConfiguration senderConfig = new io.jaegertracing.Configuration.SenderConfiguration() 20 | .withAgentHost(host) 21 | .withAgentPort(port); 22 | io.jaegertracing.Configuration.ReporterConfiguration reporterConfig = new io.jaegertracing.Configuration.ReporterConfiguration() 23 | .withLogSpans(true) 24 | .withFlushInterval(1000) 25 | .withMaxQueueSize(10000) 26 | .withSender(senderConfig); 27 | return new io.jaegertracing.Configuration("name-suffix-service") 28 | .withSampler(samplerConfig) 29 | .withReporter(reporterConfig); 30 | } 31 | 32 | @Bean 33 | public OpenTracingTracer openTracingTracer(io.jaegertracing.Configuration jaegerConfiguration, CamelContext camelContext) { 34 | OpenTracingTracer tracer = new OpenTracingTracer(); 35 | tracer.setTracer(jaegerConfiguration.getTracer()); 36 | tracer.init(camelContext); 37 | return tracer; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /name-prefix-service/src/main/resources/titles.txt: -------------------------------------------------------------------------------- 1 | Mr 2 | Mrs 3 | Ms 4 | Miss 5 | Dr 6 | Herr 7 | Monsieur 8 | Hr 9 | Frau 10 | Admiraal 11 | Admiral 12 | Air Cdre 13 | Air Commodore 14 | Air Marshal 15 | Air Vice Marshal 16 | Alderman 17 | Alhaji 18 | Ambassador 19 | Baron 20 | Barones 21 | Brig 22 | Brig Gen 23 | Brig General 24 | Brigadier 25 | Brigadier General 26 | Brother 27 | Canon 28 | Capt 29 | Captain 30 | Cardinal 31 | Cdr 32 | Chief 33 | Cik 34 | Cmdr 35 | Col 36 | Col Dr 37 | Colonel 38 | Commandant 39 | Commander 40 | Commissioner 41 | Commodore 42 | Comte 43 | Comtessa 44 | Congressman 45 | Conseiller 46 | Consul 47 | Conte 48 | Contessa 49 | Corporal 50 | Councillor 51 | Count 52 | Countess 53 | Crown Prince 54 | Crown Princess 55 | Dame 56 | Datin 57 | Dato 58 | Datuk 59 | Datuk Seri 60 | Deacon 61 | Deaconess 62 | Dean 63 | Dhr 64 | Dipl Ing 65 | Doctor 66 | Dott 67 | Dott sa 68 | Dr 69 | Dr Ing 70 | Dra 71 | Drs 72 | Embajador 73 | Embajadora 74 | En 75 | Encik 76 | Eng 77 | Eur Ing 78 | Exma Sra 79 | Exmo Sr 80 | F O 81 | Father 82 | First Lieutient 83 | First Officer 84 | Flt Lieut 85 | Flying Officer 86 | Fr 87 | Frau 88 | Fraulein 89 | Fru 90 | Gen 91 | Generaal 92 | General 93 | Governor 94 | Graaf 95 | Gravin 96 | Group Captain 97 | Grp Capt 98 | H E Dr 99 | H H 100 | H M 101 | H R H 102 | Hajah 103 | Haji 104 | Hajim 105 | Her Highness 106 | Her Majesty 107 | Herr 108 | High Chief 109 | His Highness 110 | His Holiness 111 | His Majesty 112 | Hon 113 | Hr 114 | Hra 115 | Ing 116 | Ir 117 | Jonkheer 118 | Judge 119 | Justice 120 | Khun Ying 121 | Kolonel 122 | Lady 123 | Lcda 124 | Lic 125 | Lieut 126 | Lieut Cdr 127 | Lieut Col 128 | Lieut Gen 129 | Lord 130 | M 131 | M L 132 | M R 133 | Madame 134 | Mademoiselle 135 | Maj Gen 136 | Major 137 | Master 138 | Mevrouw 139 | Miss 140 | Mlle 141 | Mme 142 | Monsieur 143 | Monsignor 144 | Mr 145 | Mrs 146 | Ms 147 | Mstr 148 | Nti 149 | Pastor 150 | President 151 | Prince 152 | Princess 153 | Princesse 154 | Prinses 155 | Prof 156 | Prof Dr 157 | Prof Sir 158 | Professor 159 | Puan 160 | Puan Sri 161 | Rabbi 162 | Rear Admiral 163 | Rev 164 | Rev Canon 165 | Rev Dr 166 | Rev Mother 167 | Reverend 168 | Rva 169 | Senator 170 | Sergeant 171 | Sheikh 172 | Sheikha 173 | Sig 174 | Sig na 175 | Sig ra 176 | Sir 177 | Sister 178 | Sqn Ldr 179 | Sr 180 | Sr D 181 | Sra 182 | Srta 183 | Sultan 184 | Tan Sri 185 | Tan Sri Dato 186 | Tengku 187 | Teuku 188 | Than Puying 189 | The Hon Dr 190 | The Hon Justice 191 | The Hon Miss 192 | The Hon Mr 193 | The Hon Mrs 194 | The Hon Ms 195 | The Hon Sir 196 | The Very Rev 197 | Toh Puan 198 | Tun 199 | Vice Admiral 200 | Viscount 201 | Viscountess 202 | Wg Cdr -------------------------------------------------------------------------------- /name-client-service/src/main/java/com/github/jamesnetherton/client/generator/NameGenerator.java: -------------------------------------------------------------------------------- 1 | package com.github.jamesnetherton.client.generator; 2 | 3 | import org.apache.camel.PropertyInject; 4 | 5 | import javax.enterprise.context.ApplicationScoped; 6 | import javax.inject.Inject; 7 | import javax.inject.Named; 8 | import javax.ws.rs.client.Client; 9 | import javax.ws.rs.client.Entity; 10 | import javax.ws.rs.core.Form; 11 | import javax.ws.rs.core.Response; 12 | import java.io.BufferedReader; 13 | import java.io.IOException; 14 | import java.io.InputStream; 15 | import java.io.InputStreamReader; 16 | import java.util.ArrayList; 17 | import java.util.List; 18 | import java.util.Random; 19 | 20 | import static javax.ws.rs.core.Response.Status.OK; 21 | 22 | @ApplicationScoped 23 | @Named("nameGenerator") 24 | public class NameGenerator { 25 | private List names = new ArrayList<>(); 26 | private Random random = new Random(); 27 | 28 | @Inject 29 | private Client client; 30 | 31 | @PropertyInject(value = "NAME_PREFIX_SERVICE_SERVICE_HOST", defaultValue = "localhost:8081") 32 | private String prefixServiceHost; 33 | 34 | public NameGenerator() { 35 | InputStream resource = NameGenerator.class.getClassLoader().getResourceAsStream("/names.txt"); 36 | if (resource == null) { 37 | throw new IllegalStateException("Unable to load names"); 38 | } 39 | 40 | try (BufferedReader reader = new BufferedReader(new InputStreamReader(resource))) { 41 | String line; 42 | while ((line = reader.readLine()) != null) { 43 | names.add(line); 44 | } 45 | } catch (IOException e) { 46 | throw new IllegalStateException("Error reading names", e); 47 | } 48 | } 49 | 50 | public String generateName() { 51 | String result = ""; 52 | String randomName = names.get(random.nextInt(names.size() - 1)); 53 | 54 | Form form = new Form(); 55 | form.param("name", randomName); 56 | 57 | Entity
entity = Entity.form(form); 58 | 59 | Response response = client.target("http://" + prefixServiceHost + "/api/name/prefix") 60 | .request() 61 | .post(entity); 62 | 63 | if (response != null) { 64 | int statusCode = response.getStatus(); 65 | if (statusCode != OK.getStatusCode()) { 66 | response.close(); 67 | throw new IllegalStateException("Name prefix service returned status code" + statusCode); 68 | } 69 | 70 | result = response.readEntity(String.class); 71 | response.close(); 72 | } else { 73 | throw new IllegalStateException("Unable to retrieve client response"); 74 | } 75 | 76 | return result; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.0.0 5 | 6 | com.github.jamesnetherton 7 | microservice-demo-parent 8 | 1.0-SNAPSHOT 9 | pom 10 | 11 | Microservice Demo :: Parent 12 | 13 | 14 | UTF-8 15 | 16 | 3.0.0-RC2 17 | 1.5.5 18 | 0.27.0 19 | 1.4.7 20 | 0.3.0 21 | 0.3.1 22 | 2.1.7.RELEASE 23 | 2.2.1.Final 24 | 25 | 4.1.0 26 | 3.8.0 27 | 3.0.0-M3 28 | 3.0.0-M3 29 | 3.2.2 30 | 31 | 32 | 33 | name-suffix-service 34 | name-prefix-service 35 | name-client-service 36 | 37 | 38 | 39 | 40 | 41 | 42 | org.apache.maven.plugins 43 | maven-compiler-plugin 44 | ${version.maven.compiler.plugin} 45 | 46 | 1.8 47 | 1.8 48 | 49 | 50 | 51 | org.apache.maven.plugins 52 | maven-war-plugin 53 | ${version.maven.war.plugin} 54 | 55 | 56 | io.fabric8 57 | fabric8-maven-plugin 58 | ${version.fabric8.maven.plugin} 59 | 60 | 61 | org.springframework.boot 62 | spring-boot-maven-plugin 63 | ${version.org.springframework.spring.boot} 64 | 65 | 66 | io.thorntail 67 | thorntail-maven-plugin 68 | ${version.io.throntail} 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /name-suffix-service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | 7 | 8 | com.github.jamesnetherton 9 | microservice-demo-parent 10 | 1.0-SNAPSHOT 11 | 12 | 13 | microservice-demo-suffix-service 14 | 15 | Microservice Demo :: Name Suffix Client Service 16 | Generates a new name by invoking upstream services 17 | 18 | 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-dependencies 23 | ${version.org.springframework.spring.boot} 24 | pom 25 | import 26 | 27 | 28 | org.apache.camel 29 | camel-spring-boot-dependencies 30 | ${version.org.apache.camel} 31 | pom 32 | import 33 | 34 | 35 | 36 | 37 | 38 | 39 | org.springframework.boot 40 | spring-boot-starter-web 41 | 42 | 43 | org.springframework.boot 44 | spring-boot-starter-actuator 45 | 46 | 47 | 48 | org.apache.camel 49 | camel-spring-boot-starter 50 | 51 | 52 | org.apache.camel 53 | camel-servlet-starter 54 | 55 | 56 | org.apache.camel 57 | camel-opentracing-starter 58 | 59 | 60 | 61 | io.jaegertracing 62 | jaeger-core 63 | ${version.io.jaegertracing} 64 | 65 | 66 | 67 | 68 | spring-boot:run 69 | 70 | 71 | 72 | org.springframework.boot 73 | spring-boot-maven-plugin 74 | 75 | 76 | 77 | repackage 78 | 79 | 80 | 81 | 82 | 83 | io.fabric8 84 | fabric8-maven-plugin 85 | 86 | 87 | 88 | resource 89 | build 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /name-client-service/src/main/java/com/github/jamesnetherton/client/watcher/ConfigMapWatcher.java: -------------------------------------------------------------------------------- 1 | package com.github.jamesnetherton.client.watcher; 2 | 3 | import io.fabric8.kubernetes.api.model.ConfigMap; 4 | import io.fabric8.kubernetes.client.KubernetesClient; 5 | import io.fabric8.kubernetes.client.KubernetesClientException; 6 | import io.fabric8.kubernetes.client.Watcher; 7 | import org.apache.camel.CamelContext; 8 | import org.apache.camel.Route; 9 | import org.apache.camel.component.timer.TimerConsumer; 10 | import org.apache.camel.management.event.CamelContextStartingEvent; 11 | import org.apache.camel.management.event.CamelContextStoppingEvent; 12 | import org.slf4j.Logger; 13 | import org.slf4j.LoggerFactory; 14 | 15 | import javax.enterprise.context.ApplicationScoped; 16 | import javax.enterprise.event.Observes; 17 | import javax.inject.Inject; 18 | 19 | @ApplicationScoped 20 | public class ConfigMapWatcher { 21 | 22 | private static final Logger LOG = LoggerFactory.getLogger(ConfigMapWatcher.class); 23 | 24 | @Inject 25 | private KubernetesClient client; 26 | 27 | public void onContextStarting(@Observes CamelContextStartingEvent event) { 28 | 29 | /** 30 | * This is a bit of a hack to adjust the timer endpoint period parameter on-the-fly from a ConfigMap update. 31 | * 32 | * Alternatives could have been to use: 33 | * - JMX 34 | * - For Spring applications - Spring Cloud Kubernetes provides OOTB support for application reloads from ConfigMap changes 35 | * 36 | * https://github.com/fabric8io/spring-cloud-kubernetes 37 | */ 38 | if (isRunningInKubernetes()) { 39 | CamelContext context = event.getContext(); 40 | 41 | client.configMaps().watch(new Watcher() { 42 | @Override 43 | public void eventReceived(Action action, ConfigMap configMap) { 44 | if (action.equals(Action.MODIFIED) && configMap.getMetadata().getName().equals("client-service-config")) { 45 | LOG.info("Reloading config map"); 46 | 47 | String timerPeriod = configMap.getData().get("timer.period"); 48 | Route route = context.getRoute("name-client-service"); 49 | if (route == null) { 50 | LOG.error("Failed updating timer.period. Route name-client-service not found."); 51 | return; 52 | } 53 | 54 | TimerConsumer consumer = (TimerConsumer) route.getConsumer(); 55 | LOG.info("Adjusting timer period to {}ms", timerPeriod); 56 | consumer.getEndpoint().setPeriod(Long.parseLong(timerPeriod)); 57 | 58 | LOG.info("Restarting consumer"); 59 | try { 60 | consumer.stop(); 61 | consumer.start(); 62 | } catch (Exception e) { 63 | LOG.error("Error restarting consumer {}", e); 64 | } 65 | } 66 | } 67 | 68 | @Override 69 | public void onClose(KubernetesClientException e) { 70 | } 71 | }); 72 | } 73 | } 74 | 75 | public void onContextStopping(@Observes CamelContextStoppingEvent event) { 76 | client.close(); 77 | } 78 | 79 | private boolean isRunningInKubernetes() { 80 | return System.getenv("KUBERNETES_SERVICE_HOST") != null; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /name-prefix-service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | 7 | 8 | com.github.jamesnetherton 9 | microservice-demo-parent 10 | 1.0-SNAPSHOT 11 | 12 | 13 | microservice-demo-prefix-service 14 | 15 | Microservice Demo :: Name Prefix Client Service 16 | Generates a new name by invoking upstream services 17 | 18 | 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-dependencies 23 | ${version.org.springframework.spring.boot} 24 | pom 25 | import 26 | 27 | 28 | org.apache.camel 29 | camel-parent 30 | ${version.org.apache.camel} 31 | pom 32 | import 33 | 34 | 35 | 36 | 37 | 38 | 39 | org.springframework.boot 40 | spring-boot-starter-web 41 | 42 | 43 | org.springframework.boot 44 | spring-boot-starter-actuator 45 | 46 | 47 | 48 | org.apache.camel 49 | camel-spring-boot-starter 50 | 51 | 52 | org.apache.camel 53 | camel-http-starter 54 | 55 | 56 | org.apache.camel 57 | camel-servlet-starter 58 | 59 | 60 | org.apache.camel 61 | camel-opentracing-starter 62 | 63 | 64 | 65 | io.jaegertracing 66 | jaeger-core 67 | ${version.io.jaegertracing} 68 | 69 | 70 | 71 | 72 | spring-boot:run 73 | 74 | 75 | 76 | org.springframework.boot 77 | spring-boot-maven-plugin 78 | 79 | 80 | --suffix.service.host.name=localhost:8082 81 | 82 | 83 | 84 | 85 | 86 | repackage 87 | 88 | 89 | 90 | 91 | 92 | io.fabric8 93 | fabric8-maven-plugin 94 | 95 | 96 | 97 | resource 98 | build 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /name-prefix-service/src/main/java/com/github/jamesnetherton/service/prefix/OpenTracingConfig.java: -------------------------------------------------------------------------------- 1 | package com.github.jamesnetherton.service.prefix; 2 | 3 | import io.jaegertracing.samplers.ConstSampler; 4 | import org.apache.camel.CamelContext; 5 | import org.apache.camel.Exchange; 6 | import org.apache.camel.NamedNode; 7 | import org.apache.camel.Route; 8 | import org.apache.camel.opentracing.OpenTracingTracer; 9 | import org.apache.camel.spi.RoutePolicy; 10 | import org.apache.camel.spi.RoutePolicyFactory; 11 | import org.apache.camel.support.RoutePolicySupport; 12 | import org.springframework.beans.factory.annotation.Value; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | 16 | import java.io.UnsupportedEncodingException; 17 | import java.net.URLDecoder; 18 | import java.util.List; 19 | 20 | @Configuration 21 | public class OpenTracingConfig { 22 | 23 | @Bean 24 | public io.jaegertracing.Configuration jaegerConfiguration(@Value("#{environment['OPENTRACING_SERVICE_HOST'] ?: 'localhost'}") String host, 25 | @Value("#{environment['OPENTRACING_SERVICE_PORT_OPENTRACING_DATA'] ?: 6831}") int port) { 26 | io.jaegertracing.Configuration.SamplerConfiguration samplerConfig = new io.jaegertracing.Configuration.SamplerConfiguration() 27 | .withType(ConstSampler.TYPE) 28 | .withParam(1); 29 | io.jaegertracing.Configuration.SenderConfiguration senderConfig = new io.jaegertracing.Configuration.SenderConfiguration() 30 | .withAgentHost(host) 31 | .withAgentPort(port); 32 | io.jaegertracing.Configuration.ReporterConfiguration reporterConfig = new io.jaegertracing.Configuration.ReporterConfiguration() 33 | .withLogSpans(true) 34 | .withFlushInterval(1000) 35 | .withMaxQueueSize(10000) 36 | .withSender(senderConfig); 37 | return new io.jaegertracing.Configuration("name-prefix-service") 38 | .withSampler(samplerConfig) 39 | .withReporter(reporterConfig); 40 | } 41 | 42 | @Bean 43 | public OpenTracingTracer openTracingTracer(io.jaegertracing.Configuration jaegerConfiguration, CamelContext camelContext) { 44 | // This is a hack to manually decode the uber-trace-id header value because camel forces use of TEXT_MAP format 45 | List routePolicyFactories = camelContext.getRoutePolicyFactories(); 46 | routePolicyFactories.add(0, new TraceIdDecodingRoutePolicyFactory()); 47 | 48 | OpenTracingTracer tracer = new OpenTracingTracer(); 49 | tracer.setTracer(jaegerConfiguration.getTracer()); 50 | tracer.init(camelContext); 51 | return tracer; 52 | } 53 | 54 | static class TraceIdDecodingRoutePolicyFactory implements RoutePolicyFactory { 55 | @Override 56 | public RoutePolicy createRoutePolicy(CamelContext camelContext, String routeId, NamedNode route) { 57 | return new TraceIdDecodingRoutePolicy(); 58 | } 59 | } 60 | 61 | static class TraceIdDecodingRoutePolicy extends RoutePolicySupport { 62 | 63 | private static final String HEADER_UBER_TRACE_ID = "uber-trace-id"; 64 | 65 | @Override 66 | public void onExchangeBegin(Route route, Exchange exchange) { 67 | String traceId = exchange.getIn().getHeader(HEADER_UBER_TRACE_ID, String.class); 68 | if (traceId != null) { 69 | try { 70 | exchange.getIn().setHeader(HEADER_UBER_TRACE_ID, URLDecoder.decode(traceId, "UTF-8")); 71 | } catch (UnsupportedEncodingException e) { 72 | throw new RuntimeException(e); 73 | } 74 | } 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.3' 2 | 3 | services: 4 | 5 | alertmanager: 6 | container_name: alertmanager 7 | image: prom/alertmanager 8 | depends_on: 9 | - alert-webhook-logger 10 | ports: 11 | - 9093:9093 12 | volumes: 13 | - ./etc/prometheus/alertmanager/:/etc/alertmanager/ 14 | command: 15 | - '--config.file=/etc/alertmanager/config.yml' 16 | 17 | alert-webhook-logger: 18 | container_name: alert-webhook-logger 19 | image: jamesnetherton/alert-webhook-logger 20 | ports: 21 | - 9876:9876 22 | 23 | cadvisor: 24 | container_name: cadvisor 25 | image: google/cadvisor 26 | volumes: 27 | - /:/rootfs:ro 28 | - /var/run:/var/run:rw 29 | - /sys:/sys:ro 30 | - /var/lib/docker/:/var/lib/docker:ro 31 | ports: 32 | - 8181:8080 33 | 34 | grafana: 35 | container_name: grafana 36 | image: grafana/grafana 37 | user: "472" 38 | depends_on: 39 | - prometheus 40 | environment: 41 | GF_AUTH_DISABLE_LOGIN_FORM: "true" 42 | GF_AUTH_ANONYMOUS_ENABLED: "true" 43 | ports: 44 | - 3000:3000 45 | volumes: 46 | - ./etc/grafana/provisioning/:/etc/grafana/provisioning/ 47 | 48 | name-suffix-service: 49 | container_name: name-suffix-service 50 | depends_on: 51 | - opentracing 52 | - grafana 53 | image: jamesnetherton/microservice-demo-suffix-service:latest 54 | ports: 55 | - "8082:8082" 56 | volumes: 57 | - ./etc/prometheus/agent/prometheus-config.yml:/opt/agent-bond/jmx_exporter_config.yml 58 | 59 | name-prefix-service: 60 | container_name: name-prefix-service 61 | depends_on: 62 | - name-suffix-service 63 | image: jamesnetherton/microservice-demo-prefix-service:latest 64 | environment: 65 | JAVA_OPTIONS: -Dsuffix.service.host.name=name-suffix-service:8082 66 | ports: 67 | - "8081:8081" 68 | volumes: 69 | - ./etc/prometheus/agent/prometheus-config.yml:/opt/agent-bond/jmx_exporter_config.yml 70 | 71 | name-client-service: 72 | container_name: name-client-service 73 | depends_on: 74 | - name-prefix-service 75 | image: jamesnetherton/microservice-demo-client-service:latest 76 | environment: 77 | AB_OFF: "true" 78 | JAEGER_SERVICE_NAME: camel-microservice-demo 79 | JAEGER_REPORTER_LOG_SPANS: "false" 80 | JAEGER_SAMPLER_TYPE: "const" 81 | JAEGER_SAMPLER_PARAM: 1 82 | JAEGER_AGENT_HOST: opentracing 83 | JAEGER_AGENT_PORT: 6831 84 | JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true 85 | NAME_PREFIX_SERVICE_SERVICE_HOST: name-prefix-service:8081 86 | ports: 87 | - "8080:8080" 88 | 89 | node-exporter: 90 | container_name: node-exporter 91 | image: prom/node-exporter 92 | volumes: 93 | - /proc:/host/proc:ro 94 | - /sys:/host/sys:ro 95 | - /:/rootfs:ro 96 | command: 97 | - '--path.procfs=/host/proc' 98 | - '--path.sysfs=/host/sys' 99 | - --collector.filesystem.ignored-mount-points 100 | - "^/(sys|proc|dev|host|etc|rootfs/var/lib/docker/containers|rootfs/var/lib/docker/overlay2|rootfs/run/docker/netns|rootfs/var/lib/docker/aufs)($$|/)" 101 | ports: 102 | - 9100:9100 103 | 104 | opentracing: 105 | container_name: opentracing 106 | image: jaegertracing/all-in-one:latest 107 | ports: 108 | - "6831:6831/udp" 109 | - "16686:16686" 110 | 111 | prometheus: 112 | container_name: prometheus 113 | image: prom/prometheus:v2.5.0 114 | volumes: 115 | - ./etc/prometheus/server/:/etc/prometheus/ 116 | command: 117 | - '--config.file=/etc/prometheus/prometheus.yml' 118 | ports: 119 | - 9090:9090 120 | depends_on: 121 | - alertmanager 122 | - cadvisor 123 | -------------------------------------------------------------------------------- /name-client-service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | 7 | 8 | com.github.jamesnetherton 9 | microservice-demo-parent 10 | 1.0-SNAPSHOT 11 | 12 | 13 | microservice-demo-client-service 14 | war 15 | 16 | Microservice Demo :: Name Client Service 17 | Generates a new name by invoking upstream services 18 | 19 | 20 | 21 | 22 | io.thorntail 23 | bom 24 | ${version.io.throntail} 25 | import 26 | pom 27 | 28 | 29 | 30 | 31 | 32 | 33 | io.thorntail 34 | camel-cdi 35 | 36 | 37 | io.thorntail 38 | jaeger 39 | 40 | 41 | io.thorntail 42 | microprofile-health 43 | 44 | 45 | io.thorntail 46 | jaxrs 47 | 48 | 49 | com.github.jamesnetherton 50 | lolcat4j 51 | ${version.com.github.jamesnetherton.lolcat4j} 52 | 53 | 54 | com.netflix.hystrix 55 | hystrix-metrics-event-stream 56 | ${hystrix.verson} 57 | 58 | 59 | io.fabric8 60 | kubernetes-client 61 | ${version.io.fabric8.kubernetes.client} 62 | 63 | 64 | io.opentracing.contrib 65 | opentracing-jaxrs2 66 | ${version.io.opentracing.jaxrs2} 67 | 68 | 69 | 70 | org.apache.camel 71 | camel-hystrix 72 | 2.19.0 73 | 74 | 75 | 76 | 77 | 78 | 79 | org.apache.maven.plugins 80 | maven-war-plugin 81 | 82 | 83 | io.thorntail 84 | thorntail-maven-plugin 85 | 86 | 87 | package 88 | 89 | package 90 | 91 | 92 | 93 | run 94 | 95 | run 96 | 97 | 98 | 99 | true 100 | 101 | 102 | localhost:8081 103 | 104 | 105 | 106 | 107 | 108 | 109 | io.fabric8 110 | fabric8-maven-plugin 111 | 112 | 113 | 114 | 115 | webapp 116 | 117 | 118 | 119 | 120 | 121 | 122 | resource 123 | build 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | import java.net.*; 21 | import java.io.*; 22 | import java.nio.channels.*; 23 | import java.util.Properties; 24 | 25 | public class MavenWrapperDownloader { 26 | 27 | /** 28 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 29 | */ 30 | private static final String DEFAULT_DOWNLOAD_URL = 31 | "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; 32 | 33 | /** 34 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 35 | * use instead of the default one. 36 | */ 37 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 38 | ".mvn/wrapper/maven-wrapper.properties"; 39 | 40 | /** 41 | * Path where the maven-wrapper.jar will be saved to. 42 | */ 43 | private static final String MAVEN_WRAPPER_JAR_PATH = 44 | ".mvn/wrapper/maven-wrapper.jar"; 45 | 46 | /** 47 | * Name of the property which should be used to override the default download url for the wrapper. 48 | */ 49 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 50 | 51 | public static void main(String args[]) { 52 | System.out.println("- Downloader started"); 53 | File baseDirectory = new File(args[0]); 54 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 55 | 56 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 57 | // wrapperUrl parameter. 58 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 59 | String url = DEFAULT_DOWNLOAD_URL; 60 | if(mavenWrapperPropertyFile.exists()) { 61 | FileInputStream mavenWrapperPropertyFileInputStream = null; 62 | try { 63 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 64 | Properties mavenWrapperProperties = new Properties(); 65 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 66 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 67 | } catch (IOException e) { 68 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 69 | } finally { 70 | try { 71 | if(mavenWrapperPropertyFileInputStream != null) { 72 | mavenWrapperPropertyFileInputStream.close(); 73 | } 74 | } catch (IOException e) { 75 | // Ignore ... 76 | } 77 | } 78 | } 79 | System.out.println("- Downloading from: : " + url); 80 | 81 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 82 | if(!outputFile.getParentFile().exists()) { 83 | if(!outputFile.getParentFile().mkdirs()) { 84 | System.out.println( 85 | "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 86 | } 87 | } 88 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 89 | try { 90 | downloadFileFromURL(url, outputFile); 91 | System.out.println("Done"); 92 | System.exit(0); 93 | } catch (Throwable e) { 94 | System.out.println("- Error downloading"); 95 | e.printStackTrace(); 96 | System.exit(1); 97 | } 98 | } 99 | 100 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 101 | URL website = new URL(urlString); 102 | ReadableByteChannel rbc; 103 | rbc = Channels.newChannel(website.openStream()); 104 | FileOutputStream fos = new FileOutputStream(destination); 105 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 106 | fos.close(); 107 | rbc.close(); 108 | } 109 | 110 | } 111 | -------------------------------------------------------------------------------- /deployment-kubernetes.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: "v1" 3 | items: 4 | - apiVersion: "v1" 5 | kind: "ServiceAccount" 6 | metadata: 7 | name: "camel-microservice-demo" 8 | - apiVersion: rbac.authorization.k8s.io/v1beta1 9 | kind: Role 10 | metadata: 11 | name: camel-microservice-demo-role 12 | rules: 13 | - apiGroups: [""] 14 | resources: ["endpoints", "configmaps"] 15 | verbs: ["get", "list", "watch"] 16 | - apiVersion: rbac.authorization.k8s.io/v1beta1 17 | kind: RoleBinding 18 | metadata: 19 | name: camel-microservice-demo-role-binding 20 | subjects: 21 | - kind: ServiceAccount 22 | name: camel-microservice-demo 23 | apiGroup: "" 24 | roleRef: 25 | kind: Role 26 | name: camel-microservice-demo-role 27 | apiGroup: "" 28 | - apiVersion: "extensions/v1beta1" 29 | kind: "Deployment" 30 | metadata: 31 | labels: 32 | project: "hystrix-dashboard" 33 | provider: "fabric8" 34 | group: "io.fabric8.kubeflix" 35 | name: "hystrix-dashboard" 36 | spec: 37 | replicas: 1 38 | selector: 39 | matchLabels: 40 | project: "hystrix-dashboard" 41 | provider: "fabric8" 42 | group: "io.fabric8.kubeflix" 43 | template: 44 | metadata: 45 | labels: 46 | project: "hystrix-dashboard" 47 | provider: "fabric8" 48 | group: "io.fabric8.kubeflix" 49 | spec: 50 | containers: 51 | - env: 52 | - name: "KUBERNETES_NAMESPACE" 53 | valueFrom: 54 | fieldRef: 55 | fieldPath: "metadata.namespace" 56 | image: "jamesnetherton/hystrix-dashboard:1.0.26" 57 | imagePullPolicy: "IfNotPresent" 58 | name: "hystrix-dashboard" 59 | ports: 60 | - containerPort: 8080 61 | name: "http" 62 | readinessProbe: 63 | httpGet: 64 | path: / 65 | port: 8080 66 | scheme: HTTP 67 | livenessProbe: 68 | httpGet: 69 | path: / 70 | port: 8080 71 | scheme: HTTP 72 | initialDelaySeconds: 180 73 | serviceAccountName: "camel-microservice-demo" 74 | - apiVersion: "extensions/v1beta1" 75 | kind: "Deployment" 76 | metadata: 77 | labels: 78 | project: "turbine-server" 79 | provider: "fabric8" 80 | group: "io.fabric8.kubeflix" 81 | name: "turbine-server" 82 | spec: 83 | replicas: 1 84 | selector: 85 | matchLabels: 86 | project: "turbine-server" 87 | provider: "fabric8" 88 | group: "io.fabric8.kubeflix" 89 | template: 90 | metadata: 91 | labels: 92 | project: "turbine-server" 93 | provider: "fabric8" 94 | group: "io.fabric8.kubeflix" 95 | spec: 96 | containers: 97 | - env: 98 | - name: "KUBERNETES_NAMESPACE" 99 | valueFrom: 100 | fieldRef: 101 | fieldPath: "metadata.namespace" 102 | image: "fabric8/turbine-server:1.0.26" 103 | imagePullPolicy: "IfNotPresent" 104 | name: "turbine-server" 105 | ports: 106 | - containerPort: 8080 107 | name: "http" 108 | readinessProbe: 109 | httpGet: 110 | path: /health 111 | port: 8080 112 | scheme: HTTP 113 | livenessProbe: 114 | httpGet: 115 | path: /health 116 | port: 8080 117 | scheme: HTTP 118 | initialDelaySeconds: 180 119 | serviceAccountName: "camel-microservice-demo" 120 | - apiVersion: "v1" 121 | kind: "Service" 122 | metadata: 123 | labels: 124 | project: "hystrix-dashboard" 125 | provider: "fabric8" 126 | group: "io.fabric8.kubeflix" 127 | name: "hystrix-dashboard" 128 | spec: 129 | ports: 130 | - port: 80 131 | protocol: "TCP" 132 | targetPort: 8080 133 | selector: 134 | project: "hystrix-dashboard" 135 | provider: "fabric8" 136 | group: "io.fabric8.kubeflix" 137 | type: "NodePort" 138 | - apiVersion: "v1" 139 | kind: "Service" 140 | metadata: 141 | annotations: 142 | servicepath: "/turbine.stream" 143 | labels: 144 | project: "turbine-server" 145 | provider: "fabric8" 146 | group: "io.fabric8.kubeflix" 147 | name: "turbine-server" 148 | spec: 149 | ports: 150 | - port: 80 151 | protocol: "TCP" 152 | targetPort: 8080 153 | selector: 154 | project: "turbine-server" 155 | provider: "fabric8" 156 | group: "io.fabric8.kubeflix" 157 | type: "NodePort" 158 | - apiVersion: "extensions/v1beta1" 159 | kind: "Deployment" 160 | metadata: 161 | labels: 162 | project: "opentracing" 163 | provider: "fabric8" 164 | name: "opentracing" 165 | spec: 166 | replicas: 1 167 | selector: 168 | matchLabels: 169 | project: "opentracing" 170 | provider: "fabric8" 171 | template: 172 | metadata: 173 | labels: 174 | project: "opentracing" 175 | provider: "fabric8" 176 | spec: 177 | containers: 178 | - env: 179 | - name: "KUBERNETES_NAMESPACE" 180 | valueFrom: 181 | fieldRef: 182 | fieldPath: "metadata.namespace" 183 | image: "jaegertracing/all-in-one:latest" 184 | imagePullPolicy: "IfNotPresent" 185 | name: "opentracing" 186 | ports: 187 | - containerPort: 6831 188 | protocol: UDP 189 | - containerPort: 16686 190 | readinessProbe: 191 | httpGet: 192 | path: / 193 | port: 16686 194 | scheme: HTTP 195 | livenessProbe: 196 | httpGet: 197 | path: / 198 | port: 16686 199 | scheme: HTTP 200 | initialDelaySeconds: 180 201 | - apiVersion: "v1" 202 | kind: "Service" 203 | metadata: 204 | labels: 205 | project: "opentracing" 206 | provider: "fabric8" 207 | name: "opentracing" 208 | spec: 209 | ports: 210 | - port: 80 211 | name: "opentracing-web" 212 | protocol: "TCP" 213 | targetPort: 16686 214 | - port: 6831 215 | name: "opentracing-data" 216 | protocol: "UDP" 217 | targetPort: 6831 218 | selector: 219 | project: "opentracing" 220 | provider: "fabric8" 221 | type: "NodePort" 222 | kind: "List" 223 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Camel Microservice Demo 2 | 3 | A small set of [Apache Camel](http://camel.apache.org) Microservice applications, used for the basis of my [London JBug presentation](http://www.meetup.com/JBoss-User-Group/events/234803660/). 4 | 5 | Demonstrates running two different flavours of Camel Microservice on [Kubernetes](http://kubernetes.io/) and [OpenShift](https://www.openshift.com/): 6 | 7 | * Camel with [Spring Boot](https://projects.spring.io/spring-boot/) 8 | * Camel with [Throntail](https://thorntail.io/) 9 | * [Hystirx](https://github.com/Netflix/Hystrix) 10 | * [Zipkin](http://zipkin.io/) 11 | 12 | The demo is composed of 3 Microservices. The overall aim is to generate a name that is made up of a 13 | title, first name and last name. 14 | 15 | #### 1. The client service 16 | 17 | The client selects a random first name and HTTP POSTs this to the second service 18 | 19 | #### 2. The name prefix service 20 | 21 | The prefix service selects a random title and prepends this to the name sent from the client service. The modified name is then HTTP POSTed to the third service. 22 | 23 | #### 3. The name suffix service 24 | 25 | The suffix service selects a random last name and a random noun word. This is appended to the name 26 | received from the prefix service. 27 | 28 | ![Camel Microservice Demo](assets/diagram.png) 29 | 30 | [Minikube](https://github.com/kubernetes/minikube) and [Minishift](https://github.com/jimmidyson/minishift) was used as a simple means of running a local development cluster. 31 | 32 | ## Deploying to a cluster 33 | 34 | The example applications can be deployed to either a Kubernetes or OpenShift cluster. For simplicity, [Minikube](https://github.com/kubernetes/minikube) or [Minishift](https://github.com/jimmidyson/minishift) are useful for running a local cluster. 35 | 36 | > __Note:__ For brevity, kubectl is used as the cluster client command. If you're using OpenShift, 37 | substitue kubectl for oc. 38 | 39 | To deploy OpenTracing and Hystrix servers run: 40 | 41 | kubectl create -f deployment-kubernetes.yml 42 | 43 | For OpenShift run: 44 | 45 | oc create -f deployment-openshift.yml 46 | 47 | Depending on the speed of your connection it may take a while for the images to be pulled. You 48 | can check progress by examining the pod status: 49 | 50 | kubectl get pod 51 | 52 | NAME READY STATUS RESTARTS AGE 53 | hystrix-dashboard-4190263026-0tou6 1/1 Running 0 37s 54 | turbine-server-56523232-eio5i 1/1 Running 0 37s 55 | 56 | Once everything is up and running, we can connect to the Hystrix dashboard via its [NodePort](http://kubernetes.io/docs/user-guide/services/#type-nodeport) address: 57 | 58 | kubectl get service 59 | 60 | NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE 61 | hystrix-dashboard 10.0.0.90 80/TCP 1m 62 | turbine-server 10.0.0.115 80/TCP 1m 63 | 64 | kubectl describe service hystrix-dashboard 65 | 66 | Name: hystrix-dashboard 67 | Namespace: default 68 | Type: NodePort 69 | IP: 10.0.0.90 70 | Port: 80/TCP 71 | NodePort: 31137/TCP 72 | Endpoints: 172.17.0.3:8080 73 | 74 | In the above example you would browse to [http://your-cluster-ip:31137]() and the Hystrix Dashboard should be displayed. You can accept the default URL of [http://turbine-server/turbine.stream]() and click the 'Monitor Stream' button. 75 | 76 | Initially you'll be presented with nothing more than a 'Loading...' message, because there are 77 | no deployed applications emitting Hystrix events. 78 | 79 | Once the OpenTracing pod is up and running you can access the web UI by using the method outlined above for finding the OpenTracing service NodePort. 80 | 81 | For OpenShift you can use the route URL to access the services. You can view the service URLs by running: 82 | 83 | oc get route opentracing hystrix-dashboard 84 | 85 | ### Deploy sample applications 86 | 87 | If you're using Minikube or Minishift, it makes sense to use the Docker daemon of the VM rather than the one on your host: 88 | 89 | eval $(minikube docker-env) 90 | 91 | Otherwise the images built by the Maven build will need pushing to Docker Hub or another registry. 92 | 93 | To build and deploy each application to the cluster do: 94 | 95 | mvn fabric8:deploy 96 | 97 | When each pod has successfully started you can change into the `name-service-client` directory and tail the pod log: 98 | 99 | cd name-service-client 100 | mvn fabric8:log 101 | 102 | You should start to see random names being output to the console every 10 seconds. 103 | 104 | #### Changing the name generation period 105 | 106 | By default, names are generated every 10 seconds. To change this do: 107 | 108 | kubectl edit configmap client-service-config 109 | 110 | Then modify the `timer.period` property. Saving the changes will reflect immediately in the running application. 111 | 112 | #### Monitoring 113 | 114 | For OpenShift you can deploy [Prometheus](https://prometheus.io/) using a template. Change the `NAMESPACE` template parameter as necessary: 115 | 116 | oc login -u system:admin 117 | oc process -f etc/prometheus/prometheus-openshift.yml -p NAMESPACE=myproject | oc create -f - 118 | 119 | Once everything is deployed you can access the Prometheus UI via its route URL: 120 | 121 | oc get route prometheus 122 | 123 | Prometheus is configured to search for services annotated with a label named `group` with a value of `com.github.jamesnetherton`. Thus it automatically finds and scrapes the metrics endpoints for services deployed in this demonstration. 124 | 125 | ## Running locally 126 | 127 | The simplest way to run the project locally is with [docker-compose](https://docs.docker.com/compose/). 128 | 129 | Make sure you have built the project docker images locally by running: 130 | 131 | mvn clean install 132 | 133 | Then start the services: 134 | 135 | docker compose up 136 | 137 | You should see some humorous names being output to the console. 138 | 139 | Some monitoring tools are available for you to view runtime metrics. 140 | 141 | * Jaeger [http://localhost:16686](http://localhost:16686) 142 | * Prometheus [http://localhost:9090](http://localhost:9090) 143 | * Prometheus Alertmanager [http://localhost:9093](http://localhost:9093) 144 | * Grafana [http://localhost:3000](http://localhost:3000) 145 | 146 | ### Cleaning up 147 | 148 | You can tear down all of the deployed project objects by: 149 | 150 | mvn fabric8:undeploy 151 | -------------------------------------------------------------------------------- /mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" 124 | FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( 125 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 126 | ) 127 | 128 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 129 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 130 | if exist %WRAPPER_JAR% ( 131 | echo Found %WRAPPER_JAR% 132 | ) else ( 133 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 134 | echo Downloading from: %DOWNLOAD_URL% 135 | powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" 136 | echo Finished downloading %WRAPPER_JAR% 137 | ) 138 | @REM End of extension 139 | 140 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 141 | if ERRORLEVEL 1 goto error 142 | goto end 143 | 144 | :error 145 | set ERROR_CODE=1 146 | 147 | :end 148 | @endlocal & set ERROR_CODE=%ERROR_CODE% 149 | 150 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 151 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 152 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 153 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 154 | :skipRcPost 155 | 156 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 157 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 158 | 159 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 160 | 161 | exit /B %ERROR_CODE% 162 | -------------------------------------------------------------------------------- /deployment-openshift.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: "v1" 3 | items: 4 | - apiVersion: "v1" 5 | kind: "ServiceAccount" 6 | metadata: 7 | name: "camel-microservice-demo" 8 | - apiVersion: rbac.authorization.k8s.io/v1beta1 9 | kind: Role 10 | metadata: 11 | name: camel-microservice-demo-role 12 | rules: 13 | - apiGroups: [""] 14 | resources: ["endpoints", "configmaps"] 15 | verbs: ["get", "list", "watch"] 16 | - apiVersion: rbac.authorization.k8s.io/v1beta1 17 | kind: RoleBinding 18 | metadata: 19 | name: camel-microservice-demo-role-binding 20 | subjects: 21 | - kind: ServiceAccount 22 | name: camel-microservice-demo 23 | apiGroup: "" 24 | roleRef: 25 | kind: Role 26 | name: camel-microservice-demo-role 27 | apiGroup: "" 28 | - apiVersion: "extensions/v1beta1" 29 | kind: "Deployment" 30 | metadata: 31 | labels: 32 | project: "hystrix-dashboard" 33 | provider: "fabric8" 34 | group: "io.fabric8.kubeflix" 35 | name: "hystrix-dashboard" 36 | spec: 37 | replicas: 1 38 | selector: 39 | matchLabels: 40 | project: "hystrix-dashboard" 41 | provider: "fabric8" 42 | group: "io.fabric8.kubeflix" 43 | template: 44 | metadata: 45 | labels: 46 | project: "hystrix-dashboard" 47 | provider: "fabric8" 48 | group: "io.fabric8.kubeflix" 49 | spec: 50 | containers: 51 | - env: 52 | - name: "KUBERNETES_NAMESPACE" 53 | valueFrom: 54 | fieldRef: 55 | fieldPath: "metadata.namespace" 56 | image: "jamesnetherton/hystrix-dashboard:1.0.26" 57 | imagePullPolicy: "IfNotPresent" 58 | name: "hystrix-dashboard" 59 | ports: 60 | - containerPort: 8080 61 | name: "http" 62 | readinessProbe: 63 | httpGet: 64 | path: / 65 | port: 8080 66 | scheme: HTTP 67 | livenessProbe: 68 | httpGet: 69 | path: / 70 | port: 8080 71 | scheme: HTTP 72 | initialDelaySeconds: 180 73 | serviceAccountName: "camel-microservice-demo" 74 | - apiVersion: "extensions/v1beta1" 75 | kind: "Deployment" 76 | metadata: 77 | labels: 78 | project: "turbine-server" 79 | provider: "fabric8" 80 | group: "io.fabric8.kubeflix" 81 | name: "turbine-server" 82 | spec: 83 | replicas: 1 84 | selector: 85 | matchLabels: 86 | project: "turbine-server" 87 | provider: "fabric8" 88 | group: "io.fabric8.kubeflix" 89 | template: 90 | metadata: 91 | labels: 92 | project: "turbine-server" 93 | provider: "fabric8" 94 | group: "io.fabric8.kubeflix" 95 | spec: 96 | containers: 97 | - env: 98 | - name: "KUBERNETES_NAMESPACE" 99 | valueFrom: 100 | fieldRef: 101 | fieldPath: "metadata.namespace" 102 | image: "fabric8/turbine-server:1.0.26" 103 | imagePullPolicy: "IfNotPresent" 104 | name: "turbine-server" 105 | ports: 106 | - containerPort: 8080 107 | name: "http" 108 | readinessProbe: 109 | httpGet: 110 | path: /health 111 | port: 8080 112 | scheme: HTTP 113 | livenessProbe: 114 | httpGet: 115 | path: /health 116 | port: 8080 117 | scheme: HTTP 118 | initialDelaySeconds: 180 119 | serviceAccountName: "camel-microservice-demo" 120 | - apiVersion: "v1" 121 | kind: "Service" 122 | metadata: 123 | labels: 124 | project: "hystrix-dashboard" 125 | provider: "fabric8" 126 | group: "io.fabric8.kubeflix" 127 | name: "hystrix-dashboard" 128 | spec: 129 | ports: 130 | - port: 80 131 | protocol: "TCP" 132 | targetPort: 8080 133 | selector: 134 | project: "hystrix-dashboard" 135 | provider: "fabric8" 136 | group: "io.fabric8.kubeflix" 137 | type: "NodePort" 138 | - apiVersion: v1 139 | kind: Route 140 | metadata: 141 | labels: 142 | provider: fabric8 143 | project: hystrix-dashboard 144 | name: hystrix-dashboard 145 | spec: 146 | to: 147 | kind: Service 148 | name: hystrix-dashboard 149 | - apiVersion: "v1" 150 | kind: "Service" 151 | metadata: 152 | annotations: 153 | servicepath: "/turbine.stream" 154 | labels: 155 | project: "turbine-server" 156 | provider: "fabric8" 157 | group: "io.fabric8.kubeflix" 158 | name: "turbine-server" 159 | spec: 160 | ports: 161 | - port: 80 162 | protocol: "TCP" 163 | targetPort: 8080 164 | selector: 165 | project: "turbine-server" 166 | provider: "fabric8" 167 | group: "io.fabric8.kubeflix" 168 | type: "NodePort" 169 | - apiVersion: "extensions/v1beta1" 170 | kind: "Deployment" 171 | metadata: 172 | labels: 173 | project: "opentracing" 174 | provider: "fabric8" 175 | name: "opentracing" 176 | spec: 177 | replicas: 1 178 | selector: 179 | matchLabels: 180 | project: "opentracing" 181 | provider: "fabric8" 182 | template: 183 | metadata: 184 | labels: 185 | project: "opentracing" 186 | provider: "fabric8" 187 | spec: 188 | containers: 189 | - env: 190 | - name: "KUBERNETES_NAMESPACE" 191 | valueFrom: 192 | fieldRef: 193 | fieldPath: "metadata.namespace" 194 | image: "jaegertracing/all-in-one:latest" 195 | imagePullPolicy: "IfNotPresent" 196 | name: "opentracing" 197 | ports: 198 | - containerPort: 6831 199 | protocol: UDP 200 | - containerPort: 16686 201 | readinessProbe: 202 | httpGet: 203 | path: / 204 | port: 16686 205 | scheme: HTTP 206 | livenessProbe: 207 | httpGet: 208 | path: / 209 | port: 16686 210 | scheme: HTTP 211 | initialDelaySeconds: 180 212 | - apiVersion: "v1" 213 | kind: "Service" 214 | metadata: 215 | labels: 216 | project: "opentracing" 217 | provider: "fabric8" 218 | name: "opentracing" 219 | spec: 220 | ports: 221 | - port: 80 222 | name: "opentracing-web" 223 | protocol: "TCP" 224 | targetPort: 16686 225 | - port: 6831 226 | name: "opentracing-data" 227 | protocol: "UDP" 228 | targetPort: 6831 229 | selector: 230 | project: "opentracing" 231 | provider: "fabric8" 232 | type: "NodePort" 233 | - apiVersion: v1 234 | kind: Route 235 | metadata: 236 | labels: 237 | provider: fabric8 238 | project: opentracing 239 | name: opentracing 240 | spec: 241 | port: 242 | targetPort: opentracing-web 243 | to: 244 | kind: Service 245 | name: opentracing 246 | kind: "List" 247 | -------------------------------------------------------------------------------- /etc/prometheus/prometheus-openshift.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: template.openshift.io/v1 3 | kind: Template 4 | metadata: 5 | name: prometheus 6 | labels: 7 | app: prometheus 8 | annotations: 9 | openshift.io/display-name: "Prometheus" 10 | openshift.io/provider-display-name: "prometheus.io" 11 | description: "Prometheus Monitoring" 12 | tags: "prometheus,monitoring" 13 | iconClass: "icon-shadowman" 14 | version: "1.0" 15 | parameters: 16 | - name: NAMESPACE 17 | displayName: Namespace 18 | value: openshift 19 | required: true 20 | description: Namespace to install prometheus. 21 | - name: LABEL_GROUP_ID 22 | displayName: The groupId label value for Prometheus to monitor 23 | value: 'com.github.jamesnetherton' 24 | required: true 25 | - name: CPU_REQUEST 26 | displayName: CPU request 27 | value: '100m' 28 | required: true 29 | description: The amount of CPU to request for each container. 30 | - name: MEMORY_REQUEST 31 | displayName: Memory request 32 | value: '100Mi' 33 | required: true 34 | description: The amount of memory required for each container to run. 35 | - name: CPU_LIMIT 36 | displayName: CPU limit 37 | value: '200m' 38 | required: true 39 | description: The amount of CPU each container is limited to use. 40 | - name: MEMORY_LIMIT 41 | displayName: Memory limit 42 | value: '200Mi' 43 | required: true 44 | description: The amount of memory each container is limited to use. 45 | - name: CONTAINER_PORT 46 | displayName: Memory limit 47 | value: '8080' 48 | required: true 49 | description: The amount of memory each container is limited to use. 50 | - name: PROMETHEUS_MEMORY 51 | displayName: Prometheus Memory Limit 52 | value: '400Mi' 53 | - name: PROMETHEUS_SERVICE_PORT 54 | displayName: Prometheus Service Port 55 | value: '9090' 56 | - name: ENDPOINT_PORT 57 | displayName: Endpoint port 58 | value: 'web' 59 | required: true 60 | 61 | objects: 62 | - apiVersion: apiextensions.k8s.io/v1beta1 63 | kind: CustomResourceDefinition 64 | metadata: 65 | name: prometheusrules.monitoring.coreos.com 66 | spec: 67 | group: monitoring.coreos.com 68 | names: 69 | kind: PrometheusRule 70 | listKind: PrometheusRuleList 71 | plural: prometheusrules 72 | singular: prometheusrule 73 | scope: Namespaced 74 | version: v1 75 | 76 | - apiVersion: apiextensions.k8s.io/v1beta1 77 | kind: CustomResourceDefinition 78 | metadata: 79 | name: servicemonitors.monitoring.coreos.com 80 | spec: 81 | group: monitoring.coreos.com 82 | names: 83 | kind: ServiceMonitor 84 | listKind: ServiceMonitorList 85 | plural: servicemonitors 86 | singular: servicemonitor 87 | scope: Namespaced 88 | version: v1 89 | 90 | - apiVersion: apiextensions.k8s.io/v1beta1 91 | kind: CustomResourceDefinition 92 | metadata: 93 | name: prometheuses.monitoring.coreos.com 94 | spec: 95 | group: monitoring.coreos.com 96 | names: 97 | kind: Prometheus 98 | listKind: PrometheusList 99 | plural: prometheuses 100 | singular: prometheus 101 | scope: Namespaced 102 | version: v1 103 | 104 | - apiVersion: apiextensions.k8s.io/v1beta1 105 | kind: CustomResourceDefinition 106 | metadata: 107 | name: alertmanagers.monitoring.coreos.com 108 | spec: 109 | group: monitoring.coreos.com 110 | names: 111 | kind: Alertmanager 112 | listKind: AlertmanagerList 113 | plural: alertmanagers 114 | singular: alertmanager 115 | scope: Namespaced 116 | version: v1 117 | 118 | - apiVersion: rbac.authorization.k8s.io/v1 119 | kind: RoleBinding 120 | metadata: 121 | name: prometheus-operator 122 | namespace: ${NAMESPACE} 123 | roleRef: 124 | apiGroup: rbac.authorization.k8s.io 125 | kind: Role 126 | name: prometheus-operator 127 | subjects: 128 | - kind: ServiceAccount 129 | name: prometheus-operator 130 | namespace: ${NAMESPACE} 131 | 132 | - apiVersion: rbac.authorization.k8s.io/v1 133 | kind: Role 134 | metadata: 135 | name: prometheus-operator 136 | namespace: ${NAMESPACE} 137 | rules: 138 | - apiGroups: 139 | - apiextensions.k8s.io 140 | resources: 141 | - customresourcedefinitions 142 | verbs: 143 | - '*' 144 | - apiGroups: 145 | - monitoring.coreos.com 146 | resources: 147 | - alertmanagers 148 | - prometheuses 149 | - prometheuses/finalizers 150 | - alertmanagers/finalizers 151 | - servicemonitors 152 | - prometheusrules 153 | verbs: 154 | - '*' 155 | - apiGroups: 156 | - apps 157 | resources: 158 | - statefulsets 159 | verbs: 160 | - '*' 161 | - apiGroups: 162 | - "" 163 | resources: 164 | - configmaps 165 | - secrets 166 | verbs: 167 | - '*' 168 | - apiGroups: 169 | - "" 170 | resources: 171 | - pods 172 | verbs: 173 | - list 174 | - delete 175 | - apiGroups: 176 | - "" 177 | resources: 178 | - services 179 | - endpoints 180 | verbs: 181 | - get 182 | - create 183 | - update 184 | - apiGroups: 185 | - "" 186 | resources: 187 | - nodes 188 | verbs: 189 | - list 190 | - watch 191 | - apiGroups: 192 | - "" 193 | resources: 194 | - namespaces 195 | verbs: 196 | - get 197 | - list 198 | - watch 199 | 200 | - apiVersion: apps/v1beta2 201 | kind: Deployment 202 | metadata: 203 | labels: 204 | k8s-app: prometheus-operator 205 | name: prometheus-operator 206 | namespace: ${NAMESPACE} 207 | spec: 208 | replicas: 1 209 | selector: 210 | matchLabels: 211 | k8s-app: prometheus-operator 212 | template: 213 | metadata: 214 | labels: 215 | k8s-app: prometheus-operator 216 | spec: 217 | containers: 218 | - args: 219 | - --manage-crds=false 220 | - --namespaces=${NAMESPACE} 221 | - --logtostderr=true 222 | - --config-reloader-image=quay.io/coreos/configmap-reload:v0.0.1 223 | - --prometheus-config-reloader=quay.io/coreos/prometheus-config-reloader:v0.24.0 224 | image: quay.io/coreos/prometheus-operator:v0.24.0 225 | name: prometheus-operator 226 | ports: 227 | - containerPort: ${CONTAINER_PORT} 228 | name: http 229 | resources: 230 | limits: 231 | cpu: ${CPU_LIMIT} 232 | memory: ${MEMORY_LIMIT} 233 | requests: 234 | cpu: ${CPU_REQUEST} 235 | memory: ${MEMORY_REQUEST} 236 | serviceAccountName: prometheus-operator 237 | 238 | - apiVersion: v1 239 | kind: ServiceAccount 240 | metadata: 241 | name: prometheus-operator 242 | namespace: ${NAMESPACE} 243 | 244 | - apiVersion: monitoring.coreos.com/v1 245 | kind: Prometheus 246 | metadata: 247 | name: prometheus 248 | namespace: ${NAMESPACE} 249 | spec: 250 | securityContext: {} 251 | serviceAccountName: prometheus 252 | serviceMonitorSelector: 253 | matchLabels: 254 | app: camel-microservice-demo-monitor 255 | resources: 256 | requests: 257 | memory: ${PROMETHEUS_MEMORY} 258 | 259 | - apiVersion: v1 260 | kind: Service 261 | metadata: 262 | name: prometheus 263 | namespace: ${NAMESPACE} 264 | spec: 265 | type: NodePort 266 | ports: 267 | - name: web 268 | port: ${PROMETHEUS_SERVICE_PORT} 269 | protocol: TCP 270 | targetPort: web 271 | selector: 272 | prometheus: prometheus 273 | 274 | - apiVersion: v1 275 | kind: ServiceAccount 276 | metadata: 277 | name: prometheus 278 | namespace: ${NAMESPACE} 279 | 280 | - apiVersion: rbac.authorization.k8s.io/v1 281 | kind: Role 282 | metadata: 283 | namespace: ${NAMESPACE} 284 | name: prometheus 285 | rules: 286 | - apiGroups: [""] 287 | resources: 288 | - nodes 289 | - nodes/proxy 290 | - services 291 | - endpoints 292 | - pods 293 | verbs: ["get", "list", "watch"] 294 | - apiGroups: [""] 295 | resources: 296 | - configmaps 297 | verbs: ["get"] 298 | 299 | - apiVersion: rbac.authorization.k8s.io/v1beta1 300 | kind: RoleBinding 301 | metadata: 302 | name: prometheus 303 | namespace: ${NAMESPACE} 304 | roleRef: 305 | apiGroup: rbac.authorization.k8s.io 306 | kind: Role 307 | name: prometheus 308 | subjects: 309 | - kind: ServiceAccount 310 | name: prometheus 311 | namespace: ${NAMESPACE} 312 | 313 | - apiVersion: v1 314 | kind: Route 315 | metadata: 316 | name: prometheus 317 | namespace: ${NAMESPACE} 318 | spec: 319 | to: 320 | kind: Service 321 | name: prometheus 322 | 323 | - apiVersion: monitoring.coreos.com/v1 324 | kind: ServiceMonitor 325 | metadata: 326 | name: camel-microservice-demo-monitor 327 | namespace: ${NAMESPACE} 328 | labels: 329 | app: camel-microservice-demo-monitor 330 | spec: 331 | selector: 332 | matchLabels: 333 | group: ${LABEL_GROUP_ID} 334 | endpoints: 335 | - port: prometheus 336 | -------------------------------------------------------------------------------- /mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven2 Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /etc/mavenrc ] ; then 40 | . /etc/mavenrc 41 | fi 42 | 43 | if [ -f "$HOME/.mavenrc" ] ; then 44 | . "$HOME/.mavenrc" 45 | fi 46 | 47 | fi 48 | 49 | # OS specific support. $var _must_ be set to either true or false. 50 | cygwin=false; 51 | darwin=false; 52 | mingw=false 53 | case "`uname`" in 54 | CYGWIN*) cygwin=true ;; 55 | MINGW*) mingw=true;; 56 | Darwin*) darwin=true 57 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 58 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 59 | if [ -z "$JAVA_HOME" ]; then 60 | if [ -x "/usr/libexec/java_home" ]; then 61 | export JAVA_HOME="`/usr/libexec/java_home`" 62 | else 63 | export JAVA_HOME="/Library/Java/Home" 64 | fi 65 | fi 66 | ;; 67 | esac 68 | 69 | if [ -z "$JAVA_HOME" ] ; then 70 | if [ -r /etc/gentoo-release ] ; then 71 | JAVA_HOME=`java-config --jre-home` 72 | fi 73 | fi 74 | 75 | if [ -z "$M2_HOME" ] ; then 76 | ## resolve links - $0 may be a link to maven's home 77 | PRG="$0" 78 | 79 | # need this for relative symlinks 80 | while [ -h "$PRG" ] ; do 81 | ls=`ls -ld "$PRG"` 82 | link=`expr "$ls" : '.*-> \(.*\)$'` 83 | if expr "$link" : '/.*' > /dev/null; then 84 | PRG="$link" 85 | else 86 | PRG="`dirname "$PRG"`/$link" 87 | fi 88 | done 89 | 90 | saveddir=`pwd` 91 | 92 | M2_HOME=`dirname "$PRG"`/.. 93 | 94 | # make it fully qualified 95 | M2_HOME=`cd "$M2_HOME" && pwd` 96 | 97 | cd "$saveddir" 98 | # echo Using m2 at $M2_HOME 99 | fi 100 | 101 | # For Cygwin, ensure paths are in UNIX format before anything is touched 102 | if $cygwin ; then 103 | [ -n "$M2_HOME" ] && 104 | M2_HOME=`cygpath --unix "$M2_HOME"` 105 | [ -n "$JAVA_HOME" ] && 106 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 107 | [ -n "$CLASSPATH" ] && 108 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 109 | fi 110 | 111 | # For Mingw, ensure paths are in UNIX format before anything is touched 112 | if $mingw ; then 113 | [ -n "$M2_HOME" ] && 114 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 115 | [ -n "$JAVA_HOME" ] && 116 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 117 | # TODO classpath? 118 | fi 119 | 120 | if [ -z "$JAVA_HOME" ]; then 121 | javaExecutable="`which javac`" 122 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 123 | # readlink(1) is not available as standard on Solaris 10. 124 | readLink=`which readlink` 125 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 126 | if $darwin ; then 127 | javaHome="`dirname \"$javaExecutable\"`" 128 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 129 | else 130 | javaExecutable="`readlink -f \"$javaExecutable\"`" 131 | fi 132 | javaHome="`dirname \"$javaExecutable\"`" 133 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 134 | JAVA_HOME="$javaHome" 135 | export JAVA_HOME 136 | fi 137 | fi 138 | fi 139 | 140 | if [ -z "$JAVACMD" ] ; then 141 | if [ -n "$JAVA_HOME" ] ; then 142 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 143 | # IBM's JDK on AIX uses strange locations for the executables 144 | JAVACMD="$JAVA_HOME/jre/sh/java" 145 | else 146 | JAVACMD="$JAVA_HOME/bin/java" 147 | fi 148 | else 149 | JAVACMD="`which java`" 150 | fi 151 | fi 152 | 153 | if [ ! -x "$JAVACMD" ] ; then 154 | echo "Error: JAVA_HOME is not defined correctly." >&2 155 | echo " We cannot execute $JAVACMD" >&2 156 | exit 1 157 | fi 158 | 159 | if [ -z "$JAVA_HOME" ] ; then 160 | echo "Warning: JAVA_HOME environment variable is not set." 161 | fi 162 | 163 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 164 | 165 | # traverses directory structure from process work directory to filesystem root 166 | # first directory with .mvn subdirectory is considered project base directory 167 | find_maven_basedir() { 168 | 169 | if [ -z "$1" ] 170 | then 171 | echo "Path not specified to find_maven_basedir" 172 | return 1 173 | fi 174 | 175 | basedir="$1" 176 | wdir="$1" 177 | while [ "$wdir" != '/' ] ; do 178 | if [ -d "$wdir"/.mvn ] ; then 179 | basedir=$wdir 180 | break 181 | fi 182 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 183 | if [ -d "${wdir}" ]; then 184 | wdir=`cd "$wdir/.."; pwd` 185 | fi 186 | # end of workaround 187 | done 188 | echo "${basedir}" 189 | } 190 | 191 | # concatenates all lines of a file 192 | concat_lines() { 193 | if [ -f "$1" ]; then 194 | echo "$(tr -s '\n' ' ' < "$1")" 195 | fi 196 | } 197 | 198 | BASE_DIR=`find_maven_basedir "$(pwd)"` 199 | if [ -z "$BASE_DIR" ]; then 200 | exit 1; 201 | fi 202 | 203 | ########################################################################################## 204 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 205 | # This allows using the maven wrapper in projects that prohibit checking in binary data. 206 | ########################################################################################## 207 | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then 208 | if [ "$MVNW_VERBOSE" = true ]; then 209 | echo "Found .mvn/wrapper/maven-wrapper.jar" 210 | fi 211 | else 212 | if [ "$MVNW_VERBOSE" = true ]; then 213 | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." 214 | fi 215 | jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" 216 | while IFS="=" read key value; do 217 | case "$key" in (wrapperUrl) jarUrl="$value"; break ;; 218 | esac 219 | done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" 220 | if [ "$MVNW_VERBOSE" = true ]; then 221 | echo "Downloading from: $jarUrl" 222 | fi 223 | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" 224 | 225 | if command -v wget > /dev/null; then 226 | if [ "$MVNW_VERBOSE" = true ]; then 227 | echo "Found wget ... using wget" 228 | fi 229 | wget "$jarUrl" -O "$wrapperJarPath" 230 | elif command -v curl > /dev/null; then 231 | if [ "$MVNW_VERBOSE" = true ]; then 232 | echo "Found curl ... using curl" 233 | fi 234 | curl -o "$wrapperJarPath" "$jarUrl" 235 | else 236 | if [ "$MVNW_VERBOSE" = true ]; then 237 | echo "Falling back to using Java to download" 238 | fi 239 | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" 240 | if [ -e "$javaClass" ]; then 241 | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 242 | if [ "$MVNW_VERBOSE" = true ]; then 243 | echo " - Compiling MavenWrapperDownloader.java ..." 244 | fi 245 | # Compiling the Java class 246 | ("$JAVA_HOME/bin/javac" "$javaClass") 247 | fi 248 | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 249 | # Running the downloader 250 | if [ "$MVNW_VERBOSE" = true ]; then 251 | echo " - Running MavenWrapperDownloader.java ..." 252 | fi 253 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") 254 | fi 255 | fi 256 | fi 257 | fi 258 | ########################################################################################## 259 | # End of extension 260 | ########################################################################################## 261 | 262 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 263 | if [ "$MVNW_VERBOSE" = true ]; then 264 | echo $MAVEN_PROJECTBASEDIR 265 | fi 266 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 267 | 268 | # For Cygwin, switch paths to Windows format before running java 269 | if $cygwin; then 270 | [ -n "$M2_HOME" ] && 271 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 272 | [ -n "$JAVA_HOME" ] && 273 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 274 | [ -n "$CLASSPATH" ] && 275 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 276 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 277 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` 278 | fi 279 | 280 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 281 | 282 | exec "$JAVACMD" \ 283 | $MAVEN_OPTS \ 284 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 285 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 286 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 287 | -------------------------------------------------------------------------------- /etc/prometheus/agent/prometheus-config.yml: -------------------------------------------------------------------------------- 1 | startDelaySecs: 5 2 | ssl: false 3 | blacklistObjectNames: ["java.lang:*"] 4 | rules: 5 | # Context level 6 | - pattern: 'org.apache.camel<>ExchangesCompleted' 7 | name: org.apache.camel.ExchangesCompleted 8 | help: Exchanges Completed 9 | type: COUNTER 10 | labels: 11 | context: $1 12 | type: context 13 | - pattern: 'org.apache.camel<>ExchangesFailed' 14 | name: org.apache.camel.ExchangesFailed 15 | help: Exchanges Failed 16 | type: COUNTER 17 | labels: 18 | context: $1 19 | type: context 20 | - pattern: 'org.apache.camel<>ExchangesInflight' 21 | name: org.apache.camel.ExchangesInflight 22 | help: Exchanges Inflight 23 | type: COUNTER 24 | labels: 25 | context: $1 26 | type: context 27 | - pattern: 'org.apache.camel<>ExchangesTotal' 28 | name: org.apache.camel.ExchangesTotal 29 | help: Exchanges Total 30 | type: COUNTER 31 | labels: 32 | context: $1 33 | type: context 34 | - pattern: 'org.apache.camel<>ExchangesTotal' 35 | name: org.apache.camel.ExchangesTotal 36 | help: Exchanges Total 37 | type: COUNTER 38 | labels: 39 | context: $1 40 | type: context 41 | - pattern: 'org.apache.camel<>FailuresHandled' 42 | name: org.apache.camel.FailuresHandled 43 | help: Failures Handled 44 | labels: 45 | context: $1 46 | type: context 47 | type: COUNTER 48 | - pattern: 'org.apache.camel<>ExternalRedeliveries' 49 | name: org.apache.camel.ExternalRedeliveries 50 | help: External Redeliveries 51 | labels: 52 | context: $1 53 | type: context 54 | type: COUNTER 55 | - pattern: 'org.apache.camel<>MaxProcessingTime' 56 | name: org.apache.camel.MaxProcessingTime 57 | help: Maximum Processing Time 58 | labels: 59 | context: $1 60 | type: context 61 | type: GAUGE 62 | - pattern: 'org.apache.camel<>MeanProcessingTime' 63 | name: org.apache.camel.MeanProcessingTime 64 | help: Mean Processing Time 65 | labels: 66 | context: $1 67 | type: context 68 | type: GAUGE 69 | - pattern: 'org.apache.camel<>MinProcessingTime' 70 | name: org.apache.camel.MinProcessingTime 71 | help: Minimum Processing Time 72 | labels: 73 | context: $1 74 | type: context 75 | type: GAUGE 76 | - pattern: 'org.apache.camel<>LastProcessingTime' 77 | name: org.apache.camel.LastProcessingTime 78 | help: Last Processing Time 79 | labels: 80 | context: $1 81 | type: context 82 | type: GAUGE 83 | - pattern: 'org.apache.camel<>DeltaProcessingTime' 84 | name: org.apache.camel.DeltaProcessingTime 85 | help: Delta Processing Time 86 | labels: 87 | context: $1 88 | type: context 89 | type: GAUGE 90 | - pattern: 'org.apache.camel<>Redeliveries' 91 | name: org.apache.camel.Redeliveries 92 | help: Redeliveries 93 | labels: 94 | context: $1 95 | type: context 96 | type: GAUGE 97 | - pattern: 'org.apache.camel<>TotalProcessingTime' 98 | name: org.apache.camel.TotalProcessingTime 99 | help: Total Processing Time 100 | labels: 101 | context: $1 102 | type: context 103 | type: GAUGE 104 | - pattern: 'org.apache.camel<>InflightExchanges' 105 | name: org.apache.camel.InflightExchanges 106 | help: Inflight Exchanges 107 | labels: 108 | context: $1 109 | type: context 110 | type: GAUGE 111 | 112 | 113 | # Route level 114 | - pattern: 'org.apache.camel<>ExchangesCompleted' 115 | name: org.apache.camel.ExchangesCompleted 116 | help: Exchanges Completed 117 | type: COUNTER 118 | labels: 119 | context: $1 120 | route: $2 121 | type: routes 122 | - pattern: 'org.apache.camel<>ExchangesFailed' 123 | name: org.apache.camel.ExchangesFailed 124 | help: Exchanges Failed 125 | type: COUNTER 126 | labels: 127 | context: $1 128 | route: $2 129 | type: routes 130 | - pattern: 'org.apache.camel<>ExchangesInflight' 131 | name: org.apache.camel.ExchangesInflight 132 | help: Exchanges Inflight 133 | type: COUNTER 134 | labels: 135 | context: $1 136 | route: $2 137 | type: routes 138 | - pattern: 'org.apache.camel<>ExchangesTotal' 139 | name: org.apache.camel.ExchangesTotal 140 | help: Exchanges Total 141 | type: COUNTER 142 | labels: 143 | context: $1 144 | route: $2 145 | type: routes 146 | - pattern: 'org.apache.camel<>ExchangesTotal' 147 | name: org.apache.camel.ExchangesTotal 148 | help: Exchanges Total 149 | type: COUNTER 150 | labels: 151 | context: $1 152 | route: $2 153 | type: routes 154 | - pattern: 'org.apache.camel<>FailuresHandled' 155 | name: org.apache.camel.FailuresHandled 156 | help: Failures Handled 157 | labels: 158 | context: $1 159 | route: $2 160 | type: routes 161 | type: COUNTER 162 | - pattern: 'org.apache.camel<>ExternalRedeliveries' 163 | name: org.apache.camel.ExternalRedeliveries 164 | help: External Redeliveries 165 | labels: 166 | context: $1 167 | route: $2 168 | type: routes 169 | type: COUNTER 170 | - pattern: 'org.apache.camel<>MaxProcessingTime' 171 | name: org.apache.camel.MaxProcessingTime 172 | help: Maximum Processing Time 173 | labels: 174 | context: $1 175 | route: $2 176 | type: routes 177 | type: GAUGE 178 | - pattern: 'org.apache.camel<>MeanProcessingTime' 179 | name: org.apache.camel.MeanProcessingTime 180 | help: Mean Processing Time 181 | labels: 182 | context: $1 183 | route: $2 184 | type: routes 185 | type: GAUGE 186 | - pattern: 'org.apache.camel<>MinProcessingTime' 187 | name: org.apache.camel.MinProcessingTime 188 | help: Minimum Processing Time 189 | labels: 190 | context: $1 191 | route: $2 192 | type: routes 193 | type: GAUGE 194 | - pattern: 'org.apache.camel<>LastProcessingTime' 195 | name: org.apache.camel.LastProcessingTime 196 | help: Last Processing Time 197 | labels: 198 | context: $1 199 | route: $2 200 | type: routes 201 | type: GAUGE 202 | - pattern: 'org.apache.camel<>DeltaProcessingTime' 203 | name: org.apache.camel.DeltaProcessingTime 204 | help: Delta Processing Time 205 | labels: 206 | context: $1 207 | route: $2 208 | type: routes 209 | type: GAUGE 210 | - pattern: 'org.apache.camel<>Redeliveries' 211 | name: org.apache.camel.Redeliveries 212 | help: Redeliveries 213 | labels: 214 | context: $1 215 | route: $2 216 | type: routes 217 | type: GAUGE 218 | - pattern: 'org.apache.camel<>TotalProcessingTime' 219 | name: org.apache.camel.TotalProcessingTime 220 | help: Total Processing Time 221 | labels: 222 | context: $1 223 | route: $2 224 | type: routes 225 | type: GAUGE 226 | - pattern: 'org.apache.camel<>InflightExchanges' 227 | name: org.apache.camel.InflightExchanges 228 | help: Inflight Exchanges 229 | labels: 230 | context: $1 231 | route: $2 232 | type: routes 233 | type: GAUGE 234 | 235 | # Processor level 236 | - pattern: 'org.apache.camel<>ExchangesCompleted' 237 | name: org.apache.camel.ExchangesCompleted 238 | help: Exchanges Completed 239 | type: COUNTER 240 | labels: 241 | context: $1 242 | processor: $2 243 | type: processors 244 | - pattern: 'org.apache.camel<>ExchangesFailed' 245 | name: org.apache.camel.ExchangesFailed 246 | help: Exchanges Failed 247 | type: COUNTER 248 | labels: 249 | context: $1 250 | processor: $2 251 | type: processors 252 | - pattern: 'org.apache.camel<>ExchangesInflight' 253 | name: org.apache.camel.ExchangesInflight 254 | help: Exchanges Inflight 255 | type: COUNTER 256 | labels: 257 | context: $1 258 | processor: $2 259 | type: processors 260 | - pattern: 'org.apache.camel<>ExchangesTotal' 261 | name: org.apache.camel.ExchangesTotal 262 | help: Exchanges Total 263 | type: COUNTER 264 | labels: 265 | context: $1 266 | processor: $2 267 | type: processors 268 | - pattern: 'org.apache.camel<>ExchangesTotal' 269 | name: org.apache.camel.ExchangesTotal 270 | help: Exchanges Total 271 | type: COUNTER 272 | labels: 273 | context: $1 274 | processor: $2 275 | type: processors 276 | - pattern: 'org.apache.camel<>FailuresHandled' 277 | name: org.apache.camel.FailuresHandled 278 | help: Failures Handled 279 | labels: 280 | context: $1 281 | processor: $2 282 | type: processors 283 | type: COUNTER 284 | - pattern: 'org.apache.camel<>ExternalRedeliveries' 285 | name: org.apache.camel.ExternalRedeliveries 286 | help: External Redeliveries 287 | labels: 288 | context: $1 289 | processor: $2 290 | type: processors 291 | type: COUNTER 292 | - pattern: 'org.apache.camel<>MaxProcessingTime' 293 | name: org.apache.camel.MaxProcessingTime 294 | help: Maximum Processing Time 295 | labels: 296 | context: $1 297 | processor: $2 298 | type: processors 299 | type: GAUGE 300 | - pattern: 'org.apache.camel<>MeanProcessingTime' 301 | name: org.apache.camel.MeanProcessingTime 302 | help: Mean Processing Time 303 | labels: 304 | context: $1 305 | processor: $2 306 | type: processors 307 | type: GAUGE 308 | - pattern: 'org.apache.camel<>MinProcessingTime' 309 | name: org.apache.camel.MinProcessingTime 310 | help: Minimum Processing Time 311 | labels: 312 | context: $1 313 | processor: $2 314 | type: processors 315 | type: GAUGE 316 | - pattern: 'org.apache.camel<>LastProcessingTime' 317 | name: org.apache.camel.LastProcessingTime 318 | help: Last Processing Time 319 | labels: 320 | context: $1 321 | processor: $2 322 | type: processors 323 | type: GAUGE 324 | - pattern: 'org.apache.camel<>DeltaProcessingTime' 325 | name: org.apache.camel.DeltaProcessingTime 326 | help: Delta Processing Time 327 | labels: 328 | context: $1 329 | processor: $2 330 | type: processors 331 | type: GAUGE 332 | - pattern: 'org.apache.camel<>Redeliveries' 333 | name: org.apache.camel.Redeliveries 334 | help: Redeliveries 335 | labels: 336 | context: $1 337 | processor: $2 338 | type: processors 339 | type: GAUGE 340 | - pattern: 'org.apache.camel<>TotalProcessingTime' 341 | name: org.apache.camel.TotalProcessingTime 342 | help: Total Processing Time 343 | labels: 344 | context: $1 345 | processor: $2 346 | type: processors 347 | type: GAUGE 348 | - pattern: 'org.apache.camel<>InflightExchanges' 349 | name: org.apache.camel.InflightExchanges 350 | help: Inflight Exchanges 351 | labels: 352 | context: $1 353 | processor: $2 354 | type: processors 355 | type: COUNTER 356 | 357 | # Consumers 358 | - pattern: 'org.apache.camel<>InflightExchanges' 359 | name: org.apache.camel.InflightExchanges 360 | help: Inflight Exchanges 361 | labels: 362 | context: $1 363 | consumer: $2 364 | type: consumers 365 | type: GAUGE 366 | 367 | # Services 368 | - pattern: 'org.apache.camel<>MaxDuration' 369 | name: org.apache.camel.MaxDuration 370 | help: Maximum Duration 371 | labels: 372 | context: $1 373 | service: $2 374 | type: services 375 | type: GAUGE 376 | - pattern: 'org.apache.camel<>MeanDuration' 377 | name: org.apache.camel.MeanDuration 378 | help: Mean Duration 379 | labels: 380 | context: $1 381 | service: $2 382 | type: services 383 | type: GAUGE 384 | - pattern: 'org.apache.camel<>MinDuration' 385 | name: org.apache.camel.MinDuration 386 | help: Minimum Duration 387 | labels: 388 | context: $1 389 | service: $2 390 | type: services 391 | type: GAUGE 392 | - pattern: 'org.apache.camel<>TotalDuration' 393 | name: org.apache.camel.TotalDuration 394 | help: Total Duration 395 | labels: 396 | context: $1 397 | service: $2 398 | type: services 399 | type: GAUGE 400 | - pattern: 'org.apache.camel<>ThreadsBlocked' 401 | name: org.apache.camel.ThreadsBlocked 402 | help: Threads Blocked 403 | labels: 404 | context: $1 405 | service: $2 406 | type: services 407 | type: GAUGE 408 | - pattern: 'org.apache.camel<>ThreadsInterrupted' 409 | name: org.apache.camel.ThreadsInterrupted 410 | help: Threads Interrupted 411 | labels: 412 | context: $1 413 | service: $2 414 | type: services 415 | type: GAUGE 416 | - pattern: 'org.apache.cxf<>NumLogicalRuntimeFaults' 417 | name: org.apache.cxf.NumLogicalRuntimeFaults 418 | help: Number of logical runtime faults 419 | type: GAUGE 420 | labels: 421 | bus.id: $1 422 | type: $2 423 | service: $3 424 | port: $4 425 | operation: $5 426 | - pattern: 'org.apache.cxf<>NumLogicalRuntimeFaults' 427 | name: org.apache.cxf.NumLogicalRuntimeFaults 428 | help: Number of logical runtime faults 429 | type: GAUGE 430 | labels: 431 | bus.id: $1 432 | type: $2 433 | service: $3 434 | port: $4 435 | - pattern: 'org.apache.cxf<>AvgResponseTime' 436 | name: org.apache.cxf.AvgResponseTime 437 | help: Average Response Time 438 | type: GAUGE 439 | labels: 440 | bus.id: $1 441 | type: $2 442 | service: $3 443 | port: $4 444 | operation: $5 445 | - pattern: 'org.apache.cxf<>AvgResponseTime' 446 | name: org.apache.cxf.AvgResponseTime 447 | help: Average Response Time 448 | type: GAUGE 449 | labels: 450 | bus.id: $1 451 | type: $2 452 | service: $3 453 | port: $4 454 | - pattern: 'org.apache.cxf<>NumInvocations' 455 | name: org.apache.cxf.NumInvocations 456 | help: Number of invocations 457 | type: GAUGE 458 | labels: 459 | bus.id: $1 460 | type: $2 461 | service: $3 462 | port: $4 463 | operation: $5 464 | - pattern: 'org.apache.cxf<>NumInvocations' 465 | name: org.apache.cxf.NumInvocations 466 | help: Number of invocations 467 | type: GAUGE 468 | labels: 469 | bus.id: $1 470 | type: $2 471 | service: $3 472 | port: $4 473 | - pattern: 'org.apache.cxf<>MaxResponseTime' 474 | name: org.apache.cxf.MaxResponseTime 475 | help: Maximum Response Time 476 | type: GAUGE 477 | labels: 478 | bus.id: $1 479 | type: $2 480 | service: $3 481 | port: $4 482 | operation: $5 483 | - pattern: 'org.apache.cxf<>MaxResponseTime' 484 | name: org.apache.cxf.MaxResponseTime 485 | help: Maximum Response Time 486 | type: GAUGE 487 | labels: 488 | bus.id: $1 489 | type: $2 490 | service: $3 491 | port: $4 492 | - pattern: 'org.apache.cxf<>MinResponseTime' 493 | name: org.apache.cxf.MinResponseTime 494 | help: Minimum Response Time 495 | type: GAUGE 496 | labels: 497 | bus.id: $1 498 | type: $2 499 | service: $3 500 | port: $4 501 | operation: $5 502 | - pattern: 'org.apache.cxf<>MinResponseTime' 503 | name: org.apache.cxf.MinResponseTime 504 | help: Minimum Response Time 505 | type: GAUGE 506 | labels: 507 | bus.id: $1 508 | type: $2 509 | service: $3 510 | port: $4 511 | - pattern: 'org.apache.cxf<>TotalHandlingTime' 512 | name: org.apache.cxf.TotalHandlingTime 513 | help: Total Handling Time 514 | type: GAUGE 515 | labels: 516 | bus.id: $1 517 | type: $2 518 | service: $3 519 | port: $4 520 | operation: $5 521 | - pattern: 'org.apache.cxf<>TotalHandlingTime' 522 | name: org.apache.cxf.TotalHandlingTime 523 | help: Total Handling Time 524 | type: GAUGE 525 | labels: 526 | bus.id: $1 527 | type: $2 528 | service: $3 529 | port: $4 530 | - pattern: 'org.apache.cxf<>NumRuntimeFaults' 531 | name: org.apache.cxf.NumRuntimeFaults 532 | help: Number of runtime faults 533 | type: GAUGE 534 | labels: 535 | bus.id: $1 536 | type: $2 537 | service: $3 538 | port: $4 539 | operation: $5 540 | - pattern: 'org.apache.cxf<>NumRuntimeFaults' 541 | name: org.apache.cxf.NumRuntimeFaults 542 | help: Number of runtime faults 543 | type: GAUGE 544 | labels: 545 | bus.id: $1 546 | type: $2 547 | service: $3 548 | port: $4 549 | - pattern: 'org.apache.cxf<>NumUnCheckedApplicationFaults' 550 | name: org.apache.cxf.NumUnCheckedApplicationFaults 551 | help: Number of unchecked application faults 552 | type: GAUGE 553 | labels: 554 | bus.id: $1 555 | type: $2 556 | service: $3 557 | port: $4 558 | operation: $5 559 | - pattern: 'org.apache.cxf<>NumUnCheckedApplicationFaults' 560 | name: org.apache.cxf.NumUnCheckedApplicationFaults 561 | help: Number of unchecked application faults 562 | type: GAUGE 563 | labels: 564 | bus.id: $1 565 | type: $2 566 | service: $3 567 | port: $4 568 | - pattern: 'org.apache.cxf<>NumCheckedApplicationFaults' 569 | name: org.apache.cxf.NumCheckedApplicationFaults 570 | help: Number of checked application faults 571 | type: GAUGE 572 | labels: 573 | bus.id: $1 574 | type: $2 575 | service: $3 576 | port: $4 577 | operation: $5 578 | - pattern: 'org.apache.cxf<>NumCheckedApplicationFaults' 579 | name: org.apache.cxf.NumCheckedApplicationFaults 580 | help: Number of checked application faults 581 | type: GAUGE 582 | labels: 583 | bus.id: $1 584 | type: $2 585 | service: $3 586 | port: $4 587 | -------------------------------------------------------------------------------- /etc/grafana/provisioning/dashboards/camel-microservice-demo.json: -------------------------------------------------------------------------------- 1 | { 2 | "__inputs": [ 3 | { 4 | "name": "Prometheus", 5 | "label": "prometheus", 6 | "description": "", 7 | "type": "datasource", 8 | "pluginId": "prometheus", 9 | "pluginName": "Prometheus" 10 | } 11 | ], 12 | "__requires": [ 13 | { 14 | "type": "grafana", 15 | "id": "grafana", 16 | "name": "Grafana", 17 | "version": "5.3.2" 18 | }, 19 | { 20 | "type": "panel", 21 | "id": "graph", 22 | "name": "Graph", 23 | "version": "5.0.0" 24 | }, 25 | { 26 | "type": "datasource", 27 | "id": "prometheus", 28 | "name": "Prometheus", 29 | "version": "5.0.0" 30 | }, 31 | { 32 | "type": "panel", 33 | "id": "singlestat", 34 | "name": "Singlestat", 35 | "version": "5.0.0" 36 | } 37 | ], 38 | "annotations": { 39 | "list": [ 40 | { 41 | "builtIn": 1, 42 | "datasource": "-- Grafana --", 43 | "enable": true, 44 | "hide": true, 45 | "iconColor": "rgba(0, 211, 255, 1)", 46 | "name": "Annotations & Alerts", 47 | "type": "dashboard" 48 | } 49 | ] 50 | }, 51 | "editable": true, 52 | "gnetId": null, 53 | "graphTooltip": 0, 54 | "id": null, 55 | "iteration": 1542381678580, 56 | "links": [], 57 | "panels": [ 58 | { 59 | "collapsed": false, 60 | "gridPos": { 61 | "h": 1, 62 | "w": 24, 63 | "x": 0, 64 | "y": 0 65 | }, 66 | "id": 24, 67 | "panels": [], 68 | "repeat": null, 69 | "title": "Route ($route)", 70 | "type": "row" 71 | }, 72 | { 73 | "cacheTimeout": null, 74 | "colorBackground": false, 75 | "colorValue": false, 76 | "colors": [ 77 | "#299c46", 78 | "rgba(237, 129, 40, 0.89)", 79 | "#d44a3a" 80 | ], 81 | "datasource": "Prometheus", 82 | "decimals": null, 83 | "format": "short", 84 | "gauge": { 85 | "maxValue": 100, 86 | "minValue": 0, 87 | "show": false, 88 | "thresholdLabels": false, 89 | "thresholdMarkers": true 90 | }, 91 | "gridPos": { 92 | "h": 5, 93 | "w": 4, 94 | "x": 0, 95 | "y": 1 96 | }, 97 | "id": 30, 98 | "interval": null, 99 | "links": [], 100 | "mappingType": 1, 101 | "mappingTypes": [ 102 | { 103 | "name": "value to text", 104 | "value": 1 105 | }, 106 | { 107 | "name": "range to text", 108 | "value": 2 109 | } 110 | ], 111 | "maxDataPoints": 100, 112 | "nullPointMode": "connected", 113 | "nullText": null, 114 | "postfix": "", 115 | "postfixFontSize": "50%", 116 | "prefix": "", 117 | "prefixFontSize": "50%", 118 | "rangeMaps": [ 119 | { 120 | "from": "null", 121 | "text": "N/A", 122 | "to": "null" 123 | } 124 | ], 125 | "sparkline": { 126 | "fillColor": "rgba(31, 118, 189, 0.18)", 127 | "full": false, 128 | "lineColor": "rgb(31, 120, 193)", 129 | "show": false 130 | }, 131 | "tableColumn": "", 132 | "targets": [ 133 | { 134 | "expr": "rate(org_apache_camel_ExchangesTotal{route=\"$route\"}[5m])", 135 | "format": "time_series", 136 | "intervalFactor": 1, 137 | "refId": "A" 138 | } 139 | ], 140 | "thresholds": "", 141 | "title": "Exchanges per second", 142 | "type": "singlestat", 143 | "valueFontSize": "80%", 144 | "valueMaps": [ 145 | { 146 | "op": "=", 147 | "text": "N/A", 148 | "value": "null" 149 | } 150 | ], 151 | "valueName": "avg" 152 | }, 153 | { 154 | "cacheTimeout": null, 155 | "colorBackground": false, 156 | "colorValue": false, 157 | "colors": [ 158 | "#299c46", 159 | "rgba(237, 129, 40, 0.89)", 160 | "#d44a3a" 161 | ], 162 | "datasource": "Prometheus", 163 | "format": "none", 164 | "gauge": { 165 | "maxValue": 100, 166 | "minValue": 0, 167 | "show": false, 168 | "thresholdLabels": false, 169 | "thresholdMarkers": true 170 | }, 171 | "gridPos": { 172 | "h": 5, 173 | "w": 4, 174 | "x": 4, 175 | "y": 1 176 | }, 177 | "id": 28, 178 | "interval": null, 179 | "links": [], 180 | "mappingType": 1, 181 | "mappingTypes": [ 182 | { 183 | "name": "value to text", 184 | "value": 1 185 | }, 186 | { 187 | "name": "range to text", 188 | "value": 2 189 | } 190 | ], 191 | "maxDataPoints": 100, 192 | "nullPointMode": "connected", 193 | "nullText": null, 194 | "postfix": "", 195 | "postfixFontSize": "50%", 196 | "prefix": "", 197 | "prefixFontSize": "50%", 198 | "rangeMaps": [ 199 | { 200 | "from": "null", 201 | "text": "N/A", 202 | "to": "null" 203 | } 204 | ], 205 | "sparkline": { 206 | "fillColor": "rgba(31, 118, 189, 0.18)", 207 | "full": false, 208 | "lineColor": "rgb(31, 120, 193)", 209 | "show": false 210 | }, 211 | "tableColumn": "__name__", 212 | "targets": [ 213 | { 214 | "expr": "max(org_apache_camel_ExchangesInflight{route=\"$route\"})", 215 | "format": "time_series", 216 | "instant": true, 217 | "intervalFactor": 1, 218 | "refId": "A" 219 | } 220 | ], 221 | "thresholds": "", 222 | "title": "Exchanges inflight", 223 | "type": "singlestat", 224 | "valueFontSize": "80%", 225 | "valueMaps": [ 226 | { 227 | "op": "=", 228 | "text": "N/A", 229 | "value": "null" 230 | } 231 | ], 232 | "valueName": "avg" 233 | }, 234 | { 235 | "cacheTimeout": null, 236 | "colorBackground": false, 237 | "colorValue": false, 238 | "colors": [ 239 | "#299c46", 240 | "rgba(237, 129, 40, 0.89)", 241 | "#d44a3a" 242 | ], 243 | "datasource": "Prometheus", 244 | "format": "percentunit", 245 | "gauge": { 246 | "maxValue": 100, 247 | "minValue": 0, 248 | "show": true, 249 | "thresholdLabels": false, 250 | "thresholdMarkers": true 251 | }, 252 | "gridPos": { 253 | "h": 5, 254 | "w": 4, 255 | "x": 8, 256 | "y": 1 257 | }, 258 | "id": 6, 259 | "interval": null, 260 | "links": [], 261 | "mappingType": 1, 262 | "mappingTypes": [ 263 | { 264 | "name": "value to text", 265 | "value": 1 266 | }, 267 | { 268 | "name": "range to text", 269 | "value": 2 270 | } 271 | ], 272 | "maxDataPoints": 100, 273 | "nullPointMode": "connected", 274 | "nullText": null, 275 | "postfix": "", 276 | "postfixFontSize": "50%", 277 | "prefix": "", 278 | "prefixFontSize": "50%", 279 | "rangeMaps": [ 280 | { 281 | "from": "null", 282 | "text": "N/A", 283 | "to": "null" 284 | } 285 | ], 286 | "sparkline": { 287 | "fillColor": "rgba(31, 118, 189, 0.18)", 288 | "full": false, 289 | "lineColor": "rgb(31, 120, 193)", 290 | "show": false 291 | }, 292 | "tableColumn": "", 293 | "targets": [ 294 | { 295 | "expr": "sum(org_apache_camel_ExchangesFailed{route=\"$route\"}) / sum(org_apache_camel_ExchangesTotal{route=\"$route\"})", 296 | "format": "time_series", 297 | "instant": false, 298 | "intervalFactor": 1, 299 | "legendFormat": "", 300 | "refId": "A" 301 | } 302 | ], 303 | "thresholds": "", 304 | "title": "Exchanges failure rate", 305 | "transparent": false, 306 | "type": "singlestat", 307 | "valueFontSize": "80%", 308 | "valueMaps": [ 309 | { 310 | "op": "=", 311 | "text": "N/A", 312 | "value": "null" 313 | } 314 | ], 315 | "valueName": "avg" 316 | }, 317 | { 318 | "cacheTimeout": null, 319 | "colorBackground": false, 320 | "colorValue": false, 321 | "colors": [ 322 | "#299c46", 323 | "rgba(237, 129, 40, 0.89)", 324 | "#d44a3a" 325 | ], 326 | "datasource": "Prometheus", 327 | "format": "ms", 328 | "gauge": { 329 | "maxValue": 100, 330 | "minValue": 0, 331 | "show": false, 332 | "thresholdLabels": false, 333 | "thresholdMarkers": true 334 | }, 335 | "gridPos": { 336 | "h": 5, 337 | "w": 4, 338 | "x": 12, 339 | "y": 1 340 | }, 341 | "id": 32, 342 | "interval": null, 343 | "links": [], 344 | "mappingType": 1, 345 | "mappingTypes": [ 346 | { 347 | "name": "value to text", 348 | "value": 1 349 | }, 350 | { 351 | "name": "range to text", 352 | "value": 2 353 | } 354 | ], 355 | "maxDataPoints": 100, 356 | "nullPointMode": "connected", 357 | "nullText": null, 358 | "postfix": "", 359 | "postfixFontSize": "50%", 360 | "prefix": "", 361 | "prefixFontSize": "50%", 362 | "rangeMaps": [ 363 | { 364 | "from": "null", 365 | "text": "N/A", 366 | "to": "null" 367 | } 368 | ], 369 | "sparkline": { 370 | "fillColor": "rgba(31, 118, 189, 0.18)", 371 | "full": false, 372 | "lineColor": "rgb(31, 120, 193)", 373 | "show": false 374 | }, 375 | "tableColumn": "", 376 | "targets": [ 377 | { 378 | "expr": "org_apache_camel_MeanProcessingTime{route=\"$route\"}", 379 | "format": "time_series", 380 | "intervalFactor": 1, 381 | "refId": "A" 382 | } 383 | ], 384 | "thresholds": "", 385 | "title": "Mean processing time", 386 | "type": "singlestat", 387 | "valueFontSize": "80%", 388 | "valueMaps": [ 389 | { 390 | "op": "=", 391 | "text": "N/A", 392 | "value": "null" 393 | } 394 | ], 395 | "valueName": "current" 396 | }, 397 | { 398 | "aliasColors": {}, 399 | "bars": false, 400 | "dashLength": 10, 401 | "dashes": false, 402 | "datasource": "Prometheus", 403 | "fill": 1, 404 | "gridPos": { 405 | "h": 5, 406 | "w": 12, 407 | "x": 0, 408 | "y": 6 409 | }, 410 | "id": 2, 411 | "legend": { 412 | "alignAsTable": false, 413 | "avg": false, 414 | "current": false, 415 | "max": false, 416 | "min": false, 417 | "rightSide": false, 418 | "show": true, 419 | "total": false, 420 | "values": false 421 | }, 422 | "lines": true, 423 | "linewidth": 1, 424 | "links": [], 425 | "nullPointMode": "null", 426 | "percentage": false, 427 | "pointradius": 5, 428 | "points": false, 429 | "renderer": "flot", 430 | "seriesOverrides": [], 431 | "spaceLength": 10, 432 | "stack": true, 433 | "steppedLine": false, 434 | "targets": [ 435 | { 436 | "expr": "rate(org_apache_camel_ExchangesFailed{route=\"$route\"}[5m])", 437 | "format": "time_series", 438 | "intervalFactor": 1, 439 | "legendFormat": "Failed", 440 | "refId": "B" 441 | }, 442 | { 443 | "expr": "rate(org_apache_camel_ExchangesCompleted{route=\"$route\"}[5m])", 444 | "format": "time_series", 445 | "hide": false, 446 | "instant": false, 447 | "interval": "", 448 | "intervalFactor": 1, 449 | "legendFormat": "Completed", 450 | "refId": "A" 451 | } 452 | ], 453 | "thresholds": [], 454 | "timeFrom": null, 455 | "timeShift": null, 456 | "title": "Exchanges per second", 457 | "tooltip": { 458 | "shared": true, 459 | "sort": 0, 460 | "value_type": "individual" 461 | }, 462 | "type": "graph", 463 | "xaxis": { 464 | "buckets": null, 465 | "mode": "time", 466 | "name": null, 467 | "show": true, 468 | "values": [] 469 | }, 470 | "yaxes": [ 471 | { 472 | "decimals": 0, 473 | "format": "short", 474 | "label": null, 475 | "logBase": 1, 476 | "max": null, 477 | "min": "0", 478 | "show": true 479 | }, 480 | { 481 | "format": "short", 482 | "label": null, 483 | "logBase": 1, 484 | "max": null, 485 | "min": null, 486 | "show": false 487 | } 488 | ], 489 | "yaxis": { 490 | "align": false, 491 | "alignLevel": null 492 | } 493 | }, 494 | { 495 | "aliasColors": {}, 496 | "bars": true, 497 | "dashLength": 10, 498 | "dashes": false, 499 | "datasource": "Prometheus", 500 | "fill": 1, 501 | "gridPos": { 502 | "h": 5, 503 | "w": 12, 504 | "x": 12, 505 | "y": 6 506 | }, 507 | "id": 26, 508 | "legend": { 509 | "alignAsTable": false, 510 | "avg": false, 511 | "current": false, 512 | "hideEmpty": false, 513 | "hideZero": false, 514 | "max": false, 515 | "min": false, 516 | "show": false, 517 | "total": false, 518 | "values": false 519 | }, 520 | "lines": false, 521 | "linewidth": 1, 522 | "links": [], 523 | "nullPointMode": "null", 524 | "percentage": false, 525 | "pointradius": 5, 526 | "points": false, 527 | "renderer": "flot", 528 | "seriesOverrides": [], 529 | "spaceLength": 10, 530 | "stack": false, 531 | "steppedLine": false, 532 | "targets": [ 533 | { 534 | "expr": "org_apache_camel_ExchangesInflight{route=\"$route\"}", 535 | "format": "time_series", 536 | "intervalFactor": 1, 537 | "legendFormat": "Exchanges inflight", 538 | "refId": "A" 539 | } 540 | ], 541 | "thresholds": [], 542 | "timeFrom": null, 543 | "timeShift": null, 544 | "title": "Exchanges inflight", 545 | "tooltip": { 546 | "shared": true, 547 | "sort": 0, 548 | "value_type": "individual" 549 | }, 550 | "transparent": false, 551 | "type": "graph", 552 | "xaxis": { 553 | "buckets": null, 554 | "mode": "time", 555 | "name": null, 556 | "show": true, 557 | "values": [] 558 | }, 559 | "yaxes": [ 560 | { 561 | "decimals": 0, 562 | "format": "short", 563 | "label": null, 564 | "logBase": 1, 565 | "max": null, 566 | "min": "0", 567 | "show": true 568 | }, 569 | { 570 | "format": "short", 571 | "label": null, 572 | "logBase": 1, 573 | "max": null, 574 | "min": null, 575 | "show": false 576 | } 577 | ], 578 | "yaxis": { 579 | "align": false, 580 | "alignLevel": null 581 | } 582 | }, 583 | { 584 | "aliasColors": {}, 585 | "bars": false, 586 | "dashLength": 10, 587 | "dashes": false, 588 | "datasource": "Prometheus", 589 | "fill": 1, 590 | "gridPos": { 591 | "h": 5, 592 | "w": 12, 593 | "x": 0, 594 | "y": 11 595 | }, 596 | "id": 20, 597 | "legend": { 598 | "avg": false, 599 | "current": false, 600 | "max": false, 601 | "min": false, 602 | "show": true, 603 | "total": false, 604 | "values": false 605 | }, 606 | "lines": true, 607 | "linewidth": 1, 608 | "links": [], 609 | "nullPointMode": "null", 610 | "percentage": false, 611 | "pointradius": 5, 612 | "points": false, 613 | "renderer": "flot", 614 | "seriesOverrides": [], 615 | "spaceLength": 10, 616 | "stack": false, 617 | "steppedLine": false, 618 | "targets": [ 619 | { 620 | "expr": "org_apache_camel_MaxProcessingTime{route=\"$route\"}", 621 | "format": "time_series", 622 | "intervalFactor": 1, 623 | "legendFormat": "Max", 624 | "refId": "A" 625 | }, 626 | { 627 | "expr": "org_apache_camel_MeanProcessingTime{route=\"$route\"}", 628 | "format": "time_series", 629 | "intervalFactor": 1, 630 | "legendFormat": "Mean", 631 | "refId": "B" 632 | }, 633 | { 634 | "expr": "org_apache_camel_MinProcessingTime{route=\"$route\"}", 635 | "format": "time_series", 636 | "intervalFactor": 1, 637 | "legendFormat": "Min", 638 | "refId": "C" 639 | } 640 | ], 641 | "thresholds": [], 642 | "timeFrom": null, 643 | "timeShift": null, 644 | "title": "Processing time", 645 | "tooltip": { 646 | "shared": true, 647 | "sort": 0, 648 | "value_type": "individual" 649 | }, 650 | "type": "graph", 651 | "xaxis": { 652 | "buckets": null, 653 | "mode": "time", 654 | "name": null, 655 | "show": true, 656 | "values": [] 657 | }, 658 | "yaxes": [ 659 | { 660 | "decimals": 0, 661 | "format": "ms", 662 | "label": null, 663 | "logBase": 1, 664 | "max": null, 665 | "min": "0", 666 | "show": true 667 | }, 668 | { 669 | "format": "short", 670 | "label": null, 671 | "logBase": 1, 672 | "max": null, 673 | "min": null, 674 | "show": false 675 | } 676 | ], 677 | "yaxis": { 678 | "align": false, 679 | "alignLevel": null 680 | } 681 | }, 682 | { 683 | "aliasColors": {}, 684 | "bars": false, 685 | "dashLength": 10, 686 | "dashes": false, 687 | "datasource": "Prometheus", 688 | "fill": 1, 689 | "gridPos": { 690 | "h": 5, 691 | "w": 12, 692 | "x": 12, 693 | "y": 11 694 | }, 695 | "id": 12, 696 | "legend": { 697 | "avg": false, 698 | "current": false, 699 | "max": false, 700 | "min": false, 701 | "show": false, 702 | "total": false, 703 | "values": false 704 | }, 705 | "lines": true, 706 | "linewidth": 1, 707 | "links": [], 708 | "nullPointMode": "null", 709 | "percentage": false, 710 | "pointradius": 5, 711 | "points": false, 712 | "renderer": "flot", 713 | "seriesOverrides": [], 714 | "spaceLength": 10, 715 | "stack": false, 716 | "steppedLine": false, 717 | "targets": [ 718 | { 719 | "expr": "rate(org_apache_camel_ExternalRedeliveries{route=\"$route\"}[5m])", 720 | "format": "time_series", 721 | "intervalFactor": 1, 722 | "refId": "A" 723 | } 724 | ], 725 | "thresholds": [], 726 | "timeFrom": null, 727 | "timeShift": null, 728 | "title": "External Redeliveries per second", 729 | "tooltip": { 730 | "shared": true, 731 | "sort": 0, 732 | "value_type": "individual" 733 | }, 734 | "type": "graph", 735 | "xaxis": { 736 | "buckets": null, 737 | "mode": "time", 738 | "name": null, 739 | "show": true, 740 | "values": [] 741 | }, 742 | "yaxes": [ 743 | { 744 | "decimals": 0, 745 | "format": "short", 746 | "label": null, 747 | "logBase": 1, 748 | "max": null, 749 | "min": "0", 750 | "show": true 751 | }, 752 | { 753 | "format": "short", 754 | "label": null, 755 | "logBase": 1, 756 | "max": null, 757 | "min": null, 758 | "show": false 759 | } 760 | ], 761 | "yaxis": { 762 | "align": false, 763 | "alignLevel": null 764 | } 765 | }, 766 | { 767 | "aliasColors": {}, 768 | "bars": false, 769 | "dashLength": 10, 770 | "dashes": false, 771 | "datasource": "Prometheus", 772 | "fill": 1, 773 | "gridPos": { 774 | "h": 5, 775 | "w": 12, 776 | "x": 0, 777 | "y": 16 778 | }, 779 | "id": 22, 780 | "legend": { 781 | "avg": false, 782 | "current": false, 783 | "max": false, 784 | "min": false, 785 | "show": false, 786 | "total": false, 787 | "values": false 788 | }, 789 | "lines": true, 790 | "linewidth": 1, 791 | "links": [], 792 | "nullPointMode": "null", 793 | "percentage": false, 794 | "pointradius": 5, 795 | "points": false, 796 | "renderer": "flot", 797 | "seriesOverrides": [], 798 | "spaceLength": 10, 799 | "stack": false, 800 | "steppedLine": false, 801 | "targets": [ 802 | { 803 | "expr": "rate(org_apache_camel_Redeliveries{route=\"$route\"}[5m])", 804 | "format": "time_series", 805 | "intervalFactor": 1, 806 | "refId": "A" 807 | } 808 | ], 809 | "thresholds": [], 810 | "timeFrom": null, 811 | "timeShift": null, 812 | "title": "Redeliveries per second", 813 | "tooltip": { 814 | "shared": true, 815 | "sort": 0, 816 | "value_type": "individual" 817 | }, 818 | "type": "graph", 819 | "xaxis": { 820 | "buckets": null, 821 | "mode": "time", 822 | "name": null, 823 | "show": true, 824 | "values": [] 825 | }, 826 | "yaxes": [ 827 | { 828 | "decimals": 0, 829 | "format": "short", 830 | "label": null, 831 | "logBase": 1, 832 | "max": null, 833 | "min": "0", 834 | "show": true 835 | }, 836 | { 837 | "format": "short", 838 | "label": null, 839 | "logBase": 1, 840 | "max": null, 841 | "min": null, 842 | "show": false 843 | } 844 | ], 845 | "yaxis": { 846 | "align": false, 847 | "alignLevel": null 848 | } 849 | }, 850 | { 851 | "aliasColors": {}, 852 | "bars": false, 853 | "dashLength": 10, 854 | "dashes": false, 855 | "datasource": "Prometheus", 856 | "fill": 1, 857 | "gridPos": { 858 | "h": 5, 859 | "w": 12, 860 | "x": 12, 861 | "y": 16 862 | }, 863 | "id": 18, 864 | "legend": { 865 | "avg": false, 866 | "current": false, 867 | "max": false, 868 | "min": false, 869 | "show": false, 870 | "total": false, 871 | "values": false 872 | }, 873 | "lines": true, 874 | "linewidth": 1, 875 | "links": [], 876 | "nullPointMode": "null", 877 | "percentage": false, 878 | "pointradius": 5, 879 | "points": false, 880 | "renderer": "flot", 881 | "seriesOverrides": [], 882 | "spaceLength": 10, 883 | "stack": false, 884 | "steppedLine": false, 885 | "targets": [ 886 | { 887 | "expr": "rate(org_apache_camel_FailuresHandled{route=\"$route\"}[5m])", 888 | "format": "time_series", 889 | "intervalFactor": 1, 890 | "refId": "A" 891 | } 892 | ], 893 | "thresholds": [], 894 | "timeFrom": null, 895 | "timeShift": null, 896 | "title": "Failures handled per second", 897 | "tooltip": { 898 | "shared": true, 899 | "sort": 0, 900 | "value_type": "individual" 901 | }, 902 | "type": "graph", 903 | "xaxis": { 904 | "buckets": null, 905 | "mode": "time", 906 | "name": null, 907 | "show": true, 908 | "values": [] 909 | }, 910 | "yaxes": [ 911 | { 912 | "decimals": 0, 913 | "format": "short", 914 | "label": null, 915 | "logBase": 1, 916 | "max": null, 917 | "min": "0", 918 | "show": true 919 | }, 920 | { 921 | "format": "short", 922 | "label": null, 923 | "logBase": 1, 924 | "max": null, 925 | "min": null, 926 | "show": false 927 | } 928 | ], 929 | "yaxis": { 930 | "align": false, 931 | "alignLevel": null 932 | } 933 | } 934 | ], 935 | "refresh": false, 936 | "schemaVersion": 16, 937 | "style": "dark", 938 | "tags": [], 939 | "templating": { 940 | "list": [ 941 | { 942 | "allValue": null, 943 | "current": {}, 944 | "datasource": "Prometheus", 945 | "includeAll": false, 946 | "label": "Route", 947 | "multi": false, 948 | "name": "route", 949 | "query": "label_values(org_apache_camel_ExchangesTotal, route)", 950 | "refresh": 1, 951 | "skipUrlSync": false, 952 | "sort": 1, 953 | "tagValuesQuery": "", 954 | "tags": [], 955 | "tagsQuery": "", 956 | "type": "query", 957 | "useTags": false 958 | } 959 | ] 960 | }, 961 | "time": { 962 | "from": "now-6h", 963 | "to": "now" 964 | }, 965 | "timepicker": { 966 | "refresh_intervals": [ 967 | "5s", 968 | "10s", 969 | "30s", 970 | "1m", 971 | "5m", 972 | "15m", 973 | "30m", 974 | "1h", 975 | "2h", 976 | "1d" 977 | ], 978 | "time_options": [ 979 | "5m", 980 | "15m", 981 | "1h", 982 | "6h", 983 | "12h", 984 | "24h", 985 | "2d", 986 | "7d", 987 | "30d" 988 | ] 989 | }, 990 | "timezone": "browser", 991 | "title": "Camel Microservice Demo", 992 | "uid": "WDYFyHaik", 993 | "version": 91 994 | } 995 | --------------------------------------------------------------------------------