Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

7 месяцев назад
7 месяцев назад
7 месяцев назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. ---
  2. id: edge
  3. title: Edges
  4. ---
  5. `Edge` represents 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**. They mirror the 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.aggregator 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-Premises (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. primary = Redis("session")
  30. primary \
  31. - Edge(color="brown", style="dashed") \
  32. - Redis("replica") \
  33. << Edge(label="collect") \
  34. << metrics
  35. grpcsvc >> Edge(color="brown") >> primary
  36. with Cluster("Database HA"):
  37. primary = PostgreSQL("users")
  38. primary \
  39. - Edge(color="brown", style="dotted") \
  40. - PostgreSQL("replica") \
  41. << Edge(label="collect") \
  42. << metrics
  43. grpcsvc >> Edge(color="black") >> primary
  44. aggregator = Fluentd("logging")
  45. aggregator \
  46. >> Edge(label="parse") \
  47. >> Kafka("stream") \
  48. >> Edge(color="black", style="bold") \
  49. >> Spark("analytics")
  50. ingress \
  51. >> Edge(color="darkgreen") \
  52. << grpcsvc \
  53. >> Edge(color="darkorange") \
  54. >> aggregator
  55. ```
  56. ![advanced web service with on-premises diagram colored](/img/advanced_web_service_with_on-premises_colored.png)