[Synthetics] do not show api key error unless there are monitors (#147783)

## Summary

Resolves https://github.com/elastic/kibana/issues/147586

Do not show errors related to missing synthetics api key unless there
are synthetics monitors present.

### Testing
1. Create a brand new cluster via `oblt-cli`
2. Add that cluster details to your `kibana.dev.yml` file
3. Monitor your Kibana logs. Ensure there is not an error log
complaining about the api key. For example:
```
[2022-12-14T20:19:43.516-05:00][ERROR][plugins.synthetics] API key is not valid. Cannot push monitor configuration to synthetics public testing locations
```
This commit is contained in:
Dominique Clarke 2022-12-19 13:27:11 -05:00 committed by GitHub
parent 42006836a1
commit 486b2e0068
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -294,7 +294,6 @@ export class SyntheticsService {
async pushConfigs() {
const service = this;
const subject = new Subject<SyntheticsMonitorWithId[]>();
const output = await this.getOutput();
subject.subscribe(async (monitorConfigs) => {
try {
@ -305,6 +304,8 @@ export class SyntheticsService {
return null;
}
const output = await this.getOutput();
if (!output) {
sendErrorTelemetryEvents(service.logger, service.server.telemetry, {
reason: 'API key is not valid.',