Skip to content

Commit

Permalink
Force flush and close span_processor
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanFauble committed Nov 6, 2023
1 parent d1e6f83 commit f4bd8ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,9 @@ jobs:
pytest -sv tests/integration/synapseclient/test_command_line_client.py
fi
- uses: actions/upload-artifact@v3
if: ${{ contains(fromJSON('["3.9"]'), matrix.python) }}
with:
name: opentelemetry_traces
name: opentelemetry_traces_${{ matrix.os }}
path: tests/integration/otel

# on a GitHub release, build the pip package and upload it as a GitHub release asset
Expand Down
7 changes: 4 additions & 3 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,15 @@ def setup_otel():
path = f"tests/integration/otel/{file_name}"
utils.touch(path)
export_file = open(path, "w", encoding="utf-8")
trace.get_tracer_provider().add_span_processor(
BatchSpanProcessor(ConsoleSpanExporter(out=export_file))
)
span_processor = BatchSpanProcessor(ConsoleSpanExporter(out=export_file))
trace.get_tracer_provider().add_span_processor(span_processor)
else:
trace.set_tracer_provider(TracerProvider(sampler=ALWAYS_OFF))

yield

# Teardown
if export_file:
span_processor.force_flush()
span_processor.shutdown()
export_file.close()

0 comments on commit f4bd8ac

Please sign in to comment.