无支撑的仪器/聚合器组合,类型valueRecorder和minmaxsumcountaggregator,忽略它

发布于 2025-01-22 22:00:13 字数 1596 浏览 0 评论 0 原文

尝试调整以下示例:使用值recorder。

        metrics.set_meter_provider(MeterProvider())
        meter = metrics.get_meter(__name__)
        metrics.get_meter_provider().start_pipeline(
            meter, CloudMonitoringMetricsExporter(), 5
        )

        ratio_metric = meter.create_valuerecorder(
            name="ratio_values",
            description="Ratio for a given tool",
            unit="ratio",
            value_type=float,
        )

        ratio_values_a = {"symbol": "testA"}
        ratio_values_b = {"symbol": "testB"}
        ratio = 1.000

        for i in range(20):
            if i > 10:
                ratio_metric.record(0.999, ratio_values_a)
                ratio_metric.record(ratio, ratio_values_b)
                ratio -= 0.1
            else:
                ratio_metric.record(0.999, ratio_values_a)
                ratio_metric.record(ratio, ratio_values_b)
                ratio += 0.2
            time.sleep(10)

给出以下错误:

Unsupported instrument/aggregator combo, types ValueRecorder and MinMaxSumCountAggregator, ignoring it
Unsupported instrument/aggregator combo, types ValueRecorder and MinMaxSumCountAggregator, ignoring it

运行以下版本:

opentelemetry-api==1.10a0
opentelemetry-exporter-gcp-monitoring==1.2.0a0
opentelemetry-sdk==1.10a0

Trying to adjust the following example: https://google-cloud-opentelemetry.readthedocs.io/en/latest/examples/cloud_monitoring/README.html to use a value recorder instead.

        metrics.set_meter_provider(MeterProvider())
        meter = metrics.get_meter(__name__)
        metrics.get_meter_provider().start_pipeline(
            meter, CloudMonitoringMetricsExporter(), 5
        )

        ratio_metric = meter.create_valuerecorder(
            name="ratio_values",
            description="Ratio for a given tool",
            unit="ratio",
            value_type=float,
        )

        ratio_values_a = {"symbol": "testA"}
        ratio_values_b = {"symbol": "testB"}
        ratio = 1.000

        for i in range(20):
            if i > 10:
                ratio_metric.record(0.999, ratio_values_a)
                ratio_metric.record(ratio, ratio_values_b)
                ratio -= 0.1
            else:
                ratio_metric.record(0.999, ratio_values_a)
                ratio_metric.record(ratio, ratio_values_b)
                ratio += 0.2
            time.sleep(10)

Gives the following error:

Unsupported instrument/aggregator combo, types ValueRecorder and MinMaxSumCountAggregator, ignoring it
Unsupported instrument/aggregator combo, types ValueRecorder and MinMaxSumCountAggregator, ignoring it

With the following versions running:

opentelemetry-api==1.10a0
opentelemetry-exporter-gcp-monitoring==1.2.0a0
opentelemetry-sdk==1.10a0

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

帅冕 2025-01-29 22:00:13

这是一个非常旧的包裹的问题,不会解决。当这些软件包是根据规范编写的许多概念不再存在。正在进行中的新SDK实施,可以为实验使用,您可能需要检查 https://github.com/open-telemetry/opentelemetry-python/tree/main/main/main/docs/examples/metrics/metrics

This was an issue with very old packages and will not addressed. A lot of concepts when these packages were written based on specification no longer exists. There is a work in progress new SDK implementation which is ready for experimental use you may want to check https://github.com/open-telemetry/opentelemetry-python/tree/main/docs/examples/metrics

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文