Skip to content

Commit

Permalink
Merge branch 'main' into users/ninhu/perf_improve
Browse files Browse the repository at this point in the history
  • Loading branch information
ninghu committed Jun 13, 2024
2 parents 47847aa + 745704a commit 98e3ab1
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/promptflow-azure/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "promptflow-azure"
version = "1.12.0.dev0"
version = "1.13.0.dev0"
description = "Prompt flow azure"
include = [
"promptflow/azure/resources/*"
Expand Down
2 changes: 1 addition & 1 deletion src/promptflow-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# promptflow-core package
## v1.12.0 (Upcoming)
## v1.12.0 (2024.06.11)

### Bugs fixed
- Fix ChatUI can't work in docker container when running image build with `pf flow build`.
Expand Down
2 changes: 1 addition & 1 deletion src/promptflow-core/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "promptflow-core"
version = "1.12.0.dev0"
version = "1.13.0.dev0"
description = "Prompt flow core"
include = [
"promptflow/core/_serving/static/*",
Expand Down
7 changes: 6 additions & 1 deletion src/promptflow-devkit/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# promptflow-devkit package

## v1.12.0 (Upcoming)
## v1.13.0 (Upcoming)

### Bugs Fixed
- Fix incompatibility with `trace.NoOpTracerProvider` when set exporter to prompt flow service.

## v1.12.0 (2024.06.11)

### Improvements
- Add retry logic when uploading run details to cloud.
Expand Down
4 changes: 4 additions & 0 deletions src/promptflow-devkit/promptflow/_sdk/_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,10 @@ def setup_exporter_to_pfs() -> None:
tracer_provider: TracerProvider = trace.get_tracer_provider()
if is_exporter_setup_skipped():
_logger.debug("exporter setup is skipped according to environment variable.")
elif isinstance(tracer_provider, trace.NoOpTracerProvider):
_logger.warning(
"tracer provider is set to NoOpTracerProvider, skip setting exporter to prompt flow service."
)
else:
if not getattr(tracer_provider, TRACER_PROVIDER_PFS_EXPORTER_SET_ATTR, False):
_logger.info("have not set exporter to prompt flow service, will set it...")
Expand Down
2 changes: 1 addition & 1 deletion src/promptflow-devkit/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "promptflow-devkit"
version = "1.12.0.dev0"
version = "1.13.0.dev0"
description = "Prompt flow devkit"
include = [
"promptflow/_sdk/_service/static/*",
Expand Down
16 changes: 15 additions & 1 deletion src/promptflow-devkit/tests/sdk_cli_test/unittests/test_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
TRACE_LIST_DEFAULT_LIMIT,
ContextAttributeKey,
)
from promptflow._sdk._tracing import start_trace_with_devkit
from promptflow._sdk._tracing import setup_exporter_to_pfs, start_trace_with_devkit
from promptflow._sdk._utilities.tracing_utils import WorkspaceKindLocalCache, append_conditions, parse_protobuf_span
from promptflow.client import PFClient
from promptflow.exceptions import UserErrorException
Expand Down Expand Up @@ -196,6 +196,20 @@ def test_pfs_invocation_failed_in_start_trace(self):
start_trace_with_devkit(collection=str(uuid.uuid4()))
assert monitor_func.call_count == 0

@pytest.mark.usefixtures("reset_tracer_provider")
def test_no_op_tracer_provider(self, monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture):
# logger with "promptflow." prefix cannot be captured by caplog, so patch the logger for this test
with patch("promptflow._sdk._tracing._logger", logging.getLogger(__name__)):
with caplog.at_level(level=logging.WARNING):
monkeypatch.setenv(OTEL_EXPORTER_OTLP_ENDPOINT, "http://dummy-endpoint")
trace.set_tracer_provider(trace.NoOpTracerProvider())
setup_exporter_to_pfs()
monkeypatch.delenv(OTEL_EXPORTER_OTLP_ENDPOINT)
assert (
"tracer provider is set to NoOpTracerProvider, skip setting exporter to prompt flow service."
in caplog.text
)


@pytest.mark.unittest
@pytest.mark.sdk_test
Expand Down
2 changes: 1 addition & 1 deletion src/promptflow-tracing/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
# poetry
[tool.poetry]
name = "promptflow-tracing"
version = "1.12.0.dev0"
version = "1.13.0.dev0"
description = "Prompt flow tracing"
license = "MIT"
authors = [
Expand Down
8 changes: 7 additions & 1 deletion src/promptflow/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release History
## v1.12.0 (Upcoming)

## v1.13.0 (Upcoming)

### Bugs Fixed
- Fix incompatibility with `trace.NoOpTracerProvider` when set exporter to prompt flow service.

## v1.12.0 (2024.06.11)

### Bugs fixed
- [promptflow-core] Fix ChatUI can't work in docker container when running image build with `pf flow build`.
Expand Down
2 changes: 1 addition & 1 deletion src/promptflow/promptflow/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------

VERSION = "1.12.0.dev0"
VERSION = "1.13.0.dev0"

0 comments on commit 98e3ab1

Please sign in to comment.