Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/metabase/metabase. Pull mirroring updated .
  1. Oct 21, 2024
  2. Oct 18, 2024
  3. Oct 17, 2024
  4. Oct 16, 2024
    • dpsutton's avatar
      Let non-admins see tables in recents (#48769) · deac5cbc
      dpsutton authored
      * Let non-admins see tables in recents
      
      ```shell
      ❯ http get "localhost:3000/api/activity/recents?context=views" Cookie:"metabase.SESSION=ba..3d" -pb
      {
          "recents": [
              {
                  "can_write": false,
                  "database": {
                      "id": 6,
                      "initial_sync_status": "complete",
                      "name": "pg restaurants"
                  },
                  "description": null,
                  "display_name": "Restaurants",
                  "id": 112,
                  "model": "table",
                  "name": "restaurants",
                  "table_schema": "public",
                  "timestamp": "2024-10-15T22:11:39.412100Z"
              },
              {
                  "can_write": false,
                  "database": {
                      "id": 6,
                      "initial_sync_status": "complete",
                      "name": "pg restaurants"
                  },
                  "description": null,
                  "display_name": "Reviews",
                  "id": 110,
                  "model": "table",
                  "name": "reviews",
                  "table_schema": "public",
                  "timestamp": "2024-10-15T19:53:19.999445Z"
              }
          ]
      }
      ```
      
      We were getting permissions of a "fake" table. Instead, let the db
      select it and get the proper stuff. Worked for admins because
      mi/can-read? is presumably always true for tables, and worked in tests
      because we mocked mi/can-read?
      
      * bump ci
      Unverified
      deac5cbc
    • appleby's avatar
      Add a new prometheus metrics in m.qp.middleware.metrics/adjust (#48598) · 00100b1c
      appleby authored
      
      * Add new promethues counter for :metabase-metrics/adjust-errors
      
      To record errors in metabase.query-processor.middleware.metrics/adjust
      
      * Add prometheus metrics test to metrics middleware tests
      
      * Also inc :metabase-metrics/adjust-errors when throwing an exception
      
      * Make splice-compatible-metrics private
      
      It doesn't seem to be used outside of metabase.query-processor.middleware.metrics.
      
      * Add test for :metabase-metrics/adjust-errors when exception is thrown
      
      * Move inc-and-throw! helper into metabase.analytics.prometheus
      
      * Add inc-and-throw! test to prometheus tests
      
      * Rename inc-test to inc!-test and use approx= and metric-value helpers
      
      * Add try/catch to metrics adjust and record metric errors in a single place
      
      Record promethues metrics in a single place in metabase.query-processor.middleware.metrics and ensure we record
      failures for any exception throw.
      
      * Improve testing description string
      
      * Rename :metabase-metrics/adjust-errors to :metabase-query-processor/metrics-errors
      
      * Move metrics adjustment try/catch into a new helper
      
      This ensures we count all exceptions generated by adjust-metric-stages.
      
      * Add new prometheus metric to count number of MB metrics seen by the QP
      
      This new metric is intended to count the number of metrics that the query processor metrics middleware sees and
      attempts to adjust.
      
      * Add more metrics metrics tests
      
      - Ensure that queries with no metrics do not incremement either counter
      - Ensure that successful calls to adjust do not increment the error counter
      - Ensure that exceptions throw from other libs also increment the error counter
      
      * Rename test to adjust-prometheus-metrics-test and add helper to reduce code dup
      
      * If no metrics are found immediately return query in metrics middleware adjust
      
      Don't attempt to adjust query if we don't find any :metric clauses.
      
      * Appease cljfmt
      
      * Improve metric description
      
      Co-authored-by: default avatarmetamben <103100869+metamben@users.noreply.github.com>
      
      * Improve epsilon test in approx=
      
      Co-authored-by: default avatarmetamben <103100869+metamben@users.noreply.github.com>
      
      * Remove adjust-metric-stages-counting-errors
      
      This function was an attempt to avoid double-counting errors, but probably not worth the effort.
      
      See
      
      https://github.com/metabase/metabase/pull/48598#discussion_r1800197964
      https://github.com/metabase/metabase/pull/48598#discussion_r1800200421
      
      * Count metrics directly when mocking prometheus/inc!
      
      Based on PR feedback here:
      
      https://github.com/metabase/metabase/pull/48598#discussion_r1800207674
      
      * Remove prometheus/inc-and-throw!
      
      Value prop was always questionable, but now that it's only called from a single place, just remove it and inline the
      call to prometheus/inc!. Easy to add back later if it proves generally useful.
      
      PR discussion thread
      
      https://github.com/metabase/metabase/pull/48598#discussion_r1799728596
      
      * Rename match-one-metric to find-first-metric
      
      https://github.com/metabase/metabase/pull/48598#discussion_r1803321025
      
      * Rename :metabase-query-processor/metrics-errors to metric-errors
      
      https://github.com/metabase/metabase/pull/48598#discussion_r1803313818
      
      * Throw an exception rather than logging a warning if we fail to adjust a metric
      
      https://github.com/metabase/metabase/pull/48598#discussion_r1803328482
      
      
      
      ---------
      
      Co-authored-by: default avatarmetamben <103100869+metamben@users.noreply.github.com>
      Unverified
      00100b1c
    • bryan's avatar
      SDK embedding prometheus (#48578) · 94496eb5
      bryan authored
      * add prometheus tracking for sdk-embedding
      
      * indentation
      
      * improve track-sdk-response api
      
      * register :metabase-sdk/response-{ok,error} + test
      
      * avoid cyclic dependency whe nusing prometheus
      
      fixes:
      [ /metabase/api/common ]
      <- /metabase/models/setting
      <- /metabase/analytics/settings
      <- /metabase/analytics/prometheus
      <- /metabase/analytics/sdk
      <- /metabase/models/view_log
      <- /metabase/events/schema
      <- /metabase/events
      <- [ /metabase/api/common ]
      <- /metabase/public_settings/premium_features
      <- /metabase/auth_provider
      <- /metabase/driver
      <- /dev/debug_qp
      <- /dev
      
      * nix dependency: events.schema --> models.view-log
      
      - make them both read context from view-log-impl instead
      
      * cljfmt
      Unverified
      94496eb5
    • bryan's avatar
    • Chris Truter's avatar
    • metamben's avatar
Loading