mirror of
https://github.com/hanzoai/o11y.git
synced 2026-10-15 12:58:33 +00:00
* debrand: signoz/SigNoz/SIGNOZ -> o11y/O11y/O11Y across the tree Rename all SigNoz *branding* to O11y in file contents, file/dir names, package names, env vars, config keys, comments, docs, SDK code, and the ClickHouse schema identifiers the querier reads. Collector dependency: - Repoint github.com/hanzoai/signoz-otel-collector -> github.com/hanzoai/otel-collector and bump v0.144.6 -> v0.144.7 (go.mod + go.sum reconciled via go mod tidy). Internal package paths also debranded upstream: signozschemamigrator -> o11yschemamigrator, signozlogspipelineprocessor -> o11ylogspipelineprocessor. - Fix: v0.144.7 dropped otelconst.DistributedFieldKeysTable from the collector's public constants; pin FieldKeysTable = "distributed_field_keys" locally in pkg/telemetrymetadata/tables.go. Package/dir renames (package decl + all importers): pkg/apiserver/signozapiserver -> o11yapiserver, plus signozalertmanager, signozauthzapi, signozglobal, signozquerier, signozruler, and pkg/signoz -> pkg/o11y. Schema (read plane): signoz_traces/metrics/logs/metadata/analytics/meter and signoz_index_v3/index_v2/error_index_v2/spans (+ distributed_*) -> o11y_*. Data-preserving cutover migration added: deploy/clickhouse/migrations/0001_rename_signoz_to_o11y.sql (metadata-only RENAME DATABASE/TABLE, no drop/recreate). Preserved (attribution / external / wire contracts): - LICENSE + NOTICE verbatim (incl. "software from SigNoz", "Copyright ... SigNoz Inc."). - Upstream github.com/SigNoz/* repo URLs + @SigNoz/* CODEOWNERS teams. - Billing resource-attribute regex "signoz.workspace.*" (external wire contract). go build ./pkg/... ./cmd/... = 0; gofmt clean; renamed+schema pkg tests pass. * o11y: bump collector to v0.144.8 (o11y_* physical schema writer) + lockstep deploy plan Collector v0.144.8's schema-migrator + exporters now CREATE/WRITE the same o11y_* physical databases/tables the querier reads and the RENAME migration (0001_rename_signoz_to_o11y.sql) targets. Cross-checked byte-identical: writer DB set == migration target DB set (6); writer prefixed-table set == migration target table set (8); o11y querier reads and cloud reads are subsets of that set. Zero table-name mismatches between writer, readers, and migration. Collector go.mod unchanged between v0.144.7 and v0.144.8 (identical go.mod hash) — pure source rename, no module-graph change. Adds deploy/clickhouse/DEPLOY_signoz_to_o11y_cutover.md: the lockstep order (collector v0.144.8 -> RENAME migration -> o11y+cloud readers) with a fresh/scratch-ClickHouse pre-flight (create via migrator, emit trace+metric, query back) and rollback. Ships together or telemetry blackholes. go build ./pkg/... ./cmd/community = 0.
99 lines
3.4 KiB
TypeScript
99 lines
3.4 KiB
TypeScript
import {
|
||
test as base,
|
||
expect,
|
||
type Browser,
|
||
type BrowserContext,
|
||
type Page,
|
||
} from '@playwright/test';
|
||
|
||
export type User = { email: string; password: string };
|
||
|
||
// Default user — admin from the pytest bootstrap (.env.local) or staging .env.
|
||
export const ADMIN: User = {
|
||
email: process.env.O11Y_E2E_USERNAME!,
|
||
password: process.env.O11Y_E2E_PASSWORD!,
|
||
};
|
||
|
||
// Per-worker storageState cache. One login per unique user per worker.
|
||
// Promise-valued so concurrent requests share the same in-flight work.
|
||
// Held in memory only — no .auth/ dir, no JSON on disk.
|
||
type StorageState = Awaited<ReturnType<BrowserContext['storageState']>>;
|
||
const storageByUser = new Map<string, Promise<StorageState>>();
|
||
|
||
async function storageFor(browser: Browser, user: User): Promise<StorageState> {
|
||
const cached = storageByUser.get(user.email);
|
||
if (cached) {
|
||
return cached;
|
||
}
|
||
|
||
const task = (async () => {
|
||
const ctx = await browser.newContext();
|
||
const page = await ctx.newPage();
|
||
await login(page, user);
|
||
const state = await ctx.storageState();
|
||
await ctx.close();
|
||
return state;
|
||
})();
|
||
|
||
storageByUser.set(user.email, task);
|
||
return task;
|
||
}
|
||
|
||
async function login(page: Page, user: User): Promise<void> {
|
||
if (!user.email || !user.password) {
|
||
throw new Error(
|
||
'User credentials missing. Set O11Y_E2E_USERNAME / O11Y_E2E_PASSWORD ' +
|
||
'(pytest bootstrap writes them to .env.local), or pass a User via test.use({ user: ... }).',
|
||
);
|
||
}
|
||
await page.goto('/login?password=Y');
|
||
await page.getByTestId('email').fill(user.email);
|
||
await page.getByTestId('initiate_login').click();
|
||
await page.getByTestId('password').fill(user.password);
|
||
await page.getByRole('button', { name: 'Sign in with Password' }).click();
|
||
// Post-login lands somewhere different depending on whether the org is
|
||
// licensed (onboarding flow on ENTERPRISE) or not (legacy "Hello there"
|
||
// welcome). Wait for URL to move off /login — whichever page follows
|
||
// is fine, each spec navigates to the feature under test anyway.
|
||
await page.waitForURL((url) => !url.pathname.startsWith('/login'));
|
||
}
|
||
|
||
export const test = base.extend<{
|
||
/**
|
||
* User identity for this test. Override with `test.use({ user: ... })` at
|
||
* the describe or test level to run the suite as a different user.
|
||
* Defaults to ADMIN (the pytest-bootstrap-seeded admin).
|
||
*/
|
||
user: User;
|
||
|
||
/**
|
||
* A Page whose context is already authenticated as `user`. First request
|
||
* for a given user triggers one login per worker; the resulting
|
||
* storageState is held in memory and reused for all later requests.
|
||
*/
|
||
authedPage: Page;
|
||
}>({
|
||
user: [ADMIN, { option: true }],
|
||
|
||
authedPage: async ({ browser, user }, use) => {
|
||
const storageState = await storageFor(browser, user);
|
||
const ctx = await browser.newContext({ storageState });
|
||
const page = await ctx.newPage();
|
||
// Opt-in CPU throttling to reproduce GitHub-Linux-runner conditions on
|
||
// developer machines. Set `STRESS=1` (typically with `CI=1` to also get
|
||
// 2 workers + 2 retries) before running the suite — see CI-HARDENING.md.
|
||
// The rate is the CPU slowdown multiplier; 4× matches the 2 vCPU runner.
|
||
const throttleRate = Number(process.env.STRESS_CPU_RATE ?? '4');
|
||
if (process.env.STRESS === '1') {
|
||
const client = await ctx.newCDPSession(page);
|
||
await client.send('Emulation.setCPUThrottlingRate', {
|
||
rate: throttleRate,
|
||
});
|
||
}
|
||
await use(page);
|
||
await ctx.close();
|
||
},
|
||
});
|
||
|
||
export { expect };
|