Created
June 4, 2024 09:14
-
-
Save jesusvazquez/fc0573daa293da677f0efe5a92da9840 to your computer and use it in GitHub Desktop.
test write otlp metric with curl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
now=$(date +%s) | |
data=" | |
{ | |
\"resourceMetrics\": [ | |
{ | |
\"resource\": { | |
\"attributes\": [ | |
{ | |
\"key\": \"service.name\", | |
\"value\": { | |
\"stringValue\": \"service_foo\" | |
} | |
} | |
] | |
}, | |
\"scopeMetrics\": [ | |
{ | |
\"metrics\": [ | |
{ | |
\"name\": \"test_metric\", | |
\"unit\": \"s\", | |
\"description\": \"\", | |
\"gauge\": { | |
\"dataPoints\": [ | |
{ | |
\"asInt\": 1, | |
\"timeUnixNano\": ${now}000000000 | |
} | |
] | |
} | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
" | |
curl \ | |
-k \ | |
-i \ | |
-XPOST \ | |
-H 'Content-Type: application/json' \ | |
https://${HOST}/otlp/v1/metrics -d "${data}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment