You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "dpgaspar (via GitHub)" <gi...@apache.org> on 2023/01/27 14:06:19 UTC

[GitHub] [superset] dpgaspar opened a new pull request, #22887: chore: add statsd support to base API and refactor

dpgaspar opened a new pull request, #22887:
URL: https://github.com/apache/superset/pull/22887

   <!---
   Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] dpgaspar commented on a diff in pull request #22887: chore: add statsd support to base API and refactor

Posted by "dpgaspar (via GitHub)" <gi...@apache.org>.
dpgaspar commented on code in PR #22887:
URL: https://github.com/apache/superset/pull/22887#discussion_r1089103716


##########
superset/views/base_api.py:
##########
@@ -107,13 +106,14 @@ def statsd_metrics(f: Callable[..., Any]) -> Callable[..., Any]:
     """
 
     def wraps(self: "BaseSupersetModelRestApi", *args: Any, **kwargs: Any) -> Response:

Review Comment:
   good point, changed it to `BaseSupersetApiMixin`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] dpgaspar merged pull request #22887: chore: add statsd support to base API and refactor

Posted by "dpgaspar (via GitHub)" <gi...@apache.org>.
dpgaspar merged PR #22887:
URL: https://github.com/apache/superset/pull/22887


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] jfrag1 commented on a diff in pull request #22887: chore: add statsd support to base API and refactor

Posted by "jfrag1 (via GitHub)" <gi...@apache.org>.
jfrag1 commented on code in PR #22887:
URL: https://github.com/apache/superset/pull/22887#discussion_r1089074009


##########
superset/views/base_api.py:
##########
@@ -107,13 +106,14 @@ def statsd_metrics(f: Callable[..., Any]) -> Callable[..., Any]:
     """
 
     def wraps(self: "BaseSupersetModelRestApi", *args: Any, **kwargs: Any) -> Response:

Review Comment:
   This type can now be `BaseSupersetApi` as well (or anything that inherits from `BaseSupersetApiMixin`, not sure the best way to type-hint this though



##########
superset/utils/log.py:
##########
@@ -194,7 +195,7 @@ def log_with_context(  # pylint: disable=too-many-locals
             slice_id = 0
 
         if log_to_statsd:
-            self.stats_logger.incr(action)
+            stats_logger_manager.instance.incr(action)

Review Comment:
   Should the `stats_logger` property on this class be removed as well?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] dpgaspar commented on a diff in pull request #22887: chore: add statsd support to base API and refactor

Posted by "dpgaspar (via GitHub)" <gi...@apache.org>.
dpgaspar commented on code in PR #22887:
URL: https://github.com/apache/superset/pull/22887#discussion_r1089110182


##########
superset/utils/log.py:
##########
@@ -194,7 +195,7 @@ def log_with_context(  # pylint: disable=too-many-locals
             slice_id = 0
 
         if log_to_statsd:
-            self.stats_logger.incr(action)
+            stats_logger_manager.instance.incr(action)

Review Comment:
   nice catch



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] codecov[bot] commented on pull request #22887: chore: add statsd support to base API and refactor

Posted by codecov.
codecov[bot] commented on PR #22887:
URL: https://github.com/apache/superset/pull/22887#issuecomment-1406566597

   # [Codecov](https://codecov.io/gh/apache/superset/pull/22887?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#22887](https://codecov.io/gh/apache/superset/pull/22887?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a1e6cbc) into [master](https://codecov.io/gh/apache/superset/commit/8226110be8bea6f1b06ce02def7ea56df44e6b50?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (8226110) will **decrease** coverage by `11.25%`.
   > The diff coverage is `100.00%`.
   
   > :exclamation: Current head a1e6cbc differs from pull request most recent head 5ba31e3. Consider uploading reports for the commit 5ba31e3 to get more accurate results
   
   ```diff
   @@             Coverage Diff             @@
   ##           master   #22887       +/-   ##
   ===========================================
   - Coverage   67.19%   55.94%   -11.25%     
   ===========================================
     Files        1870     1871        +1     
     Lines       71746    71770       +24     
     Branches     7869     7869               
   ===========================================
   - Hits        48209    40155     -8054     
   - Misses      21519    29597     +8078     
     Partials     2018     2018               
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `52.57% <98.76%> (+0.03%)` | :arrow_up: |
   | mysql | `?` | |
   | postgres | `?` | |
   | presto | `52.46% <98.76%> (+0.03%)` | :arrow_up: |
   | python | `58.31% <100.00%> (-23.50%)` | :arrow_down: |
   | sqlite | `?` | |
   | unit | `51.57% <100.00%> (+0.03%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/22887?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/advanced\_data\_type/api.py](https://codecov.io/gh/apache/superset/pull/22887?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvYWR2YW5jZWRfZGF0YV90eXBlL2FwaS5weQ==) | `77.50% <100.00%> (-22.50%)` | :arrow_down: |
   | [superset/async\_events/api.py](https://codecov.io/gh/apache/superset/pull/22887?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvYXN5bmNfZXZlbnRzL2FwaS5weQ==) | `72.00% <100.00%> (-28.00%)` | :arrow_down: |
   | [superset/available\_domains/api.py](https://codecov.io/gh/apache/superset/pull/22887?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvYXZhaWxhYmxlX2RvbWFpbnMvYXBpLnB5) | `92.00% <100.00%> (-8.00%)` | :arrow_down: |
   | [superset/dashboards/permalink/api.py](https://codecov.io/gh/apache/superset/pull/22887?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGFzaGJvYXJkcy9wZXJtYWxpbmsvYXBpLnB5) | `61.11% <100.00%> (-27.98%)` | :arrow_down: |
   | [superset/explore/api.py](https://codecov.io/gh/apache/superset/pull/22887?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZXhwbG9yZS9hcGkucHk=) | `71.11% <100.00%> (-15.26%)` | :arrow_down: |
   | [superset/explore/form\_data/api.py](https://codecov.io/gh/apache/superset/pull/22887?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZXhwbG9yZS9mb3JtX2RhdGEvYXBpLnB5) | `52.08% <100.00%> (-37.17%)` | :arrow_down: |
   | [superset/explore/permalink/api.py](https://codecov.io/gh/apache/superset/pull/22887?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZXhwbG9yZS9wZXJtYWxpbmsvYXBpLnB5) | `61.01% <100.00%> (-30.37%)` | :arrow_down: |
   | [superset/extensions/\_\_init\_\_.py](https://codecov.io/gh/apache/superset/pull/22887?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZXh0ZW5zaW9ucy9fX2luaXRfXy5weQ==) | `98.86% <100.00%> (+0.01%)` | :arrow_up: |
   | [superset/extensions/stats\_logger.py](https://codecov.io/gh/apache/superset/pull/22887?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZXh0ZW5zaW9ucy9zdGF0c19sb2dnZXIucHk=) | `100.00% <100.00%> (ø)` | |
   | [superset/importexport/api.py](https://codecov.io/gh/apache/superset/pull/22887?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvaW1wb3J0ZXhwb3J0L2FwaS5weQ==) | `100.00% <100.00%> (ø)` | |
   | ... and [305 more](https://codecov.io/gh/apache/superset/pull/22887?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] villebro commented on a diff in pull request #22887: chore: add statsd support to base API and refactor

Posted by "villebro (via GitHub)" <gi...@apache.org>.
villebro commented on code in PR #22887:
URL: https://github.com/apache/superset/pull/22887#discussion_r1089065093


##########
superset/extensions/stats_logger.py:
##########
@@ -0,0 +1,31 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from flask import Flask
+
+from superset.stats_logger import BaseStatsLogger
+
+
+class BaseStatsLoggerManager:
+    def __init__(self) -> None:
+        self._stats_logger = BaseStatsLogger()
+
+    def init_app(self, app: Flask) -> None:
+        self._stats_logger = app.config["STATS_LOGGER"]
+
+    @property
+    def instance(self) -> BaseStatsLogger:
+        return self._stats_logger

Review Comment:
   Oh this is nice! 👍 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org