mirror of https://github.com/mingrammer/diagrams
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.9 KiB
54 lines
1.9 KiB
---
|
|
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.logging 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)
|