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: Add support for running scripted probes #120

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

Conversation

notheotherben
Copy link
Member

@notheotherben notheotherben commented Apr 23, 2023

This PR adds support for writing !Script probes which run a predefined JavaScript probe, allowing substantially more complex probe execution models to be implemented (including interactive request/response flows, multi-stage operations, or the use of dynamic authentication in a managed service identity environment).

This functionality is built on top of Deno and can be used with a probe definition like the following:

probes:
  - name: bender.production.script
    policy:
      interval: 60000
      timeout: 5000
      retries: 2
    target: !Script
      args:
        - https://bender.sierrasoftworks.com
      code: |
        const resp = await fetch(`${Deno.args[0]}/api/v1/quote/bender`, {
          headers: {
            "Accept": "application/json",
            ...getTraceHeaders()
          }
        })

        setOutput("http.status", resp.status)

        if (resp.ok) {
          const quote = await resp.json()
          setOutput("quote.who", quote.who)
        }

    validators:
      http.status: !Equals 200
      quote.who: !Equals "Bender"

@github-actions github-actions bot added feature New feature or request docs labels Apr 23, 2023
@notheotherben notheotherben self-assigned this Apr 23, 2023
@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://red-coast-03f9f2c03-120.westeurope.1.azurestaticapps.net

2 similar comments
@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://red-coast-03f9f2c03-120.westeurope.1.azurestaticapps.net

@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://red-coast-03f9f2c03-120.westeurope.1.azurestaticapps.net

@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://red-coast-03f9f2c03-120.westeurope.1.azurestaticapps.net

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

Successfully merging this pull request may close these issues.

None yet

1 participant