@perses-dev/tempo-plugin 0.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/LICENSE +201 -0
  2. package/dist/cjs/index.js +47 -0
  3. package/dist/cjs/model/api-types.js +16 -0
  4. package/dist/cjs/model/index.js +33 -0
  5. package/dist/cjs/model/tempo-client.js +88 -0
  6. package/dist/cjs/model/tempo-selectors.js +46 -0
  7. package/dist/cjs/model/trace-query-model.js +16 -0
  8. package/dist/cjs/plugins/TempoTraceQuery.js +30 -0
  9. package/dist/cjs/plugins/get-trace-data.js +69 -0
  10. package/dist/cjs/plugins/tempo-datasource-types.js +16 -0
  11. package/dist/cjs/plugins/tempo-datasource.js +50 -0
  12. package/dist/cjs/test/index.js +30 -0
  13. package/dist/cjs/test/mock-data.js +887 -0
  14. package/dist/cjs/test/setup-tests.js +17 -0
  15. package/dist/index.d.ts +6 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +21 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/model/api-types.d.ts +72 -0
  20. package/dist/model/api-types.d.ts.map +1 -0
  21. package/dist/model/api-types.js +15 -0
  22. package/dist/model/api-types.js.map +1 -0
  23. package/dist/model/index.js +18 -0
  24. package/dist/model/index.js.map +1 -0
  25. package/dist/model/tempo-client.d.ts +36 -0
  26. package/dist/model/tempo-client.d.ts.map +1 -0
  27. package/dist/model/tempo-client.js +80 -0
  28. package/dist/model/tempo-client.js.map +1 -0
  29. package/dist/model/tempo-selectors.d.ts +21 -0
  30. package/dist/model/tempo-selectors.d.ts.map +1 -0
  31. package/dist/model/tempo-selectors.js +30 -0
  32. package/dist/model/tempo-selectors.js.map +1 -0
  33. package/dist/model/trace-query-model.d.ts +9 -0
  34. package/dist/model/trace-query-model.d.ts.map +1 -0
  35. package/dist/model/trace-query-model.js +15 -0
  36. package/dist/model/trace-query-model.js.map +1 -0
  37. package/dist/plugins/TempoTraceQuery.d.ts +11 -0
  38. package/dist/plugins/TempoTraceQuery.d.ts.map +1 -0
  39. package/dist/plugins/TempoTraceQuery.js +24 -0
  40. package/dist/plugins/TempoTraceQuery.js.map +1 -0
  41. package/dist/plugins/get-trace-data.d.ts +4 -0
  42. package/dist/plugins/get-trace-data.d.ts.map +1 -0
  43. package/dist/plugins/get-trace-data.js +61 -0
  44. package/dist/plugins/get-trace-data.js.map +1 -0
  45. package/dist/plugins/tempo-datasource-types.d.ts +6 -0
  46. package/dist/plugins/tempo-datasource-types.d.ts.map +1 -0
  47. package/dist/plugins/tempo-datasource-types.js +15 -0
  48. package/dist/plugins/tempo-datasource-types.js.map +1 -0
  49. package/dist/plugins/tempo-datasource.d.ts +5 -0
  50. package/dist/plugins/tempo-datasource.d.ts.map +1 -0
  51. package/dist/plugins/tempo-datasource.js +42 -0
  52. package/dist/plugins/tempo-datasource.js.map +1 -0
  53. package/dist/test/index.d.ts +2 -0
  54. package/dist/test/index.d.ts.map +1 -0
  55. package/dist/test/index.js +15 -0
  56. package/dist/test/index.js.map +1 -0
  57. package/dist/test/mock-data.d.ts +5 -0
  58. package/dist/test/mock-data.d.ts.map +1 -0
  59. package/dist/test/mock-data.js +871 -0
  60. package/dist/test/mock-data.js.map +1 -0
  61. package/dist/test/setup-tests.d.ts +2 -0
  62. package/dist/test/setup-tests.d.ts.map +1 -0
  63. package/dist/test/setup-tests.js +15 -0
  64. package/dist/test/setup-tests.js.map +1 -0
  65. package/package.json +43 -0
  66. package/plugin.json +26 -0
@@ -0,0 +1,42 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { searchTraceQuery, searchTraceID, getEnrichedTraceQuery } from '../model/tempo-client';
14
+ /**
15
+ * Creates a TempoClient for a specific datasource spec.
16
+ */ const createClient = (spec, options)=>{
17
+ const { directUrl } = spec;
18
+ const { proxyUrl } = options;
19
+ // Use the direct URL if specified, but fallback to the proxyUrl by default if not specified
20
+ const datasourceUrl = directUrl !== null && directUrl !== void 0 ? directUrl : proxyUrl;
21
+ if (datasourceUrl === undefined) {
22
+ throw new Error('No URL specified for Tempo client. You can use directUrl in the spec to configure it.');
23
+ }
24
+ return {
25
+ options: {
26
+ datasourceUrl
27
+ },
28
+ searchTraceQuery: (query)=>searchTraceQuery(query, datasourceUrl),
29
+ searchTraceID: (traceID)=>searchTraceID(traceID, datasourceUrl),
30
+ getEnrichedTraceQuery: (query)=>getEnrichedTraceQuery(query, datasourceUrl)
31
+ };
32
+ };
33
+ export const TempoDatasource = {
34
+ createClient,
35
+ // TODO add a options editor component for tempo datasource
36
+ // OptionsEditorComponent: TempoDatasourceEditor,
37
+ createInitialOptions: ()=>({
38
+ directUrl: ''
39
+ })
40
+ };
41
+
42
+ //# sourceMappingURL=tempo-datasource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/plugins/tempo-datasource.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DatasourcePlugin } from '@perses-dev/plugin-system';\nimport { searchTraceQuery, searchTraceID, getEnrichedTraceQuery, TempoClient } from '../model/tempo-client';\nimport { TempoDatasourceSpec } from './tempo-datasource-types';\n\n/**\n * Creates a TempoClient for a specific datasource spec.\n */\nconst createClient: DatasourcePlugin<TempoDatasourceSpec, TempoClient>['createClient'] = (spec, options) => {\n const { directUrl } = spec;\n const { proxyUrl } = options;\n\n // Use the direct URL if specified, but fallback to the proxyUrl by default if not specified\n const datasourceUrl = directUrl ?? proxyUrl;\n if (datasourceUrl === undefined) {\n throw new Error('No URL specified for Tempo client. You can use directUrl in the spec to configure it.');\n }\n\n return {\n options: {\n datasourceUrl,\n },\n searchTraceQuery: (query: string) => searchTraceQuery(query, datasourceUrl),\n searchTraceID: (traceID: string) => searchTraceID(traceID, datasourceUrl),\n getEnrichedTraceQuery: (query: string) => getEnrichedTraceQuery(query, datasourceUrl),\n };\n};\n\nexport const TempoDatasource: DatasourcePlugin<TempoDatasourceSpec, TempoClient> = {\n createClient,\n // TODO add a options editor component for tempo datasource\n // OptionsEditorComponent: TempoDatasourceEditor,\n createInitialOptions: () => ({ directUrl: '' }),\n};\n"],"names":["searchTraceQuery","searchTraceID","getEnrichedTraceQuery","createClient","spec","options","directUrl","proxyUrl","datasourceUrl","undefined","Error","query","traceID","TempoDatasource","createInitialOptions"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,gBAAgB,EAAEC,aAAa,EAAEC,qBAAqB,QAAqB,wBAAwB;AAG5G;;CAEC,GACD,MAAMC,eAAmF,CAACC,MAAMC;IAC9F,MAAM,EAAEC,UAAS,EAAE,GAAGF;IACtB,MAAM,EAAEG,SAAQ,EAAE,GAAGF;IAErB,4FAA4F;IAC5F,MAAMG,gBAAgBF,sBAAAA,uBAAAA,YAAaC;IACnC,IAAIC,kBAAkBC,WAAW;QAC/B,MAAM,IAAIC,MAAM;IAClB;IAEA,OAAO;QACLL,SAAS;YACPG;QACF;QACAR,kBAAkB,CAACW,QAAkBX,iBAAiBW,OAAOH;QAC7DP,eAAe,CAACW,UAAoBX,cAAcW,SAASJ;QAC3DN,uBAAuB,CAACS,QAAkBT,sBAAsBS,OAAOH;IACzE;AACF;AAEA,OAAO,MAAMK,kBAAsE;IACjFV;IACA,2DAA2D;IAC3D,iDAAiD;IACjDW,sBAAsB,IAAO,CAAA;YAAER,WAAW;QAAG,CAAA;AAC/C,EAAE"}
@@ -0,0 +1,2 @@
1
+ export * from './mock-data';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAaA,cAAc,aAAa,CAAC"}
@@ -0,0 +1,15 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export * from './mock-data';
14
+
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/test/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './mock-data';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,cAAc"}
@@ -0,0 +1,5 @@
1
+ import { TraceData } from '@perses-dev/core';
2
+ import { EnrichedTraceQueryResponse } from '../model/api-types';
3
+ export declare const MOCK_ENRICHED_TRACE_QUERY_RESPONSE: EnrichedTraceQueryResponse;
4
+ export declare const MOCK_TRACE_DATA: TraceData;
5
+ //# sourceMappingURL=mock-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock-data.d.ts","sourceRoot":"","sources":["../../src/test/mock-data.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAEhE,eAAO,MAAM,kCAAkC,EAAE,0BAy0BhD,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAY7B,CAAC"}