Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

edge.md 1.9 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. ---
  2. id: edge
  3. title: Edges
  4. ---
  5. Edge is representing an edge between Nodes.
  6. ## Basic
  7. Edge is an object representing a connection between Nodes with some additional properties.
  8. An edge object contains three attributes: **label**, **color** and **style** which mirror corresponding graphviz edge attributes.
  9. ```python
  10. from diagrams import Cluster, Diagram, Edge
  11. from diagrams.onprem.analytics import Spark
  12. from diagrams.onprem.compute import Server
  13. from diagrams.onprem.database import PostgreSQL
  14. from diagrams.onprem.inmemory import Redis
  15. from diagrams.onprem.logging import Fluentd
  16. from diagrams.onprem.monitoring import Grafana, Prometheus
  17. from diagrams.onprem.network import Nginx
  18. from diagrams.onprem.queue import Kafka
  19. with Diagram(name="Advanced Web Service with On-Premise (colored)", show=False):
  20. ingress = Nginx("ingress")
  21. metrics = Prometheus("metric")
  22. metrics << Edge(color="firebrick", style="dashed") << Grafana("monitoring")
  23. with Cluster("Service Cluster"):
  24. grpcsvc = [
  25. Server("grpc1"),
  26. Server("grpc2"),
  27. Server("grpc3")]
  28. with Cluster("Sessions HA"):
  29. master = Redis("session")
  30. master - Edge(color="brown", style="dashed") - Redis("replica") << Edge(label="collect") << metrics
  31. grpcsvc >> Edge(color="brown") >> master
  32. with Cluster("Database HA"):
  33. master = PostgreSQL("users")
  34. master - Edge(color="brown", style="dotted") - PostgreSQL("slave") << Edge(label="collect") << metrics
  35. grpcsvc >> Edge(color="black") >> master
  36. aggregator = Fluentd("logging")
  37. aggregator >> Edge(label="parse") >> Kafka("stream") >> Edge(color="black", style="bold") >> Spark("analytics")
  38. ingress >> Edge(color="darkgreen") << grpcsvc >> Edge(color="darkorange") >> aggregator
  39. ```
  40. ![advanced web service with on-premise diagram colored](/img/advanced_web_service_with_on-premise_colored.png)