valeriakononenko / grafana-clickhouse-plugin

Grafana plugin for ClickHouse datasource with alerting
Apache License 2.0
6 stars 3 forks source link

Dev Build Errors #8

Closed lmangani closed 3 years ago

lmangani commented 3 years ago

Hello & Happy New Year,

Are there any special requirements for building the datasource? Trying the regular dev build instructions using node 12.x and failing with multiple errors with either yarn/npm:

> vkononenko-clickhouse-datasource@1.1.0 dev /usr/src/grafana-clickhouse-plugin
> grafana-toolkit plugin:dev

✔ Linting
⠋ Bundling plugin in dev mode  Starting type checking service...
  Using 1 worker with 2048MB memory limit
⠏ Bundling plugin in dev mode  ERROR in /usr/src/grafana-clickhouse-plugin/src/editors/query/query-editor.tsx(13,31):
  TS2344: Type 'ClickHouseDatasource' does not satisfy the constraint 'DataSourceApi<ClickHouseQuery, ClickHouseOptions>'.
    The types returned by 'query(...)' are incompatible between these types.
      Type 'Observable<DataQueryResponse>' is not assignable to type 'Promise<DataQueryResponse> | Observable<DataQueryResponse>'.
        Type 'import("/usr/src/grafana-clickhouse-plugin/node_modules/rxjs/internal/Observable").Observable<import("/usr/src/grafana-clickhouse-plugin/node_modules/@grafana/data/types/datasource").DataQueryResponse>' is not assignable to type 'import("/usr/src/grafana-clickhouse-plugin/node_modules/@grafana/data/node_modules/rxjs/internal/Observable").Observable<import("/usr/src/grafana-clickhouse-plugin/node_modules/@grafana/data/types/datasource").DataQueryResponse>'.
          The types of 'source.operator.call' are incompatible between these types.
            Type '(subscriber: import("/usr/src/grafana-clickhouse-plugin/node_modules/rxjs/internal/Subscriber").Subscriber<any>, source: any) => import("/usr/src/grafana-clickhouse-plugin/node_modules/rxjs/internal/types").TeardownLogic' is not assignable to type '(subscriber: import("/usr/src/grafana-clickhouse-plugin/node_modules/@grafana/data/node_modules/rxjs/internal/Subscriber").Subscriber<any>, source: any) => import("/usr/src/grafana-clickhouse-plugin/node_modules/@grafana/data/node_modules/rxjs/internal/types").TeardownLogic'.
              Types of parameters 'subscriber' and 'subscriber' are incompatible.
                Type 'import("/usr/src/grafana-clickhouse-plugin/node_modules/@grafana/data/node_modules/rxjs/internal/Subscriber").Subscriber<any>' is not assignable to type 'import("/usr/src/grafana-clickhouse-plugin/node_modules/rxjs/internal/Subscriber").Subscriber<any>'.
                  Property 'isStopped' is protected but type 'Subscriber<T>' is not a class derived from 'Subscriber<T>'.
  ERROR in /usr/src/grafana-clickhouse-plugin/src/module.ts(8,44):
  TS2344: Type 'ClickHouseDatasource' does not satisfy the constraint 'DataSourceApi<ClickHouseQuery, ClickHouseOptions>'.
    The types returned by 'query(...)' are incompatible between these types.
      Type 'Observable<DataQueryResponse>' is not assignable to type 'Promise<DataQueryResponse> | Observable<DataQueryResponse>'.
        Type 'import("/usr/src/grafana-clickhouse-plugin/node_modules/rxjs/internal/Observable").Observable<import("/usr/src/grafana-clickhouse-plugin/node_modules/@grafana/data/types/datasource").DataQueryResponse>' is not assignable to type 'import("/usr/src/grafana-clickhouse-plugin/node_modules/@grafana/data/node_modules/rxjs/internal/Observable").Observable<import("/usr/src/grafana-clickhouse-plugin/node_modules/@grafana/data/types/datasource").DataQueryResponse>'.
  ERROR in /usr/src/grafana-clickhouse-plugin/src/module.ts(11,20):
  TS2345: Argument of type 'typeof ConfigEditor' is not assignable to parameter of type 'ComponentType<DataSourcePluginOptionsEditorProps<ClickHouseOptions, unknown>>'.
    Type 'typeof ConfigEditor' is not assignable to type 'ComponentClass<DataSourcePluginOptionsEditorProps<ClickHouseOptions, unknown>, any>'.
      Types of parameters 'props' and 'props' are incompatible.
        Type 'DataSourcePluginOptionsEditorProps<ClickHouseOptions, unknown>' is not assignable to type 'Props'.
          Types of property 'options' are incompatible.
            Type 'DataSourceSettings<ClickHouseOptions, unknown>' is not assignable to type 'DataSourceSettings<ClickHouseOptions, {}>'.
              Type 'unknown' is not assignable to type '{}'.

   Hash: 2658366f4e703848c053
  Version: webpack 4.41.5
  Time: 4899ms
  Built at: 01/01/2021 4:44:16 PM
                             Asset       Size  Chunks                          Chunk Names
                      CHANGELOG.md   42 bytes          [emitted]
                           LICENSE   11.1 KiB          [emitted]
                         README.md  468 bytes          [emitted]
                      img/logo.svg   2.03 KiB          [emitted]
                         module.js   1.29 MiB  module  [emitted]        [big]  module
                     module.js.map   1.64 MiB  module  [emitted] [dev]         module
  partials/annotations-editor.html  568 bytes          [emitted]
                       plugin.json  849 bytes          [emitted]
  Entrypoint module [big] = module.js module.js.map
  [../node_modules/tslib/tslib.es6.js] 10 KiB {module} [built]
  [./datasource.ts] 2.22 KiB {module} [built]
  [./editors/annotation-editor.ts] 332 bytes {module} [built]
  [./editors/config-editor.tsx] 3.78 KiB {module} [built]
  [./editors/query/query-editor.tsx] 2.77 KiB {module} [built]
  [./editors/query/query-field.tsx] 1.49 KiB {module} [built]
  [./editors/query/query-option.tsx] 1.78 KiB {module} [built]
  [./editors/query/query-split-example.tsx] 1.24 KiB {module} [built]
  [./editors/query/query-template-variables.tsx] 1 KiB {module} [built]
  [./model/annotation.ts] 2.02 KiB {module} [built]
  [./model/datasource-cache.ts] 2 KiB {module} [built]
  [./model/defaults.ts] 1.52 KiB {module} [built]
  [./model/metric.ts] 1.48 KiB {module} [built]
  [./module.ts] 445 bytes {module} [built]
  [@grafana/data] external "@grafana/data" 42 bytes {module} [built]
      + 41 hidden modules

  ERROR in /usr/src/grafana-clickhouse-plugin/src/editors/query/query-editor.tsx
  ERROR in /usr/src/grafana-clickhouse-plugin/src/editors/query/query-editor.tsx(13,31):
  TS2344: Type 'ClickHouseDatasource' does not satisfy the constraint 'DataSourceApi<ClickHouseQuery, ClickHouseOptions>'.
    The types returned by 'query(...)' are incompatible between these types.
      Type 'Observable<DataQueryResponse>' is not assignable to type 'Promise<DataQueryResponse> | Observable<DataQueryResponse>'.
        Type 'import("/usr/src/grafana-clickhouse-plugin/node_modules/rxjs/internal/Observable").Observable<import("/usr/src/grafana-clickhouse-plugin/node_modules/@grafana/data/types/datasource").DataQueryResponse>' is not assignable to type 'import("/usr/src/grafana-clickhouse-plugin/node_modules/@grafana/data/node_modules/rxjs/internal/Observable").Observable<import("/usr/src/grafana-clickhouse-plugin/node_modules/@grafana/data/types/datasource").DataQueryResponse>'.
          The types of 'source.operator.call' are incompatible between these types.
            Type '(subscriber: import("/usr/src/grafana-clickhouse-plugin/node_modules/rxjs/internal/Subscriber").Subscriber<any>, source: any) => import("/usr/src/grafana-clickhouse-plugin/node_modules/rxjs/internal/types").TeardownLogic' is not assignable to type '(subscriber: import("/usr/src/grafana-clickhouse-plugin/node_modules/@grafana/data/node_modules/rxjs/internal/Subscriber").Subscriber<any>, source: any) => import("/usr/src/grafana-clickhouse-plugin/node_modules/@grafana/data/node_modules/rxjs/internal/types").TeardownLogic'.
              Types of parameters 'subscriber' and 'subscriber' are incompatible.
                Type 'import("/usr/src/grafana-clickhouse-plugin/node_modules/@grafana/data/node_modules/rxjs/internal/Subscriber").Subscriber<any>' is not assignable to type 'import("/usr/src/grafana-clickhouse-plugin/node_modules/rxjs/internal/Subscriber").Subscriber<any>'.
                  Property 'isStopped' is protected but type 'Subscriber<T>' is not a class derived from 'Subscriber<T>'.

  ERROR in /usr/src/grafana-clickhouse-plugin/src/module.ts
  ERROR in /usr/src/grafana-clickhouse-plugin/src/module.ts(8,44):
  TS2344: Type 'ClickHouseDatasource' does not satisfy the constraint 'DataSourceApi<ClickHouseQuery, ClickHouseOptions>'.
    The types returned by 'query(...)' are incompatible between these types.
      Type 'Observable<DataQueryResponse>' is not assignable to type 'Promise<DataQueryResponse> | Observable<DataQueryResponse>'.
        Type 'import("/usr/src/grafana-clickhouse-plugin/node_modules/rxjs/internal/Observable").Observable<import("/usr/src/grafana-clickhouse-plugin/node_modules/@grafana/data/types/datasource").DataQueryResponse>' is not assignable to type 'import("/usr/src/grafana-clickhouse-plugin/node_modules/@grafana/data/node_modules/rxjs/internal/Observable").Observable<import("/usr/src/grafana-clickhouse-plugin/node_modules/@grafana/data/types/datasource").DataQueryResponse>'.

  ERROR in /usr/src/grafana-clickhouse-plugin/src/module.ts
  ERROR in /usr/src/grafana-clickhouse-plugin/src/module.ts(11,20):
  TS2345: Argument of type 'typeof ConfigEditor' is not assignable to parameter of type 'ComponentType<DataSourcePluginOptionsEditorProps<ClickHouseOptions, unknown>>'.
    Type 'typeof ConfigEditor' is not assignable to type 'ComponentClass<DataSourcePluginOptionsEditorProps<ClickHouseOptions, unknown>, any>'.
      Types of parameters 'props' and 'props' are incompatible.
        Type 'DataSourcePluginOptionsEditorProps<ClickHouseOptions, unknown>' is not assignable to type 'Props'.
          Types of property 'options' are incompatible.
            Type 'DataSourceSettings<ClickHouseOptions, unknown>' is not assignable to type 'DataSourceSettings<ClickHouseOptions, {}>'.
              Type 'unknown' is not assignable to type '{}'.

  Trace: Build failed
      at /usr/src/grafana-clickhouse-plugin/node_modules/@grafana/toolkit/src/cli/utils/useSpinner.js:25:29
      at step (/usr/src/grafana-clickhouse-plugin/node_modules/@grafana/toolkit/node_modules/tslib/tslib.js:140:27)
      at Object.throw (/usr/src/grafana-clickhouse-plugin/node_modules/@grafana/toolkit/node_modules/tslib/tslib.js:121:57)
      at rejected (/usr/src/grafana-clickhouse-plugin/node_modules/@grafana/toolkit/node_modules/tslib/tslib.js:112:69)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
✖ Build failed
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vkononenko-clickhouse-datasource@1.1.0 dev: `grafana-toolkit plugin:dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vkononenko-clickhouse-datasource@1.1.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-01-01T15_44_16_045Z-debug.log

Thanks in advance for your time & this interesting alternate datasource!

Lorenzo

valeriakononenko commented 3 years ago

It's very strange. It works for me when I just run

npm i && npm run dev

after repo was cloned.

Maybe you've changed @grafana/runtime or @grafana/data version in package.json?

lmangani commented 3 years ago

Thanks for confirming! I'm running the exact command w/o any modifications, but the real issue seems to be with the npm version. After forcing an npm update to the latest, the build runs and problem goes away. Closing and testing :)

lmangani commented 3 years ago

note: might be worth updating DEVELOPMENT.md with the new plugin name and details perhaps? If a PR is welcome we'll do.

valeriakononenko commented 3 years ago

Yep, thanks. I'm in progress)

lmangani commented 3 years ago

All seems good except perhaps the id in here which is conflicting between the repo name/package, plugin name and instructions. Great job so far!