Skip to content

fix: add types for namespace #1021

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

fix: add types for namespace #1021

wants to merge 4 commits into from

Conversation

shahzad31
Copy link
Contributor

@shahzad31 shahzad31 commented May 23, 2025

fixes #697
fixes #749

Since kibana already supports it we just need to add types, support via config and cli.

example

heartbeat.monitors:
  - type: http
    name: Todos Lightweight Test 0
    id: todos-lightweight-test-0
    enabled: true
    urls: 'https://elastic.github.io/synthetics-demo'
    schedule: '@every 60m'
    timeout: 18s
    namespace: food
  monitor.use({
    schedule: 10,
    namespace: 'testprojects',
  });

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds support for a namespace parameter across CLI, configuration types, and runtime logic.

  • Introduce --namespace CLI option in getCommonCommandOpts and register it in cli.ts
  • Extend MonitorConfig, runner logic, and shared types to include an optional namespace field
  • Add tests to verify namespace is correctly applied for pushed monitors and runner instances

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/options.ts Add --namespace option definition
src/dsl/monitor.ts Extend MonitorConfig type with namespace?
src/core/runner.ts Pass options.namespace into monitor config
src/common_types.ts Add namespace? to PushOptions
src/cli.ts Register the new namespace option in the CLI
tests/push/monitor.test.ts Test support for namespace in push monitors
tests/core/runner.test.ts Verify runner includes namespace in monitor config
Comments suppressed due to low confidence (1)

tests/push/monitor.test.ts:527

  • Add a test case to verify the default namespace when none is provided, ensuring it falls back to the project spaceId.
    it('supports namespace in config', async () => {

shahzad31 and others added 2 commits May 23, 2025 11:06
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@@ -263,6 +263,7 @@ export type PushOptions = Partial<ProjectSettings> &
retestOnFailure?: MonitorConfig['retestOnFailure'];
enabled?: boolean;
grepOpts?: GrepOptions;
namespace?: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have raised this before, this should belong inside data_stream #697 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's already at namespace in kibana, we can't change it, though we can additionally add support for it here?

@@ -236,6 +236,10 @@ export function getCommonCommandOpts() {
'--match <name>',
'run/push tests with a name or tags that matches a pattern'
);
const namespace = createOption(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am confused with this option now, Is it synthetics data stream namespace or something else?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well it's data stream namespace option

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Browser project monitors] No option for overwriting namespace [CLI] Provide ability to independently set data_stream.namespace from --space
2 participants