Skip to content

When using a Rest server, an error log occurs when opentelemetry is not set. #78

Open
@stat-kwon

Description

@stat-kwon

Description

Opentelemetry was already applied to the backend framework python-core and was collecting spans.

The service-portal where the problem occurred is running based on FastAPI, and the trace infrastructure is not built in the current product environment, so all OpenTelemetry settings are set to disabled.

In this case, Error log should not occur, but as shown in the code below, Error log is occurring even though Otel is not used.

2023-07-30T11:58:58.834Z [DEBUG] {trace_id} domain-xxxxxxxxxx api.service-portal Demo.create (stibee_connector.py:50) [add_email] https://api.stibee.com/v1/lists/187034/subscribers => {'eventOccuredBy': 'SUBSCRIBER', 'groupIds': ['123456'], 'subscribers': [{'email': 'test@gmail.com'}]}
INFO:     10.0.40.169:0 - "POST /demo/create HTTP/1.0" 200 OK
Exception while exporting Span batch.
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/opentelemetry/sdk/trace/export/__init__.py", line 368, in _export_batch
    self.span_exporter.export(self.spans_list[:idx])  # type: ignore
  File "/usr/local/lib/python3.8/site-packages/opentelemetry/sdk/trace/export/__init__.py", line 522, in export
    self.out.write(self.formatter(span))
AttributeError: 'NoneType' object has no attribute 'write'

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions