How to access the routing cost per circuit?

You have replied on my previous post

╭────────────────────────┬─────────┬────────┬─────────┬────────────────────────┬──────────┬──────┬────────────┬──────────────┬────────────╮
│ ID                     │ SERVICE │ ROUTER │ BINDING │ ADDRESS                │ INSTANCE │ COST │ PRECEDENCE │ DYNAMIC COST │ HOST ID    │
├────────────────────────┼─────────┼────────┼─────────┼────────────────────────┼──────────┼──────┼────────────┼──────────────┼────────────┤
│ 2mdoEbtVprBVKYJQKlOtYR │ element │ dc67   │ edge    │ 2mdoEbtVprBVKYJQKlOtYR │          │    0 │ default    │            4 │ oOesPw1m9F │
│ 6TJfsrSiFqEp6HNdfovgEw │ socks5  │ ovh76  │ edge    │ 6TJfsrSiFqEp6HNdfovgEw │          │    0 │ default    │           38 │ oOesPw1m9F │
╰────────────────────────┴─────────┴────────┴─────────┴────────────────────────┴──────────┴──────┴────────────┴──────────────┴────────────╯

So initially I thought as you have explained. But in reality I observe a strange behavior.
The services are on the same machine ovh29.
ping ovh29 -> ovhXX time=0.08ms
ping ovh29 -> dc67 time=17ms

If SDK picks up a wrong router dc67 then all routings to element service becomes wrong also. Because ziti routes all to dc67 but the service runs on ovh29.

Below is another example of wrong allocation of the service terminator. Element is bond to dc67. I apologize to remind that the services socks5 and element are on the same host ovh29.

ziti fabric list terminators
╭────────────────────────┬─────────┬────────┬─────────┬────────────────────────┬──────────┬──────┬────────────┬──────────────┬────────────╮
│ ID                     │ SERVICE │ ROUTER │ BINDING │ ADDRESS                │ INSTANCE │ COST │ PRECEDENCE │ DYNAMIC COST │ HOST ID    │
├────────────────────────┼─────────┼────────┼─────────┼────────────────────────┼──────────┼──────┼────────────┼──────────────┼────────────┤
│ 49r7aG1NIvJZxAC1TksdcB │ socks5  │ ovh29  │ edge    │ 49r7aG1NIvJZxAC1TksdcB │          │    0 │ default    │           34 │ oOesPw1m9F │
│ 6IFJyFAI1Bo8RoCwV5QrL1 │ element │ dc67   │ edge    │ 6IFJyFAI1Bo8RoCwV5QrL1 │          │    0 │ default    │            2 │ oOesPw1m9F │
╰────────────────────────┴─────────┴────────┴─────────┴────────────────────────┴──────────┴──────┴────────────┴──────────────┴────────────╯

So this routing table is wrong: the flow goes from ovh76 to dc67 (16ms) + tsl:dc67 -> ovh29 (16ms). Instead of the routing ovh76->ovhXX (0.08ms). This is a big mistake.

ziti fabric list circuits
╭───────────┬───────────────────────────┬─────────┬────────────────────────┬─────────────────────┬────────────────────────────────────────────────╮
│ ID        │ CLIENT                    │ SERVICE │ TERMINATOR             │ CREATEDAT           │ PATH                                           │
├───────────┼───────────────────────────┼─────────┼────────────────────────┼─────────────────────┼────────────────────────────────────────────────┤
│ 8qWj.MUKn │ cma4et4nz00tge5j4r3hv2yzx │ socks5  │ 49r7aG1NIvJZxAC1TksdcB │ 2025-04-30 21:27:54 │ r/ovh3 -> l/3oE6TrCSI1mkYAUmbXxb8m -> r/ovh29  │
│ EFoHozQKW │ cma4et4nz00tge5j4r3hv2yzx │ socks5  │ 49r7aG1NIvJZxAC1TksdcB │ 2025-04-30 20:51:50 │ r/ovh76 -> l/5qU3vy8Jt6pot3OMo54zw9 -> r/ovh29 │
│ EH7dWSUKW │ cma4esray00sve5j472ippq8u │ element │ 6IFJyFAI1Bo8RoCwV5QrL1 │ 2025-04-30 21:00:38 │ r/ovh76 -> l/3VbM5wCg8iOECiy3uiwky5 -> r/dc67  │
│ ESWksSUmn │ cma4et4nz00tge5j4r3hv2yzx │ socks5  │ 49r7aG1NIvJZxAC1TksdcB │ 2025-04-30 21:28:59 │ r/ovh3 -> l/3oE6TrCSI1mkYAUmbXxb8m -> r/ovh29  │
│ EWtLsMUmn │ cma4et4nz00tge5j4r3hv2yzx │ socks5  │ 49r7aG1NIvJZxAC1TksdcB │ 2025-04-30 21:28:49 │ r/ovh3 -> l/3oE6TrCSI1mkYAUmbXxb8m -> r/ovh29  │
│ I41L.SUKn │ cma4et4nz00tge5j4r3hv2yzx │ socks5  │ 49r7aG1NIvJZxAC1TksdcB │ 2025-04-30 21:28:49 │ r/ovh3 -> l/3oE6TrCSI1mkYAUmbXxb8m -> r/ovh29  │
│ PHxA.SUKW │ cma4et4nz00tge5j4r3hv2yzx │ socks5  │ 49r7aG1NIvJZxAC1TksdcB │ 2025-04-30 21:28:45 │ r/ovh3 -> l/3oE6TrCSI1mkYAUmbXxb8m -> r/ovh29  │
│ QYop.SQmn │ cma4et4nz00tge5j4r3hv2yzx │ socks5  │ 49r7aG1NIvJZxAC1TksdcB │ 2025-04-30 21:27:53 │ r/ovh3 -> l/3oE6TrCSI1mkYAUmbXxb8m -> r/ovh29  │
│ Rni4.SQmW │ cma4et4nz00tge5j4r3hv2yzx │ socks5  │ 49r7aG1NIvJZxAC1TksdcB │ 2025-04-30 21:29:36 │ r/ovh3 -> l/3oE6TrCSI1mkYAUmbXxb8m -> r/ovh29  │
│ VGWj.MUmn │ cma4et4nz00tge5j4r3hv2yzx │ socks5  │ 49r7aG1NIvJZxAC1TksdcB │ 2025-04-30 21:27:54 │ r/ovh3 -> l/3oE6TrCSI1mkYAUmbXxb8m -> r/ovh29  │
╰───────────┴───────────────────────────┴─────────┴────────────────────────┴─────────────────────┴────────────────────────────────────────────────╯

I don't understand why the route paths ovh76->dc67 (ping time=17ms) and ovh76->ovh29 (ping time=0.08ms) have a similar path_cost 262186/262175.

grep EH7dWSUKW /var/log/ziti-controller/fabric-circuit.json
{"namespace":"circuit","event_src_id":"dc","timestamp":"2025-04-30T21:00:38.561344893Z","version":2,"event_type":"created","circuit_id":"EH7dWSUKW","client_id":"cma4esray00sve5j472ippq8u","service_id":"422e3i40ThOGC0YVX5HaMY","terminator_id":"6IFJyFAI1Bo8RoCwV5QrL1","instance_id":"","creation_timespan":19431645,"path":{"nodes":["JI-BBYbyIW","WIZxdWbqhW"],"links":["3VbM5wCg8iOECiy3uiwky5"],"ingress_id":"yXGQ","egress_id":"d5gJ"},"link_count":1,"path_cost":262186,"tags":{"clientId":"OH7ESFp5e","hostId":"oOesPw1m9F","serviceId":"422e3i40ThOGC0YVX5HaMY"}}

grep EFoHozQKW /var/log/ziti-controller/fabric-circuit.json
{"namespace":"circuit","event_src_id":"dc","timestamp":"2025-04-30T20:51:50.787927352Z","version":2,"event_type":"created","circuit_id":"EFoHozQKW","client_id":"cma4et4nz00tge5j4r3hv2yzx","service_id":"297xbk7xZecDRoHI3vQ4GC","terminator_id":"49r7aG1NIvJZxAC1TksdcB","instance_id":"","creation_timespan":22623781,"path":{"nodes":["JI-BBYbyIW","7H8BaaKm9F"],"links":["5qU3vy8Jt6pot3OMo54zw9"],"ingress_id":"y2or","egress_id":"dKMy"},"link_count":1,"path_cost":262175,"tags":{"clientId":"OH7ESFp5e","hostId":"oOesPw1m9F","serviceId":"297xbk7xZecDRoHI3vQ4GC"}}

In these two post I talk about two scenarios:

  1. allocation of service terminators
  2. client routing path

It happens that they are both have the same issue.

The current post is mostly about the connection from access side to a service (socks5). We have ping time=28ms to dc, and ping time=16ms to ovhXX. You say that the circuits are per connection. It is very good. Why two circuits above have a very similar path_cost? This is an error? The later connection is 2 times faster than the former. So the client connects to the remote router dc67, the remote router dc67 send the flow to ovh89. This is the worst scenario we would like to avoid.
"event_src_id":"dc" is simply the controller's name which is hosted on the same machine as the router dc67.

As I see the access side connects to all available routers. So the only problem is how to create fast circuits for the initiating side (latency+measure of throughput). But there is a problem with the service terminators. If the service picks up a wrong router dc67 then all circuits become wrong. I just need to restart the bad router to break this bond.

Exactly. This is how I have found the path_cost whose values are misleading for me. So I concluded that the circuits are connection independent.