Observability is a good way to understand how your production application behaves under different traffic conditions. This guide explains what is available in Front-Commerce to expose this information to external tools.
Expose metrics for prometheus
Front-Commerce provides a /__front-commerce/metrics
endpoint with data about
the node process and response times.
Configure it
To enable this endpoint, you need to define the environment variable
FRONT_COMMERCE_CLOUD_METRICS_KEY
with a basic authentication token (base64
encoded, e.g. dXNlcjpwYXNzd29yZA==
for user:password
)
Access it
Call https://<your_website>/__front-commerce/metrics
with the defined header
Authorization: Basic <FRONT_COMMERCE_CLOUD_METRICS_KEY>
Standard metrics
Front-Commerce is exposing some standard metrics about the node process like memory / CPU usage, please check OpenTelemetry Node.js SDK documentation for more information.
Other metrics
Measure external services call times
Once the /__front-commerce/metrics
endpoint is enabled, you can count the time
spent calling external services.
Example with a magento backend service:
# TYPE outbound_requests_duration histogram
outbound_requests_duration_bucket{le="0.1",target="magento.location.net"} 0
outbound_requests_duration_bucket{le="0.25",target="magento.location.net"} 51
outbound_requests_duration_bucket{le="0.5",target="magento.location.net"} 58
outbound_requests_duration_bucket{le="1",target="magento.location.net"} 59
outbound_requests_duration_bucket{le="2",target="magento.location.net"} 74
outbound_requests_duration_bucket{le="+Inf",target="magento.location.net"} 75
outbound_requests_duration_sum{target="magento.location.net"} 31.227999999999998
outbound_requests_duration_count{target="magento.location.net"} 75