Datadog Metric可以四舍五入到2个小数点
我正在使用Python软件包datadog_api_client
将数据发布到DataDog的指标。该代码看起来像:
now = datetime.datetime.now().timestamp()
metric_name = 'test.metric.count'
with ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = metrics_api.MetricsApi(api_client)
body = MetricsPayload(
series=[
Series(
host="test_tool",
interval=20,
metric=metric_name,
points=[
Point([now, float(1127023]),
],
tags=metric_tags,
type="count",
),
],
) # MetricsPayload
try:
# Submit metrics
api_response = api_instance.submit_metrics(body)
print(f"Metric: {metric_name} : {api_response}")
except ApiException as e:
raise Exception(f"Exception when calling MetricsApi->submit_metrics: {e}")
当我运行此代码时,DataDog将公制值发布为1.13m,这不是完全准确的。我检查了很多文档,但找不到我缺少的任何属性,这些属性可以添加以删除精度。
有人可以帮我获取数字吗?
I am using a python package datadog_api_client
to publish data to a metric to Datadog. The code looks like:
now = datetime.datetime.now().timestamp()
metric_name = 'test.metric.count'
with ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = metrics_api.MetricsApi(api_client)
body = MetricsPayload(
series=[
Series(
host="test_tool",
interval=20,
metric=metric_name,
points=[
Point([now, float(1127023]),
],
tags=metric_tags,
type="count",
),
],
) # MetricsPayload
try:
# Submit metrics
api_response = api_instance.submit_metrics(body)
print(f"Metric: {metric_name} : {api_response}")
except ApiException as e:
raise Exception(f"Exception when calling MetricsApi->submit_metrics: {e}")
When I run this piece of code Datadog publishes the metric value as 1.13M which is not completely accurate. I checked a lot of documentation but cannot find any attribute that I am missing which can be added to remove the precision.
Can anyone please help me in getting the numbers?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论