8000 Warning on OpenTelemetry when some attributes are not set · Issue #1385 · googleapis/python-bigquery · GitHub
[go: up one dir, main page]

Skip to content

Warning on OpenTelemetry when some attributes are not set #1385

@jeremietharaud

Description

@jeremietharaud

Environment details

  • OS type and version: Windows 10 21H2
  • Python version: 3.9.4
  • pip version: 22.2.2
  • google-cloud-bigquery version: 3.3.5

Steps to reproduce

  1. Set up a query job with opentelemetry enabled
  2. See warning in the console: Invalid type NoneType for attribute value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types

Code example

import logging
from google.cloud import bigquery
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import (
    SimpleSpanProcessor,
    ConsoleSpanExporter,
)

provider = TracerProvider()
simple_processor = SimpleSpanProcessor(ConsoleSpanExporter())
provider.add_span_processor(simple_processor)
trace.set_tracer_provider(provider)

logging.basicConfig(level=10)

# Construct a BigQuery client object.
client = bigquery.Client()

query = "SELECT 1;"

query_job = client.query(query)

Stack trace

DEBUG:google.auth._default:Checking None for explicit credentials as part of auth process...
DEBUG:google.auth._default:Checking Cloud SDK credentials as part of auth process...
DEBUG:google.auth._default:Checking None for explicit credentials as part of auth process...
DEBUG:google.auth._default:Checking Cloud SDK credentials as part of auth process...
WARNING:opentelemetry.attributes:Invalid type NoneType for attribute value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
WARNING:opentelemetry.attributes:Invalid type NoneType for attribute value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
DEBUG:urllib3.util.retry:Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=None, status=None)
DEBUG:google.auth.transport.requests:Making request: POST https://oauth2.googleapis.com/token
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): oauth2.googleapis.com:443
DEBUG:urllib3.connectionpool:https://oauth2.googleapis.com:443 "POST /token HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): bigquery.googleapis.com:443
DEBUG:urllib3.connectionpool:https://bigquery.googleapis.com:443 "POST /bigquery/v2/projects/my-project/jobs?prettyPrint=false HTTP/1.1" 200 None
{
    "name": "BigQuery.job.begin",
    "context": {
        "trace_id": "0x192a0e4ec554c63f68525922208fed88",
        "span_id": "0xfa29f0363122c4c4",
        "trace_state": "[]"
    },
    "kind": "SpanKind.INTERNAL",
    "parent_id": null,
    "start_time": "2022-10-12T09:41:57.259114Z",
    "end_time": "2022-10-12T09:41:57.934410Z",
    "status": {
        "status_code": "UNSET"
    },
    "attributes": {
        "db.system": "BigQuery",
        "db.name": "my-project",
        "job_id": "fc1581e3-708b-4b51-9a05-e3ad52c68dec",
        "hasErrors": false,
        "num_child_jobs": 0,
        "path": "/projects/my-project/jobs"
    },
    "events": [],
    "links": [],
    "resource": {
        "attributes": {
            "telemetry.sdk.language": "python",
            "telemetry.sdk.name": "opentelemetry",
            "telemetry.sdk.version": "1.13.0",
            "service.name": "unknown_service"
        },
        "schema_url": ""
    }
}

Analysis

Warnings appear when location and job state attributes are not set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: bigqueryIssues related to the googleapis/python-bigquery API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0