Skip to content

Commit

Permalink
fix: raise warning on import of google.monitoring.dashboard (#128)
Browse files Browse the repository at this point in the history
* fix: raise warning on import of google.monitoring.dashboard

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* remove hardcoded date

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
parthea and gcf-owl-bot[bot] authored Jan 24, 2022
1 parent 570c6c7 commit 95eea58
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# limitations under the License.
#

import warnings

from google.monitoring.dashboard_v1.services.dashboards_service.async_client import (
DashboardsServiceAsyncClient,
)
Expand Down Expand Up @@ -82,3 +84,15 @@
"Widget",
"XyChart",
)

import_warning_message = (
"The client in the `google.monitoring.dashboard` namespace is no longer updated. "
"Please use the client in namespace `google.cloud.monitoring_dashboard` instead. "
"In a future release, importing code from the `google.monitoring.dashboard` namespace "
"may result in a RuntimeError. If you need to continue to use `google.monitoring.dashboard` "
"after this date, please pin to a specific version of 'google-cloud-monitoring-dashboards'. "
"If you have questions, please file an issue: "
"https://github.com/googleapis/python-monitoring-dashboards/issues."
)

warnings.warn(import_warning_message, ImportWarning)
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# limitations under the License.
#

import warnings

from .services.dashboards_service import DashboardsServiceClient
from .types.common import Aggregation
from .types.common import PickTimeSeriesFilter
Expand Down Expand Up @@ -67,3 +69,15 @@
"XyChart",
"DashboardsServiceClient",
)

import_warning_message = (
"The client in the `google.monitoring.dashboard` namespace is no longer updated. "
"Please use the client in namespace `google.cloud.monitoring_dashboard` instead. "
"In a future release, importing code from the `google.monitoring.dashboard` namespace "
"may result in a RuntimeError. If you need to continue to use `google.monitoring.dashboard` "
"after this date, please pin to a specific version of 'google-cloud-monitoring-dashboards'. "
"If you have questions, please file an issue: "
"https://github.com/googleapis/python-monitoring-dashboards/issues."
)

warnings.warn(import_warning_message, ImportWarning)

0 comments on commit 95eea58

Please sign in to comment.