spaulovich
(Steve Paulovich)
April 24, 2023, 6:10pm
1
Any hints to correctly using the --tags option with @elastic /synthetics?
Assuming a journey where I've added monitors.use({ tags: ["foo", "bar"] })
If I run npx @elastic/synthetics . --tags "foo"
I get No tests found!
I've tried permutations with --tags like --tags "[foo]"
and --tags "['foo']"
and --tags foo
but get the same No tests found! result.
What's the correct syntax for using the --tags option?
spaulovich
(Steve Paulovich)
May 3, 2023, 2:49pm
2
Bumping this. Still haven't gotten the --tags to work as expected, or haven't clearly understood how it's supposed to work. Can anyone provide insight?
system
(system)
Closed
May 24, 2023, 10:50am
3
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
Apologies for delay, we have an issue open to address this
opened 06:20PM - 12 Jun 23 UTC
There has been some confusion over the current implementation of tags because it… differs from what is expected (for example as raised in https://github.com/elastic/synthetics/issues/775).
Synthetics needs to be updated to consolidate how `tags` (and `match` in the CLI) work, as follows:
- Remove `--tags` and `--match` from `push`
- If either `--tags` or `--match` is used with `push`, fail the `push` with an error and print a message
| push cannot be used with either '--tags' or '--match', see [link to forum post] for more on why we removed this broken behavior.
- Add a deprecation notice to the release note including this change
- Update the `push --help` text that currently suggests it will filter on `push`
- Note that `--tags` and `--match` are still valid options for _running_ monitors (but not with `push`)
- Update the [docs page](https://www.elastic.co/guide/en/observability/current/synthetics-command-reference.html) that `--tags` and `--match` are only relevant when running monitor (not pushing them)
- Tags defined for an **individual monitor**
- Tags can continue to be defined for an individual monitor via:
- `monitor.use.tags` of `journey({name:'My Monitor', tags:['foo']}, …`
- Note that the `journey()` version is not documented or intended for general use (will maybe documented in the future if there's a need)
- Add `monitor.use.tags` support to the `synthetics.config.ts`
- Precedence order is that this global setting is overridden by any monitor specific setting for `tags`
- Either `monitor.use.tags` or `journey…` type of definition
- i.e. the behaviour is consistent with `locations`
- Tags defined against a monitor in any way are then reflected in the Synthetics UI monitor tags
- Add a sticky forum post for a month or so describing the change