refactor(server): remove sanctioned-country filter from shared metrics

The opt-in usage report dropped rows from a hardcoded set of countries
(CU, KP, SY). PR #1717 proposed removing just SY; this removes the
filter entirely, along with its helper and the spec that covered it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Sarah Laplante 2026-10-21 13:58:55 +02:00
parent de566bfc9f
commit 22c0ba084e
2 changed files with 0 additions and 47 deletions

View file

@ -205,45 +205,6 @@ describe('OutlineSharedMetricsPublisher', () => {
]);
publisher.stopSharing();
});
it('ignores sanctioned countries', async () => {
const clock = new ManualClock();
const startTime = clock.nowMs;
const serverConfig = new InMemoryConfig<ServerConfigJson>({serverId: 'server-id'});
const usageMetrics = new ManualUsageMetrics();
const metricsCollector = new FakeMetricsCollector();
const publisher = new OutlineSharedMetricsPublisher(
clock,
serverConfig,
null,
usageMetrics,
metricsCollector
);
publisher.startSharing();
usageMetrics.reportedUsage = [
{country: 'AA', tunnelTimeSec: 99, inboundBytes: 11},
{country: 'SY', tunnelTimeSec: 88, inboundBytes: 11},
{country: 'CC', tunnelTimeSec: 77, inboundBytes: 22},
{country: 'AA', tunnelTimeSec: 66, inboundBytes: 33},
{country: 'DD', tunnelTimeSec: 55, inboundBytes: 33},
];
clock.nowMs += 60 * 60 * 1000;
await clock.runCallbacks();
expect(metricsCollector.collectedServerUsageReport).toEqual({
serverId: 'server-id',
startUtcMs: startTime,
endUtcMs: clock.nowMs,
userReports: [
{bytesTransferred: 11, tunnelTimeSec: 99, countries: ['AA']},
{bytesTransferred: 22, tunnelTimeSec: 77, countries: ['CC']},
{bytesTransferred: 33, tunnelTimeSec: 66, countries: ['AA']},
{bytesTransferred: 33, tunnelTimeSec: 55, countries: ['DD']},
],
});
publisher.stopSharing();
});
});
it('reports feature metrics correctly', async () => {
const clock = new ManualClock();

View file

@ -24,7 +24,6 @@ import {ServerConfigJson} from './server_config';
const MS_PER_HOUR = 60 * 60 * 1000;
const MS_PER_DAY = 24 * MS_PER_HOUR;
const SANCTIONED_COUNTRIES = new Set(['CU', 'KP', 'SY']);
export interface ReportedUsage {
country: string;
@ -238,9 +237,6 @@ export class OutlineSharedMetricsPublisher implements SharedMetricsPublisher {
if (locationUsage.inboundBytes === 0 && locationUsage.tunnelTimeSec === 0) {
continue;
}
if (isSanctionedCountry(locationUsage.country)) {
continue;
}
// Make sure to always set a country, which is required by the metrics server validation.
// It's used to differentiate the row from the legacy key usage rows.
const country = locationUsage.country || 'ZZ';
@ -282,7 +278,3 @@ export class OutlineSharedMetricsPublisher implements SharedMetricsPublisher {
await this.metricsCollector.collectFeatureMetrics(featureMetricsReport);
}
}
function isSanctionedCountry(country: string) {
return SANCTIONED_COUNTRIES.has(country);
}