Spring Cloud Data Flow - Animated
Spring Cloud Data Flow - Animated
Message Middleware
(Kafka, RabbitMQ, …) RSocket API
Prometheus Prometheus Grafana
RSocket Proxy Scrap API (TSDB)
PromQL
metrics
Message Middleware
(Kafka, RabbitMQ, …) RSocket API
Prometheus Prometheus Grafana
RSocket Proxy Scrap API (TSDB)
PromQL
metrics
@EnableBinding(Processor.class) c
B public class Application { B
e i i o
v foo n @StreamListener("foo")
n bar n
@SendTo("bar")
e d public String replaceStringMsgHandler(String payload) { d s
n i i u
t n return StringUtils.replace(payload, "foo", "bar");
n m
}
s g } g e
s s r
s
@EnableBinding(Processor.class) c
B public class Application { B
e i i o
v foo n @StreamListener("foo")
n bar n
@SendTo("bar")
e d public KStream<Object, Foo> handler( d s
n i KStream<Object, Event> input) { i u
t n return ...;
n m
}
s g } g e
s s r
s
@EnableBinding(Processor.class) c
B public class Application { B
e i i o
v foo n @StreamListener("foo")
n bar n
@SendTo("bar")
e d public Flux<Average> average(Flux<Sensor> data) { d s
n i i u
t n return ...;
n m
}
s g } g e
s s r
s
@EnableBinding(Processor.class) c
B public class Application { B
e i i o
v foo n n bar n
@Bean
e d public Function<String, String> toUpperCase() { d s
n i i u
t n return s -> s.toUpperCase();
n m
}
s g } g e
s s r
s
app register transform:V2 Data Flow API Data Flow SKIPPER API Skipper Deploy
Update
Rollback
Server Server
update to transform:V2
rollback
Platforms: Local, Kubernetes, Cloud Foundry
transform
time V1
log
Deployer SPI
transform
V2
Create
Platforms:
Local, Kubernetes, Cloud Foundry
hotDrinksDest hot
Data Flow API Data Flow Skipper Drink
App
Server Server ordersDest
order
barista
Gen
App
App
cold
Drink
Deploy coldDrinksDest App
--app.orderGenApp.spring.cloud.stream.bindings.output.destination=ordersDest
--app.baristaApp.spring.cloud.stream.bindings.orders.destination=ordersDest
--app.baristaApp.spring.cloud.stream.bindings.hotDrinks.destination=hotDrinksDest
--app.hotDrinkApp.spring.cloud.stream.bindings.input.destination=hotDrinksDest
--app.baristaApp.spring.cloud.stream.bindings.coldDrinks.destination=coldDrinksDest
--app.coldDrinkApp.spring.cloud.stream.bindings.input.destination=coldDrinksDest
--app.orderGenApp.spring.cloud.stream.bindings.output.destination=ordersDest
--app.baristaApp.spring.cloud.stream.bindings.orders.destination=ordersDest
--app.baristaApp.spring.cloud.stream.bindings.hotDrinks.destination=hotDrinksDest
--app.hotDrinkApp.spring.cloud.stream.bindings.input.destination=hotDrinksDest
--app.baristaApp.spring.cloud.stream.bindings.coldDrinks.destination=coldDrinksDest
--app.coldDrinkApp.spring.cloud.stream.bindings.input.destination=coldDrinksDest
Deployment
Prometheus Prometheus
RSocket Proxy (TSDB)
Deploy
Scale UP/DOWN
Credit Card
Company Platforms: Local, Kubernetes, Cloud Foundry Prometheus
Credit card (TSDB)
purchases Card Tx, Credit card
processing Transactions CDC
Fraud
Fraud
Fraud
Detection
Detection Counter
Debezium Detection
Micrometer
DB
Customers Prometheus
Pre-trained ML Fraud RSocket Proxy
detection models
Historical Transaction Data Train
ML
models
task.myTask=maven://o.s.c.s.app:my-task:1.1.1
Platforms: Grafana
Local, Kubernetes,
Apps Cloud Foundry
Registry
Register, Resolve and
app register -name myTask Metadata
Micrometer
Micrometer
< ExtractDB: myTask Prometheus
Extract Extract
|| Data Flow API Data Flow Deployer SPI (TSDB)
Server DB Files
ExtractFiles: myTask>
&& <<Launch>>
Merge: myTask >
Micrometer
Status Merge
● Uniquely identified by metric name and a set of label dimensions (e.g tags)
● Append-only
Time-Series Databases (TSDB)
● Optimized for time-stamped data Dimensions
. . . . . . . . . . . . . . . . . . . {metrics="request", method="GET"}
. . . . . . . . . . . . . . . . . . . {metrics="request", method="POST"}
● Efficient storage (delta-of-delta) . . . . . . .
. . . . .. . . . . . . . . . . . . ...
. . . . . . . . . . . . . . . . . .
. . . . . . .. . . . . . . . . . . . {metrics="errors", method="POST"}
● Recent data in memory . . . . . . . . . . . .
. . . . . . .. . . . . . .
. . . {metrics="errors", method="GET"}
. . . . . . . . . . . . . . . . . ...
. . . . . . .. . . . . . . . . . . .
Time
● Large time-range scans and
aggregations
● Push vs Pull
Grafana
Micrometer
Micrometer
task 1 task 2
InfluxDB
Push (TSDB) CQL
Metrics t1
micrometer-registry-influx Metrics t2
...
"spring.cloud.dataflow.applicationProperties":{
"task.management.metrics.export.influx":{
"enabled":true,
"db":"myinfluxdb",
Micrometer Micrometer "uri":"http://influxdb:8086"
},
time log "stream.management.metrics.export.influx":{
"enabled":true,
"db":"myinfluxdb",
"uri":"http://influxdb:8086"
Spring Cloud Stream }
RSocket Connections
(bidirectional, durable)
Micrometer
Micrometer
Grafana
task 1 task 2 Monitor the Proxy itself
TCP Endpoint Proxy
Scrap
Prometheus Prometheus
RSocket Proxy (TSDB) PormQL
Websockets
Endpoint Connected
prometheus-rsocket-spring
Scrap Metrics t1
"spring.cloud.dataflow.applicationProperties": { Monitor theMetrics
servicest2
"task.management.metrics.export.prometheus": { connected Metrics t3
to the Proxy
Micrometer Micrometer
"enabled": true, via the TCPMetrics
or t4
"rsocket.enabled": true,
"rsocket.host": <proxy-host>, Websocket ...
endpoints
time log "rsocket.port": <proxy-port>
},
"stream.management.metrics.export.prometheus": {
"enabled": true,
Spring Cloud Stream "rsocket.enabled": true,
"rsocket.host": <proxy-host>,
"rsocket.port": <proxy-port>
}
Alert:
rate(Source)
rate(Source)==
> rate(Processor)
rate(Processor)
Alert Scrap
Prometheus Prometheus Prometheus
AlertManager & Alert Rules RSocket Proxy
Metrics
Processor
#3
Local, Kubernetes, Cloud Foundry
Data Flow Auto-Scaling
Grafana
Alert:
rate(Source)==
rate(Source) > rate(Processor)
rate(Processor)
Query
Webhook
Alert API Alert Scrap
Prometheus Prometheus Prometheus
Web
AlertManager & Alert Rules RSocket Proxy
Hook
Metrics
scale-in
scale-out
SCDF
Scale API
Processor
#3
Terminal
cdc-log
change
events logs
cdc-
debezi log
um
"source": { Source
"connector":Records
"mysql",
DB ....
"db": "inventory",
write-ahead log "table": "customers", metrics Grafana
}, cdc-analytics-tap
"op": "u", ..
Micrometer
"before": {...},
"after": {…} Prometheus &
analytic
RSocket Proxy
PQL
SpEL
--analytics.name=cdc sort_desc(topk(10, sum(cdc_total) by (db, table)))
--analytics.tag.expression.db=#jsonPath(payload,'$..db') sort_desc(topk(100, sum(cdc_total) by (operation)))
--analytics.tag.expression.table=#jsonPath(payload,'$..table') sum(rate(cdc_total[60s])) by (db, table, operation)
--analytics.tag.expression.operation=#jsonPath(payload,'$..op')
Message Binders: Time-Series Databases:
Apache Kafka, RabbitMQ,, Prometheus, Wavefront, InfluxDb, ….
Amazon Kinesis, Google PubSub , ….
Grafana / Wavefront
Micrometer
cdc- Time-Series
DB debezi analytic Database
um (TSDB)
Terminal
cdc-log
change
events logs
cdc-
debezi log
um
"source": {
"connector": "mysql",
DB ....
"db": "inventory",
write-ahead log "table": "customers", metrics Grafana
}, cdc-analytics-tap
"op": "u", ..
Micrometer
"before": {...},
"after": {…} Prometheus &
analytic
RSocket Proxy
PQL
SpEL
--analytics.name=cdc sort_desc(topk(10, sum(cdc_total) by (db, table)))
--analytics.tag.expression.db=#jsonPath(payload,'$..db') sort_desc(topk(100, sum(cdc_total) by (operation)))
--analytics.tag.expression.table=#jsonPath(payload,'$..table') sum(rate(cdc_total[60s])) by (db, table, operation)
--analytics.tag.expression.operation=#jsonPath(payload,'$..op')
Message Binders:
Time-Series Databases:
Apache Kafka, RabbitMQ, Amazon Kinesis,
Prometheus, Wavefront, InfluxDb, ….
Google PubSub , ….
Grafana / Wavefront
Micrometer
CDC- Time-Series
Analytics
DB debezium Database