如何将标签添加到 Jaeger span 的进程中

How to add tags into process for Jaeger span

我正在使用 Python3.8 和 opentelemetry 库,我能够创建一些基本跨度。我需要为后端处理器添加标签来挑选它们。对于 E.G 类似“主机名”的东西。

为此,我需要以某种方式向流程添加标签。我不知道该怎么做。

我的轨迹是这样的

    "process": {
        "serviceName": "xxxxx"
    },
    "spans": [
        {```
I need something like
```{
    "process": {
        "serviceName": "xxxxx",
        "tags": [
            {
                "key": "jaeger.version",
                "vType": "STRING",
                "vStr": "Go-2.29.1"
            },
            {
                "key": "hostname",
                "vType": "STRING",
                "vStr": "xxxxxx"            

这就是我初始化跟踪器和导出器的方式

                TracerProvider(
                    resource=Resource.create({SERVICE_NAME: "xxxx","service.instance.id":"1","host.name":"xxxx"})
                    )
                )
        trace.set_attribute("hostname","018.zeus.run")

        tracer = trace.get_tracer(__name__)

        jaeger_exporter = JaegerExporter(
        agent_host_name='xxxxx',
        agent_port=6831,
        collector_endpoint='http://xxxxx:14268/api/traces?format=jaeger.thrift'
        )

有人可以告诉我如何向流程添加标签吗?

我认为这是您使用的导出程序库的错误。理想情况下,thrift-exporter 应该将资源属性转换为进程标签,如 spec. Here is the source where Process is instantiated with serviceName and it doesn't map the remaining resource attributes as tags, but jaeger-proto-grpc exporter correctly maps them. Please create an issue here https://github.com/open-telemetry/opentelemetry-python.

中所述