David Fifield
bd04cd7752
Refactor TestFormatAndClearCountryStats.
2025-08-19 09:58:50 -04:00
David Fifield
cc0a33faea
Move formatAndClearCountryStats test into a new metrics_test.go.
...
This is more unit test–y. We don't need a full broker instantiation for
testing this function, unlike other tests in snowflake-broker_test.go.
2025-08-19 09:58:50 -04:00
David Fifield
ec39237e69
Add a test that formatAndClearCountryStats clears the map.
2025-08-15 19:24:58 +00:00
David Fifield
ed3bd99df6
Rename displayCountryStats to formatAndClearCountryStats.
...
The old name did not make it clear that the function has the side effect
of clearing the map.
2025-08-15 19:24:58 +00:00
David Fifield
75daf2210f
Refactor displayCountryStats.
...
Move the record types closer to where they are used.
Use a strings.Builder rather than repeatedly concatenating strings
(which creates garbage).
Use the value that m.Range already provides us, don't look it up again
with LoadAndDelete.
Add documentation comments.
2025-08-15 19:24:58 +00:00
David Fifield
6e0e5f9137
Express records.Less more clearly.
2025-08-15 19:24:58 +00:00
David Fifield
fed11184c7
Have records.Less express the order we want directly.
...
The ordering is descending by count, then ascending by cc. Express that
directly, rather than specifying the opposite ordering and using
sort.Reverse.
2025-08-15 19:24:58 +00:00
David Fifield
b058b10a94
Express binCount using integer operations.
...
No need to bring a float64 into this.
2025-08-15 19:24:58 +00:00
Cecylia Bocovich
70974640ab
Defer SQS client IP extraction to ClientOffers
...
Now that both SQS and AMP cache are pulling remote addresses from the
SDP, avoid duplicate decodings of the ClientPollRequest by extracting
the remote addr in ClientOffers.
2025-08-14 14:13:47 -04:00
Cecylia Bocovich
0bbcb1eca4
Add test for AMP cache geolocation
2025-08-14 14:13:47 -04:00
Cecylia Bocovich
31f879aad5
Pull client IP from SDP for AMP cache rendezvous
...
The remote address for AMP cache rendezvous is always geolocated to the
AMP cache server address. For more accurate metrics on where this
rendezvous method is used and working, we can pull the remote address
directly from the client SDP sent in the poll request.
2025-08-14 14:13:47 -04:00
Shelikhoo
8ae1994e4b
Update snowflake proxy image to use most recent golang and geodb
2025-07-31 15:01:07 +01:00
meskio
a9fe899198
Merge remote-tracking branch 'gitlab/mr/593'
2025-07-31 11:19:18 +02:00
Renovate Bot
437cc37443
chore(deps): update module github.com/aws/aws-sdk-go-v2/config to v1.30.2
2025-07-30 19:29:12 +00:00
Renovate Bot
a176e7567d
chore(deps): update module github.com/aws/aws-sdk-go-v2/config to v1.29.18
2025-07-22 10:00:58 -04:00
Renovate Bot
79c4dfbdc8
chore(deps): update module github.com/pion/sdp/v3 to v3.0.15
2025-07-22 09:58:16 -04:00
Cecylia Bocovich
58b1d48e54
Increment prometheus proxy_total count once per IP
...
This fixes a regression from !574 that did not check whether the IP was
unique before incrementing the counter.
Closes https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40470
2025-07-10 10:41:26 -04:00
Cecylia Bocovich
d7ebb2f99c
Add clarification to broker-spec on client-*-ips
2025-07-10 10:34:26 -04:00
David Auer
1dc9947d2a
Fix missing labels in Docker image
...
In a multi stage Docker build, the LABEL commands need to be applied in the final stage.
2025-07-08 20:58:09 +00:00
Cecylia Bocovich
1d73e14f34
Rename metrics update functions
...
This changes the metrics update functions to UpdateProxyStats and
UpdateClientStats, which is more accurate and clear than the previous
CountryStats and RendezvousStats names.
2025-06-24 13:12:10 -04:00
Cecylia Bocovich
78cf8e68b2
Simplify broker metrics and remove mutexes
...
This is a large change to how the snowflake broker metrics are
implemented. This change removes all uses of mutexes from the metrics
implementation in favor of atomic operations on counters stored in
sync.Map.
There is a small change to the actual metrics output. We used to count
the same proxy ip multiple times in our snowflake-ips-total and
snowflake-ips country stats if the same proxy ip address polled more
than once with different proxy types. This was an overcounting of the
number of unique proxy IP addresses that is now fixed.
If a unique proxy ip polls with more than one proxy type or nat type,
these polls will still be counted once for each proxy type or nat type
in our proxy type and nat type specific stats (e.g.,
snowflake-ips-nat-restricted and snowflake-ips-nat-unrestricted).
2025-06-24 13:12:10 -04:00
David Fifield
64c7a26475
Comment typo.
2025-06-19 15:39:24 +00:00
David Fifield
55a06f216c
Delete stray space.
2025-06-19 15:26:39 +00:00
Renovate Bot
2650ef7468
chore(deps): update module github.com/pion/webrtc/v4 to v4.1.2
2025-06-18 15:56:40 +01:00
Renovate Bot
647d5d37c7
chore(deps): update module github.com/pion/sdp/v3 to v3.0.12
2025-05-21 10:55:22 -04:00
Cecylia Bocovich
a377a4e0da
Add client-snowflake-timeout-count to broker spec
...
We added a new snowflake metric on the number of timeouts. This brings
doc/broker-spec.txt up to date on our current exported metrics.
2025-05-20 12:29:41 -04:00
meskio
1c53a63744
Merge remote-tracking branch 'gitlab/mr/569'
2025-05-13 13:43:15 +02:00
Gus
506c33a2fd
Update Snowflake bridge lines - CDN77, ampcache, and SQS
2025-05-12 20:03:54 +01:00
Renovate Bot
5d956456a5
chore(deps): update module github.com/prometheus/client_golang to v1.22.0
2025-05-01 14:24:46 +01:00
Renovate Bot
e5a8a16efc
chore(deps): update module github.com/aws/aws-sdk-go-v2/config to v1.29.14
2025-05-01 13:42:30 +01:00
meskio
726d66c75c
Merge remote-tracking branches 'gitlab/mr/551', 'gitlab/mr/552' and 'gitlab/mr/555'
2025-04-29 10:26:40 +02:00
Renovate Bot
8fa0717552
chore(deps): update module github.com/pion/webrtc/v4 to v4.1.0
2025-04-28 12:40:55 +00:00
Renovate Bot
28fd1ecc2b
chore(deps): update module github.com/aws/aws-sdk-go-v2/service/sqs to v1.38.5
2025-04-28 12:40:51 +00:00
Renovate Bot
236f15f81c
chore(deps): update module github.com/aws/aws-sdk-go-v2/credentials to v1.17.67
2025-04-28 12:40:45 +00:00
Shelikhoo
a4a55e4398
CI: fix invalid group name by removing trail slash
2025-04-28 13:25:53 +01:00
Renovate Bot
ef276c8161
chore(deps): update module github.com/pion/ice/v4 to v4.0.10
2025-04-24 14:59:22 +01:00
Shelikhoo
3d7dcfc55d
Add updated docker compose file
2025-04-17 16:41:22 +01:00
meskio
2a5a09e451
CI: use the parent group as namespace for the dependency proxy
...
This should solve our problem failing to get images on CI runs.
2025-04-16 15:41:36 +02:00
Renovate Bot
d264cf2cdb
chore(deps): update module github.com/miekg/dns to v1.1.65
2025-04-14 15:12:45 +01:00
Renovate Bot
a5ee60e3b5
chore(deps): update module github.com/aws/aws-sdk-go-v2/config to v1.29.13
2025-04-09 15:45:54 +01:00
Renovate Bot
396f7b9941
chore(deps): update module github.com/pion/ice/v4 to v4.0.9
2025-04-03 14:10:40 +01:00
Cecylia Bocovich
9378c53d8e
Bump version of shadow for CI tests
2025-04-02 11:11:01 -04:00
Renovate Bot
61c797406b
chore(deps): update module github.com/prometheus/client_golang to v1.21.1
2025-04-01 20:50:59 +01:00
Cecylia Bocovich
f712dfdd72
Fix shadow and tgen cache in .gitlab-ci.yml
...
Make sure shadow and tgen runtime dependencies are installed and the
paths are correct
2025-03-27 22:12:35 -04:00
Cecylia Bocovich
08239cca2a
Remove broker log messages for invalid SDP and SQS cleanup
2025-03-27 15:34:09 -04:00
Renovate Bot
5ec92a5dd4
chore(deps): update module github.com/aws/aws-sdk-go-v2/credentials to v1.17.64
2025-03-27 14:36:38 +00:00
Cecylia Bocovich
dd5fb03c49
Remove default relay pattern option from broker
...
This was only useful to us when we first implemented the feature, to be
able to support proxies that hadn't yet updated, when we had a single
Snowflake bridge. Now that we have multiple bridges, it is unecessary as
proxies that don't send their accepted relay pattern are rejected
anyway.
2025-03-26 13:32:30 -04:00
Cecylia Bocovich
c0ac0186f1
Remove bad relay pattern log message
...
We already count proxies rejected for their supported relay URL in
snowflake metrics and these messages are filling up our broker logs.
2025-03-26 13:32:30 -04:00
Cecylia Bocovich
8343bbc336
Add context with timeout for client requests
...
Client timeouts are currently counted from when the client is matched
with a proxy. Instead, count client timeouts from the moment when the
request is received.
Closes #40449
2025-03-26 13:30:59 -04:00
Cecylia Bocovich
db0364ef87
Update DEBIAN_STABLE to bookworm in CI tests
2025-03-20 12:32:40 -04:00