|
|
|
---
|
|
|
|
id: edge
|
|
|
|
title: Edges
|
|
|
|
---
|
|
|
|
|
|
|
|
Edge is representing an edge between Nodes.
|
|
|
|
|
|
|
|
## Basic
|
|
|
|
|
|
|
|
Edge is an object representing a connection between Nodes with some additional properties.
|
|
|
|
|
|
|
|
An edge object contains three attributes: **label**, **color** and **style** which mirror corresponding graphviz edge attributes.
|
|
|
|
|
|
|
|
```python
|
|
|
|
from diagrams import Cluster, Diagram, Edge
|
|
|
|
from diagrams.onprem.analytics import Spark
|
|
|
|
from diagrams.onprem.compute import Server
|
|
|
|
from diagrams.onprem.database import PostgreSQL
|
|
|
|
from diagrams.onprem.inmemory import Redis
|
|
|
|
from diagrams.onprem.aggregator import Fluentd
|
|
|
|
from diagrams.onprem.monitoring import Grafana, Prometheus
|
|
|
|
from diagrams.onprem.network import Nginx
|
|
|
|
from diagrams.onprem.queue import Kafka
|
|
|
|
|
|
|
|
with Diagram(name="Advanced Web Service with On-Premise (colored)", show=False):
|
|
|
|
ingress = Nginx("ingress")
|
|
|
|
|
|
|
|
metrics = Prometheus("metric")
|
|
|
|
metrics << Edge(color="firebrick", style="dashed") << Grafana("monitoring")
|
|
|
|
|
|
|
|
with Cluster("Service Cluster"):
|
|
|
|
grpcsvc = [
|
|
|
|
Server("grpc1"),
|
|
|
|
Server("grpc2"),
|
|
|
|
Server("grpc3")]
|
|
|
|
|
|
|
|
with Cluster("Sessions HA"):
|
|
|
|
master = Redis("session")
|
|
|
|
master \
|
|
|
|
- Edge(color="brown", style="dashed") \
|
|
|
|
- Redis("replica") \
|
|
|
|
<< Edge(label="collect") \
|
|
|
|
<< metrics
|
|
|
|
grpcsvc >> Edge(color="brown") >> master
|
|
|
|
|
|
|
|
with Cluster("Database HA"):
|
|
|
|
master = PostgreSQL("users")
|
|
|
|
master \
|
|
|
|
- Edge(color="brown", style="dotted") \
|
|
|
|
- PostgreSQL("slave") \
|
|
|
|
<< Edge(label="collect") \
|
|
|
|
<< metrics
|
|
|
|
grpcsvc >> Edge(color="black") >> master
|
|
|
|
|
|
|
|
aggregator = Fluentd("logging")
|
|
|
|
aggregator \
|
|
|
|
>> Edge(label="parse") \
|
|
|
|
>> Kafka("stream") \
|
|
|
|
>> Edge(color="black", style="bold") \
|
|
|
|
>> Spark("analytics")
|
|
|
|
|
|
|
|
ingress \
|
|
|
|
>> Edge(color="darkgreen") \
|
|
|
|
<< grpcsvc \
|
|
|
|
>> Edge(color="darkorange") \
|
|
|
|
>> aggregator
|
|
|
|
```
|
|
|
|
|
|
|
|
![advanced web service with on-premise diagram colored](/img/advanced_web_service_with_on-premise_colored.png)
|