Skip to content
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

feat: support streaming mode for push command #576

Merged
merged 8 commits into from
Aug 17, 2022

Conversation

justinkambic
Copy link
Contributor

@justinkambic justinkambic commented Aug 9, 2022

Depends on #575.

This patch will make it possible for the Synthetics Agent to push monitors to Kibana via a streams endpoint.

Testing this PR

Configure Kibana

Firstly, build and run the Kibana streaming PR. It is ok if it runs against a fresh local Elasticsearch cluster.

Once Kibana is running, log in as a user who can write (I simply used the elastic user), and create an API key, which we will supply to Synthetics for pushing.

Lastly, go to the Uptime application and enable monitor management. You should be prompted to create an Agent policy. Do this, following default options. Once your agent policy is created, the baseline configuration for Kibana is ready.

Configure Synthetics Project

  1. Build synthetics: npm run build, npm link
  2. Create a directory (can be a subdir in synthetics) mkdir beep, node dist/cli init beep, follow the prompt
  3. Enter your new project: cd beep, npm link @elastic/synthetics
  4. Perform a push: env SYNTHETICS_API_KEY={API_KEY} npm run push

Expected output

(node:92955) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
> preparing all monitors
> creating all monitors
> {MONITOR_NAME}: monitor updated successfully

@justinkambic justinkambic added bug Something isn't working v8.4.0 labels Aug 9, 2022
@justinkambic justinkambic self-assigned this Aug 9, 2022
@apmmachine
Copy link

apmmachine commented Aug 9, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-08-17T15:35:53.423+0000

  • Duration: 15 min 46 sec

Test stats 🧪

Test Results
Failed 0
Passed 183
Skipped 2
Total 185

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

src/push/index.ts Outdated Show resolved Hide resolved
@vigneshshanmugam vigneshshanmugam changed the title Update push to work with streams feat: support streaming mode for push command Aug 11, 2022
src/helpers.ts Outdated Show resolved Hide resolved
src/push/index.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@dominiqueclarke dominiqueclarke left a comment

Choose a reason for hiding this comment

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

This looks great to me!

Tested in 8.4.0 Kibana with streams, as well as in 8.3.0 Kibana without streams.

Tested creation, updates, and deletion.

Tested individual monitor errors (via failedMonitors), and the formatting for that is also working well.

@vigneshshanmugam vigneshshanmugam merged commit ada926d into elastic:main Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v8.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants