Skip to content

Commit

Permalink
[SDK]Disable telemetry (#637)
Browse files Browse the repository at this point in the history
# Description

Please add an informative description that covers that changes made by
the pull request and link all relevant issues.

Disable telemetry until we figure out the CI stuck issue

# All Promptflow Contribution checklist:
- [ ] **The pull request does not introduce [breaking changes].**
- [ ] **CHANGELOG is updated for new features, bug fixes or other
significant changes.**
- [ ] **I have read the [contribution guidelines](../CONTRIBUTING.md).**
- [ ] **Create an issue and link to the pull request to get dedicated
review from promptflow team. Learn more: [suggested
workflow](../CONTRIBUTING.md#suggested-workflow).**

## General Guidelines and Best Practices
- [ ] Title of the pull request is clear and informative.
- [ ] There are a small number of commits, each of which have an
informative message. This means that previously merged commits do not
appear in the history of the PR. For more information on cleaning up the
commits in your PR, [see this
page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md).

### Testing Guidelines
- [ ] Pull request includes test coverage for the included changes.
  • Loading branch information
D-W- authored Sep 27, 2023
1 parent 36d6396 commit aa537f6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 29 deletions.
19 changes: 0 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,25 +139,6 @@ For more information see the
or contact [[email protected]](mailto:[email protected])
with any additional questions or comments.

## Data Collection

The software may collect information about you and your use of the software and
send it to Microsoft if configured to enable telemetry.
Microsoft may use this information to provide services and improve our products and services.
You may turn on the telemetry as described in the repository.
There are also some features in the software that may enable you and Microsoft
to collect data from users of your applications. If you use these features, you
must comply with applicable law, including providing appropriate notices to
users of your applications together with a copy of Microsoft's privacy
statement. Our privacy statement is located at
https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data
collection and use in the help documentation and our privacy statement. Your
use of the software operates as your consent to these practices.

### Telemetry Configuration

Telemetry collection is off by default. To opt in, please run `pf config set cli.telemetry_enabled=true` to turn it on.

## License

Copyright (c) Microsoft Corporation. All rights reserved.
Expand Down
2 changes: 1 addition & 1 deletion src/promptflow/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- **pf flow validate**: support validate flow
- **pf config set**: support set user-level promptflow config.
- Support workspace connection provider, usage: `pf config set connection.provider=azureml:/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.MachineLearningServices/workspaces/<workspace_name>`
- **Telemetry**: enable telemetry and won't collect by default, use `pf config set cli.telemetry_enabled=true` to opt in.
- Support override openai connection's model when submitting a flow. For example: `pf run create --flow ./ --data ./data.jsonl --connection llm.model=xxx`

### Bugs Fixed
- [Flow build] Fix flow build file name and environment variable name when connection name contains space.
Expand Down
18 changes: 9 additions & 9 deletions src/promptflow/promptflow/_telemetry/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import logging
import os

from promptflow._sdk._configuration import Configuration
from promptflow._telemetry.logging_handler import get_appinsights_log_handler

TELEMETRY_ENABLED = "TELEMETRY_ENABLED"
Expand All @@ -31,14 +29,16 @@ def is_telemetry_enabled():
2. running `pf config set cli.collect_telemetry=true` command.
If None of the above is set, telemetry is disabled by default.
"""
telemetry_enabled = os.getenv(TELEMETRY_ENABLED)
if telemetry_enabled is not None:
return str(telemetry_enabled).lower() == "true"
config = Configuration.get_instance()
telemetry_consent = config.get_telemetry_consent()
if telemetry_consent is not None:
return telemetry_consent
# TODO(2709576): enable when CI stuck issue is fixed
return False
# telemetry_enabled = os.getenv(TELEMETRY_ENABLED)
# if telemetry_enabled is not None:
# return str(telemetry_enabled).lower() == "true"
# config = Configuration.get_instance()
# telemetry_consent = config.get_telemetry_consent()
# if telemetry_consent is not None:
# return telemetry_consent
# return False


def get_telemetry_logger():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def cli_consent_config_overwrite(val):

@pytest.mark.e2etest
class TestTelemetry:
@pytest.mark.skip(reason="telemetry is disabled for now")
def test_logging_handler(self):
# override environment variable
with environment_variable_overwrite("TELEMETRY_ENABLED", "true"):
Expand Down

0 comments on commit aa537f6

Please sign in to comment.