There are two ways to add a service to Spike: using the "auto-discover" feature, or creating them manually.
In normal operation, if an incoming request doesn't match any known service address, then that request is simply forwarded transparently to the destination URL. No statistics are collected in this case.
Spike can also run in auto-discover mode. Then, a new service is automatically created for any unrecognized request. Heuristics are applied to try to minimize the number of services created, given similar URLs.
To enable auto-discover, click the Settings icon () at the top-right of the Spike UI, and set auto-discover to On.
You can also run Spike with the
-auto-discover command-line flag.
When Spike starts for the first time, or if there are no services defined, it will be in auto-discover mode automatically.
When running in auto-discover mode, Spike will create placeholder services for any new API calls it receives. When you reload the Spike UI, you will see a message at the top of the window, telling you that it found new services, and how many. Click on this message to review the newly-discovered services. From there, you can manually approve or hide any new service. Note that if you quit Spike before approving services, they will not appear when you start Spike again.
It is recommended that auto-discover be enabled during initial setup, but disabled in regular use.
Creating services manually
Services can also be created manually inside the Spike UI. On the home page, click the edit button:
This will reveal an "Add new service" link. That page will prompt you to fill out four fields, for the new service:
Service Name - the name for your new service.
Service Address - the remote URL of your application's requests. This can be the base URL of a remote service (e.g.,
http://customerinfo.dc1.mycompany.com/api/v1, or the base URL of a local service (e.g.,
http://localhost:9999/api/v1), or just an integer port number (e.g.,
9875). When the service address is just an integer, then Spike will (upon restart) open a port at startup, and any HTTP requests at that port will be mapped to the destination endpoint. Note that if a port number is given for service address, then endpoint URL below should not be blank.
Endpoint Name - some descriptive name for the destination endpoint. This is useful if your service can map to multiple endpoints (e.g., a different endpoint for each environment).
Endpoint URL - the base URL that incoming requests should be remapped to. If the service is meant to transparently pass requests to the remote service, then leave this blank.