Track usage of your API and troubleshoot issues faster.
With ReadMe's Metrics API your team can get deep insights into your API's usage. If you're a developer, it takes a few small steps to send your API logs to ReadMe. Here's an overview of how the integration works:
- Install this plugin into your Kong Gateway by copying the
kong
directory into your Kong environment or use the provided Dockerfile. see this for details. - The plugin runs during the log phase of the Kong pipeline and sends ReadMe the details of your API's incoming requests and outgoing responses, with the option for you to redact any private headers using the configuration options.
- ReadMe uses these request and response details to create an API Metrics Dashboard which can be used to analyze specific API calls or monitor aggregate usage data.
# Build kong image with the plugin
docker build -t kong-readme-plugin:latest .
# Run kong with the plugin
curl -Ls https://get.konghq.com/quickstart | bash -s -- -r "" -i kong-readme-plugin -t latest
# Enable the plugin
curl -isX POST http://localhost:8001/plugins -d name=readme-plugin -d 'config.api_key=<Your API Key>'
Requires pongo to test and develop.
pongo up
pongo shell
kms
# Check if the plugin is available
curl -s localhost:8001 | jq '.plugins.available_on_server."readme-plugin"'
curl -sX POST http://localhost:8001/plugins -d name=readme-plugin -d 'config.api_key=<Your API Key>' | jq
# Add a new service
curl -isX POST http://localhost:8001/services -d name=example_service -d url='http://httpbin.org'
# Associate the custom plugin with the `example_service` service
curl -isX POST http://localhost:8001/services/example_service/plugins -d 'name=readme-plugin' -d "config.queue.max_retry_time=1"
# Add a new route for sending requests through the `example_service` service
curl -iX POST http://localhost:8001/services/example_service/routes -d 'paths[]=/mock' -d name=example_route
# Test
curl -i http://localhost:8000/mock/anything
# Get plugin config
curl -s http://localhost:8001/plugins | jq '.data | map(select(.name == "readme-plugin")) | first'
# Retrieve the plugin ID
export PLUGIN_ID=$(curl -s http://localhost:8001/plugins | jq '.data | map(select(.name == "readme-plugin")) | first | .id' | tr -d '"')
# Configure the plugin with your API key
curl -sX PATCH http://localhost:8001/plugins/$PLUGIN_ID -d "config.api_key=<Your API Key>" | jq '.config.api_key'
# Configure `hide_headers`
curl -sX PATCH -H'Content-Type: application/json' http://localhost:8001/plugins/$PLUGIN_ID -d '{"config": {"hide_headers": {"foo": "", "bar": "default"}}}' | jq '.config.hide_headers'
# Configure `id_header`
curl -sX PATCH -H'Content-Type: application/json' http://localhost:8001/plugins/$PLUGIN_ID -d '{"config": {"id_header": "email"}}' | jq '.config.id_header'
# Configure `group_by`
curl -sX PATCH -H'Content-Type: application/json' http://localhost:8001/plugins/$PLUGIN_ID -d '{"config": {"group_by": {"x-user-email": "email", "x-org-name": "label"}}}' | jq '.config.group_by'
# Delete the plugin
curl -sX DELETE http://localhost:8001/plugins/$PLUGIN_ID
🚧 Any Issues?
Integrations can be tricky! Contact support if you have any questions/issues.