Pushing metrics using HTTPs
Overview
The Metrics Ingestion System is designed to accept OpenTelemetry metrics over HTTP, providing a seamless integration for collecting and processing telemetry data. This system ensures that metrics from various applications and services are ingested, stored, and made available for analysis and monitoring purposes.
Getting Started
Prerequisites
- OpenTelemetry SDK: Ensure you have the OpenTelemetry SDK installed in your application.
- HTTP Client: Any standard HTTP client can be used to send metrics.
Endpoint Details
- URL Example (replace with the one you optained from Turo):
http://turo.quantumblack.com/model/123/metrics - Method:
POST - Content-Type:
application/json
Sample Payload
The following is a sample JSON payload that the Metrics Ingestion System expects:
The output is generated by the SDK internally and all the service, metric names and other fields are configured when instrumenting any application. Check instrumentation guide for more info on how to configure the fields to custom values.
{
"resourceMetrics": [
{
"resource": {
"attributes": [
{
"key": "service.name",
"value": {
"stringValue": "test.service"
}
}
]
},
"scopeMetrics": [
{
"metrics": [
{
"unit": "1",
"description": "This is a demo metric",
"sum": {
"aggregationTemporality": 1,
"isMonotonic": true,
"dataPoints": [
{
"asDouble": 2,
"timeUnixNano": 1706745600000000000
}
]
},
"name": "test_metric_1"
},
{
"unit": "1",
"description": "This is a demo metric",
"sum": {
"aggregationTemporality": 1,
"isMonotonic": true,
"dataPoints": [
{
"asDouble": 326,
"timeUnixNano": 1706745600000000000
}
]
},
"name": "test_metric_2"
}
]
}
]
}
]
}
Sending Metrics
Use your preferred HTTP client to send a POST request with the metrics payload to the ingestion endpoint.
To ensure secure transmission, the Metrics Ingestion System supports token-based authentication. Include the token in the Authorization header.
Example:
curl -X POST http://turo.quantumblack.com/model/123/metrics \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your-token>" \
-d @metrics.json
Expected Output - {"partialSuccess":{}}
You can get the metrics endpoint and bearer token from the Turo app. For a step-by-step guide check the Model Registration guide
Troubleshooting
Common Issues
- 400 Bad Request: Check the payload format and required fields.
- 401 Unauthorized: Ensure the correct authentication token is provided.
- 500 Internal Server Error: Contact support with error logs.