Commit Graph

775 Commits

Author SHA1 Message Date
Sven Grossmann
7bc0692801
Logs: Add new LogRowContext types to @grafana/data (#66404)
* Logs: Add new LogRowContext types to grafana/data

* use right type for `RowContextOptions`

* add missing renames
2023-04-13 13:07:28 +02:00
Sven Grossmann
89f23fcbc9
Logs: Fix typo in filename of loki/LogContextProvider (#66410)
change filename to match class name
2023-04-13 09:39:55 +02:00
Ivana Huckova
e12598f55c
Loki: Move log context to separate log context provider (#66357)
* Loki: Move log context to separate provider

* Update public/app/plugins/datasource/loki/LogContextProvider.ts

Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>

* Fix lint

---------

Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
2023-04-12 15:09:37 +02:00
Kousik Mitra
2ecd63764e
Datasource/Loki: Add tooltip explaining resolution for loki query (#66283)
* Add tooltip explaining resolution for loki query

* Update tooltip text with more detail

Co-authored-by: Matias Chomicki <matyax@gmail.com>

* Fix lint error

---------

Co-authored-by: Matias Chomicki <matyax@gmail.com>
2023-04-11 18:01:26 +02:00
Sven Grossmann
e9b15eff72
Logs: Move components to dedicated directory (#65936)
* move log-context components to dedicated directory

* fix any

* add right format of lerna.json
2023-04-11 12:19:28 +02:00
Ashley Harrison
1261345b81
Chore: Upgrade to react 18 (#64428)
* update react 18 related deps

* fix some types

* make sure we're on react-router-dom >= 5.3.3

* Use new root API

* Remove StrictMode for now - react 18 double rendering causes issues

* fix + ignore some @grafana/ui types

* fix some more types

* use renderHook from @testing-library/react in almost all cases

* fix storybook types

* rewrite useDashboardSave to not use useEffect

* make props optional

* only render if props are provided

* add correct type for useCallback

* make resourcepicker tests more robust

* fix ModalManager rendering

* fix some more unit tests

* store the click coordinates in a ref as setState is NOT synchronous

* fix remaining e2e tests

* rewrite dashboardpage tests to avoid act warnings

* undo lint ignores

* fix ExpanderCell types

* set SymbolCell type correctly

* fix QueryAndExpressionsStep

* looks like the types were actually wrong instead :D

* undo this for now...

* remove spinner waits

* more robust tests

* rewrite errorboundary test to not explicitly count the number of renders

* make urlParam expect async

* increase timeout in waitFor

* revert ExplorePage test changes

* Update public/app/features/dashboard/containers/DashboardPage.test.tsx

Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>

* Update public/app/features/dashboard/containers/PublicDashboardPage.test.tsx

Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>

* Update public/app/features/dashboard/containers/PublicDashboardPage.test.tsx

Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>

* Update public/app/features/dashboard/containers/PublicDashboardPage.test.tsx

Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>

* skip fakeTimer test, ignore table types for now + other review comments

* update package peerDeps

* small tweak to resourcepicker test

* update lockfile...

* increase timeout in sharepublicdashboard tests

* ensure ExplorePaneContainer passes correct queries to initializeExplore

* fix LokiContextUI test

* fix unit tests

* make importDashboard flow more consistent

* wait for dashboard name before continuing

* more test fixes

* readd dashboard name to variable e2e tests

* wait for switches to be enabled before clicking

* fix modal rendering

* don't use @testing-library/dom directly

* quick fix for rendering of panels in firefox

* make PromQueryField test more robust

* don't wait for chartData - in react 18 this can happen before the wait code even gets executed

---------

Co-authored-by: kay delaney <kay@grafana.com>
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
2023-04-11 10:51:54 +01:00
Domas
5dc529a55d
Query Splitting: Fix for handling queries with no requestId (#66161)
Loki query splitting fix for when there's no request id
2023-04-07 13:31:18 +03:00
Matias Chomicki
58287c2df2
Loki Query Editor: Increase autocomplete suggestions window with to 50% (#66041)
Loki Monaco Editor: Increase autocomplete min width to 50%
2023-04-05 16:46:44 +00:00
Gábor Farkas
4ded937c79
Show traceids for failing and successful requests (#64903)
* tracing: show backend trace ids in frontend

* better trace id naming

Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>

* better trace id naming

Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>

* better trace id naming

Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>

* added feature flag

* bind functionality to the feature flag

* use non-generic name for traceid header

* fixed tests

* loki: do not create empty fields

* do not add empty fields

* fixed graphite test mock data

* added unit-tests to queryResponse

* added unit-tests for backend_srv

* more typescript-friendly check

* added unit-tests for runRequest

---------

Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
2023-04-05 09:13:24 +02:00
Matias Chomicki
44beef2e41
Loki Query Splitting: Fix bug for mixed split durations (#65925)
* Query splitting: fix next request group pointer calculation

* Update unit test
2023-04-04 15:51:41 +02:00
Matias Chomicki
663ed7ba82
Loki Query Splitting: Rename from "chunk" to "splitting" (#65630)
* Update chunking mentions in the code and ui

* Rename files and exported functions

* Rename configuration attribute

* Rename grouped querying function name

* Update more function names

* Update unit test

* Update unit tests

* More renames

* Rename time splitting functions
2023-04-03 12:30:08 +00:00
Sven Grossmann
d790cb1c09
Loki: Add unpack query builder hint (#65608)
* add unpack hint

* use `hasOwnProperty`

* add unpack completion to monaco

* adjust test name

* fix tests

* fix tests
2023-03-30 15:18:02 +02:00
Matias Chomicki
fc16fb0407
Loki Query Chunking: Group queries by resolution (#65353)
* Loki chunking: group queries by resolution

* Update unit tests

* Add chunked + grouped test case
2023-03-30 10:29:19 +02:00
Sven Grossmann
b01194f81e
Loki: Fix autocomplete situations with multiple escaped quotes (#65520)
fix situations with multiple quotes
2023-03-29 15:00:42 +02:00
Torkel Ödegaard
f43ef18732
Revert "Explore: Show log line if there is an interpolated link" (#65315)
Revert "Explore: Show log line if there is an interpolated link (#62926)"

This reverts commit aa857e2a4f.
2023-03-27 19:19:42 +02:00
Matias Chomicki
9874a2d48b
Loki Logs sample: use the selected time range in sample request (#65126)
Logs sample: use the selected time range in sample request

There are parts of the query, such as label values, that could only be present during the current selected time interval. If we request using a time range other than the selected one, we are not providing builder suggestions based on the same data that the user is seeing.
2023-03-22 18:56:40 +02:00
Kristina
aa857e2a4f
Explore: Show log line if there is an interpolated link (#62926)
* bring in source from database

* bring in transformations from database

* add regex transformations to scopevar

* Consolidate types, add better example, cleanup

* Add var only if match

* Change ScopedVar to not require text, do not leak transformation-made variables between links

* Add mappings and start implementing logfmt

* Add mappings and start implementing logfmt

* Remove mappings, turn off global regex

* Add example yaml and omit transformations if empty

* Fix the yaml

* Add logfmt transformation

* Cleanup transformations and yaml

* add transformation field to FE types and use it, safeStringify logfmt values

* Add tests, only safe stringify if non-string, fix bug with safe stringify where it would return empty string with false value

* Add test for transformation field

* Do not add null transformations object

* Add provisioning (to be removed) and show log lines with links

* Only display links if change to query was made

* Break out transformation logic, add tests to backend code

* Fix lint errors I understand 😅

* Fix the backend lint error

* Remove unnecessary code and mark new Transformations object as internal

* Add support for named capture groups

* Remove type assertion

* Remove variable name from transformation

* Add test for overriding regexes

* Add back variable name field, but change to mapValue

* fix go api test

* Change transformation types to enum, add better provisioning checks for bad type name and format

* Change transformation types to enum, add better provisioning checks for bad type name and format

* Check for expression with regex transformations

* Remove isInterpolated variable, add option to always use format function

* Add template variable check to links

* Use new functions

* Filter log line at render, remove extra createSpanLink imports

* Add scrollable to long log messages

* Remove test that is no longer accurate

* Remove test correlation

* Add tests, fix duplicate key issue

* WIP: show log line links key/value pairs

* Some not great style changes

* Change LogDetailsRow for better multi value formatting

* Cleanup

* Add additional information around variable regex, implement PR feedback

* Display name with fieldPath if applicable

* Add variables with fieldPaths to test

* Count empty string as undefined variable

* Add better commented version of function, fix tests by removing new variable

* Modify when links show

* Remove sample yaml

* If a link has no variables, set value to field name, and some formatting issues

* Add comments and change variable names to be more clear, add back logic where needed, add test coverage for new scenario

* Fix formatting of replaceInVariableRegex comment

* Remove changes from Grafana-data, move logic into explore

* Rename function and property to match similar format

* Move types to type files and consolidate definitions, rename functions, change field definitions to accept arrays of keys/values, move function to parser, hide actions on multi key/value rows

* Add tests to logParser’s new function
2023-03-22 08:01:04 -05:00
Matias Chomicki
6093e45178
Loki Query Chunking: Refactor naming conventions and reorganize code (#65056)
* Rename splitting files to chunking

* Rename time chunking functions

* Move response functions to response utils

* Remove some blank spaces

* Add an extra test case for frame refIds and names
2023-03-21 15:54:18 +00:00
Torkel Ödegaard
395890c357
Prometheus/Loki: Run query explicitly instead of onblur in panel edit (#64815)
* Prometheus: Run query explicitly instead of onblur in panel edit, and highlight Run qqueries when query changed

* Update loki to do the same

* Cleanup unused prop

* Remove test
2023-03-21 07:55:34 +01:00
Sven Grossmann
68551ac9ca
Loki: Add lokiQueryChunkingOption feature flag (#65057)
* add `lokiQueryChunkingOption` feature flag

* be safe and also rely on `config.featureToggles.lokiQuerySplitting`

* renamed to `lokiQuerySplittingConfig`

* fix typo
2023-03-20 16:51:36 +01:00
Sven Grossmann
7a17a8f02d
QueryStats: Fix comparison of relative and absolute timeranges (#65035)
* add missing fix of relative timeranges

* add doc
2023-03-20 11:35:03 +01:00
Sven Grossmann
6ae373b8c7
QueryStats: Fix comparison of timeranges (#65025)
* fix timerange comparison

* remove import
2023-03-20 10:04:41 +01:00
Sven Grossmann
7261c6f7cd
DataSourceWithBackend: Add queryGroupId to find correlated/related queries (#64587)
* add `correlationId` to queries

* trace correlation id in backend

* add correlation id to loki's span

* add correlation id to query chunks

* fix test

* fix DataSourceWithBackend test

* change to `queryGroupId`

* remove empty line

* fix test in `DataSourceWithBackend`
2023-03-17 15:48:13 +01:00
Gareth Dawson
c16280a4e8
Loki: Improve the display of loki query stats (#63623)
* fix: refresh query stats on timerange change

* partial fix: request stats update on type in code mode

* complete fix: request stats update on type in code mode

* fix: update failing tests and props

* refactor: pass only essential query string to getQueryStats

* refactor: remove unused variables

* test: fix datasource.getTimeRange is not a function

* refactor: use lodash debounce instead of setTimeout

* refactor: add suggestions from code review

* test: shouldUpdateStats and makeStatsRequest

* refactor: use more appropriate variable names

* refactor: make setQueryStats required instead of optional

* refactor: move setQueryStats into LokiQueryEditor

* fix: add missing props to LokiQueryField

* revert changes

* refactor: use inversion of control to request stats

* refactor: remove unnecessary code
2023-03-16 18:50:42 +00:00
Sven Grossmann
40014f1454
Loki: Add option to define chunk duration per query (#64834)
* add query option to configure chunk ranges

* remove `isValidDuration` check

* Update public/app/plugins/datasource/loki/querybuilder/components/LokiQueryBuilderOptions.tsx

Co-authored-by: Matias Chomicki <matyax@gmail.com>

* change to `chunkDuration`
added tests

* no need to call `toString`

---------

Co-authored-by: Matias Chomicki <matyax@gmail.com>
2023-03-16 16:30:12 +01:00
Sven Grossmann
652e7334c8
Loki: Remove unnecessary type extension (#64883)
remove unnecessary type extension
2023-03-16 11:28:40 +01:00
Gábor Farkas
5d8ec2756e
loki: query chunking: better error handling (#64811)
* loki: query chunking: better error handling

* better comment text

Co-authored-by: Matias Chomicki <matyax@gmail.com>

* better comment text

Co-authored-by: Matias Chomicki <matyax@gmail.com>

* changed merge approach

* simplified code

* fixed test

* removed forgotten code

---------

Co-authored-by: Matias Chomicki <matyax@gmail.com>
2023-03-16 08:54:32 +01:00
Ivana Huckova
a996344e14
Loki: Add autocomplete updates for improved suggestions (#64744)
* Loki: Add autocomplete updates for improved suggestions

* Use trimEnd for trailing pipeline

* Update public/app/plugins/datasource/loki/components/monaco-query-field/monaco-completion-provider/completions.ts

Co-authored-by: Matias Chomicki <matyax@gmail.com>

* Fix unused imports

---------

Co-authored-by: Matias Chomicki <matyax@gmail.com>
2023-03-15 14:26:46 +01:00
Ashley Harrison
e0e6165f70
Chore: adjust more unit tests to work with react 18 (#64759)
adjust unit tests to work with react 18
2023-03-15 10:12:13 +00:00
Ashley Harrison
85e5326040
Chore: Adjust unit tests so they work with react 18 (#64698)
tweak unit tests so they work with react 18
2023-03-14 17:24:04 +00:00
Ryan McKinley
d710507bc5
Chore: Avoid explicit React.FC<Props> when possible (#64722) 2023-03-14 16:38:21 +02:00
Gareth Dawson
d72c39c587
Loki: Add descriptions to query builder operations (#64046)
* feat: add descriptions to query builder operations

* refactor: add suggestion from review

* fix: update width of label operator seelct
2023-03-14 12:14:32 +00:00
Ashley Harrison
53186c14a4
Chore: Improve some types (#64675)
* some type fixes

* few more

* more type fixes

* fix the majority of (window as any) calls

* don't make new variable for event

* few more

* MOAR
2023-03-14 09:51:44 +00:00
Matias Chomicki
5ffb28989e
Range splitting: remove hardcoded chunk limit (#64625)
* Range splitting: allow splits larger than 30 days while keeping the fail safe

* Remove limit

* Fix test

* Remove unnecessary try/catch

* Remove unused export
2023-03-13 05:33:01 -04:00
Sven Grossmann
b46771cbfe
Loki: Always fetch for new label keys in the QueryBuilder (#64597)
* always fetch new labels

* remove refreshLogLabels
2023-03-10 13:13:51 +01:00
Sven Grossmann
976568a337
Loki: Fix labels in LabelBrowser being wrongly cached (#64482)
* remove label cache from label browser

* fix spelling

Co-authored-by: Gareth Dawson <gareth.dawson@grafana.com>

---------

Co-authored-by: Gareth Dawson <gareth.dawson@grafana.com>
2023-03-09 11:36:07 +01:00
Matias Chomicki
ede3e9e5c4
Range Splitting: Process instant queries as an independent query group (#64049)
* Query splitting: enable instant queries

* Range splitting: send instant queries as another request group

* Range splitting: increase grouped splitted requests stability

We were defaulting to the `0` index as the first group for the next request batch, but there was no guarantee that the group `0` had a `.partition` entry for `requestN-1`. Now we find the first defined and use that index as the next starting group.

* Range splitting: update unit test
2023-03-07 07:44:13 -05:00
Matias Chomicki
69d3ae8ec1
Range Splitting: ignore empty queries from splitting and fix result resetting (#64053)
Range splitting: ignore empty queries from splitting
2023-03-07 13:09:55 +01:00
Matias Chomicki
accef84ca5
Range splitting: Call subscriber.next only when there are new results to report (#64171) 2023-03-07 13:05:40 +01:00
Sven Grossmann
5db0d14606
LokiContextUi: Add loading indicator (#64167)
add loading indicator to LokiContextUi
2023-03-06 17:25:04 +01:00
Sven Grossmann
2076282064
Logs: Log samples not being ordered correctly (#64097)
* fix log samples being unsorted and multiple results when chunking

* use `SortDirection` enum

* changed to `sortDataFrame` to support other datasources than loki

* update tests

* change capitalization
2023-03-03 16:02:14 +01:00
Gábor Farkas
192308aac7
loki: query splitting: better stats (#64105) 2023-03-03 04:58:28 -05:00
李国忠
9521b0d2d2
Explore: Fix vector(5) syntax error in loki log explore (#63994)
* [fix] loki log explore : fix vector(5) err

* changelog

* changelog fmt

* rollback change log

* fix test and pretty fmt

* Update package.json

update lezer-logql depedency to 0.1.2

* Update package.json

fix conflict

➤ YN0000: │  "@grafana/monaco-logql@npm:^0.0.6":
➤ YN0000: │ @@ -21988,9 +21987,9 @@
➤ YN0000: │      "@grafana/experimental": 1.1.0
➤ YN0000: │      "@grafana/faro-core": 1.0.0-beta2
➤ YN0000: │      "@grafana/faro-web-sdk": 1.0.0-beta2
➤ YN0000: │      "@grafana/google-sdk": 0.0.4
➤ YN0028: │ -    "@grafana/lezer-logql": 0.1.1
➤ YN0028: │ +    "@grafana/lezer-logql": 0.1.2
➤ YN0000: │      "@grafana/monaco-logql": ^0.0.6
➤ YN0000: │      "@grafana/runtime": "workspace:*"
➤ YN0000: │      "@grafana/scenes": ^0.0.14
➤ YN0000: │      "@grafana/schema": "workspace:*"

* Upgrade lezer-logql

* fix logql test

---------

Co-authored-by: Matias Chomicki <matyax@gmail.com>
2023-03-03 10:09:34 +01:00
Gábor Farkas
fdc4973b77
loki: query chunking: consider refId when merging frames (#64103) 2023-03-03 10:06:25 +01:00
Matias Chomicki
40ac0fa14b
Query Splitting: Add support for multiple queries (#63663)
* Range splitting: group metric and logs queries

* Range splitting: intercalate logs and metric queries when > 1 queries

* Range splitting: fix possibly undefined error and remove console log

* Range splitting: update test imports

* Range splitting: add unit tests for multiple queries

* Query splitting: use lodash partition function

* Chore: rename variable

* Chore: attempt to improve readability
2023-03-02 10:32:45 +01:00
Matias Chomicki
d56896cf72
Range splitting: Omit instant queries from splitting (#63705)
Range splitting: omit instant queries from splitting
2023-02-27 11:09:46 +01:00
Ivan Ortega Alba
14e29451cf
Loki ds: Interpolation breaks in Loki queries when no scoped vars (#63694) 2023-02-24 00:18:08 -08:00
Ashley Harrison
4a2695349d
Chore: more ts test fixes (#63438)
* replace anys in tests

* more test fixes

* clean up any's in tests
2023-02-23 10:07:44 +00:00
Ivana Huckova
a1c0feab7d
Loki: Remove comment (#63565)
Remove comment
2023-02-22 14:57:18 +01:00
Gareth Dawson
c5ed9391b6
Loki: Display error with label filter conflicts (#63109)
* feat: add logic to check for conflicting operator

* feat: display error if there is a conflict

* feat: check if label filter conflicts with other filters

* fix: remove capitalisation from "no data"

* test: add tests for isConflictingFilter function

* feat(labels): add validation for label matchers

* test(labels): add tests for isConflictingSelector

* refactor(labels): add suggestions from code review

* test(labels): add case for labels without op

* refactor(operations): add suggestions from code review

* feat(operations): display tooltip when you have conflicts

* fix: remove unused props from test

* fix: remove old test

* fix(labels): error message now displays in the correct location

* fix(operations): operations can be dragged, even with error

* fix: remove unused vars

* fix: failing tests

* fix(operations): hide error message whilst dragging

* refactor: use more appropriate variable naming

* refactor: add suggestions from code review

* perf: use array.some instead of array.find
2023-02-22 09:56:20 +00:00
Gábor Farkas
b069fd81b2
loki: query splitting: more robust check (#63542) 2023-02-22 09:16:05 +01:00
Gábor Farkas
8f7b980c95
Loki: query splitting: handle stats (#63436)
* loki: query splitting: handle stats

* update tests
2023-02-20 13:55:56 +00:00
Gábor Farkas
7a8f1ab566
loki: query splitting: stricter types (#63387) 2023-02-17 19:43:08 +01:00
Matias Chomicki
a0bea04a02
Range splitting: Read errors from the received response and report them (#63368) 2023-02-16 12:39:26 -05:00
Matias Chomicki
0240f4eb45
Loki Range Splitting: Create a new instance for the initial frame (#63361)
* Range splitting: create a new instance of the initial frame

* Chore: rename variable
2023-02-16 12:55:31 +01:00
Gábor Farkas
0ee9d11a91
loki: query splitting: better canceling (#63315)
loki: query splitting: better cancelling
2023-02-13 17:52:30 +01:00
Matias Chomicki
84fdb7f908
Loki Range Splitting: Calculate dynamic maxLines per target based on the current response state (#63248)
* Range splitting: update maxLines for logs queries

* Range splitting: add unit tests for dynamic limit requesting
2023-02-13 07:59:20 +01:00
Matias Chomicki
8cd3d1bfda
Loki Range splitting: Ignore hidden queries (#63250)
Range splitting: ignore hidden queries
2023-02-10 18:19:17 +01:00
Sven Grossmann
3f144924d1
Loki: Do not chunk when refid contains do-not-chunk (#63276)
add ref-id to not chunk requests
2023-02-10 18:00:49 +01:00
Sven Grossmann
0bd326d846
LogsVolume: Make log volume work with chunking (#63181)
* aggregate logs volume on streaming

* enable log volume queries to be split

* add streaming indicator

* added tests

* also chunk logs queries

* change extraInfo back to undefined
2023-02-10 14:43:41 +01:00
Sven Grossmann
00edc1c6b1
Loki Context UI: Do not disable last label (#62866)
* improved text

* prevent all labels removed

* use `structuredClone` instead of lodash

* update test

* get `structuredClone` in test?

* fix using structuredClone
2023-02-10 14:23:17 +01:00
Gábor Farkas
27d70819cc
loki: query splitting: split logs queries (#63091)
* loki: calculate logs-chunk-boundaries

* renamed function
2023-02-10 12:01:33 +01:00
Matias Chomicki
94241f6676
Loki Query Splitting: Split queries into sub-queries with smaller time interval (#62767)
* Range splitting: range splitting function

* Range splitting: experiment with 1 hour splits

* Range splitting: reorganize code

* Range splitting: improve code readability and meaning

* Range splitting: add partition limit to prevent infinite loops

* Range splitting: add error handling

* Range splitting: disable for logs queries

* Range splitting: support any arbitrary time splitting + respect original from/to in the partition

* Chore: remove console logs

* Chore: delete unused import

* Range splitting: actually send requests in sequence

* Range splitting: do not split when > 1 query

* Range splitting: combine frames

* Chore: rename function

* split in reverse

* polished reversing

* keep reference to the right frame in the result

* Range splitting: change request state to Streaming

* Range splitting: fix moving only 1 unit of time instead of the provided one

* Chore: change default parameter to timeShift = 1

* Range splitting: do not split for range queqries

* Range splitting: add initial support for log queries

* Range splitting: do not use MutableDataFrame

It has bad performance and it's not required

* Chore: remove unused export

* Query Splitting: move to module

* loki: split: fix off-by-one error (#62966)

loki: split: fix off-by-one loop

* Range splitting: disable for logs volume queries

* Range splitting: combine any number of fields, not just hardcoded 2

* Range splitting: optimize frame-combining function

* Range splitting: further optimize

* Range splitting: combine frame length

* Range splitting: combine stats

* Range splitting: combine stats without assuming the same order

* Query splitting: catch and raise errors

* Range splitting: create feature flag

* Range splitting: implement feature flag

* Range splitting: add unit test for datasource query

* Range splitting: add basic test for runPartitionedQuery

* Range splitting: add unit test for resultLimitReached

* Range splitting: test frame merging

* Chore: fix unit test

---------

Co-authored-by: Sven Grossmann <svennergr@gmail.com>
Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
2023-02-09 12:27:02 -05:00
Ashley Harrison
2a34293689
Chore: more type fixes (#62952)
* fix some more any/type assertions

* more any/type assertion fixes

* implement review comments
2023-02-09 09:03:13 +00:00
Gareth Dawson
ac942d5e72
Loki: Add placeholder to the loki query editor (#62773)
* fix: add placeholder to loki query editor

* fix: use original placeholder

* refactor: extract set placeholder into seperate function

* fix: use correct monaco types

* revert: unwanted change from merge
2023-02-06 15:38:19 +00:00
Matias Chomicki
57369915f5
Loki Query Editor: Make Monaco the default editor (#62247)
* feat(loki-editor): remove slate and make Monaco the default editor

* feat(loki-editor): remove unsupported usages of onBlur

* feat(loki-editor): remove monaco feature flag

* Chore: remove unused import
2023-02-06 11:18:01 +01:00
Gábor Farkas
48a374f50b
loki: implement schema for loki query (#62114)
* loki: implement schema for loki query

* removed forgotten code

* better types

* adjust cue-maturity-level

Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>

* sync docs to schema change

* removed forgotten go code

* updated schema docs

Co-authored-by: J Stickler <julie.stickler@grafana.com>

* updated schema docs

Co-authored-by: J Stickler <julie.stickler@grafana.com>

* update schema docs

Co-authored-by: J Stickler <julie.stickler@grafana.com>

* update schema docs

Co-authored-by: J Stickler <julie.stickler@grafana.com>

* updated schema docs

Co-authored-by: J Stickler <julie.stickler@grafana.com>

* updated schema docs

* add documentation to the resolution field

* move direction-field to schema

* loki: cue: moved deprecated fields to the bottom

---------

Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
Co-authored-by: J Stickler <julie.stickler@grafana.com>
2023-02-02 16:18:30 +00:00
Gareth Dawson
42f8f5a9ea
Loki: Fix label filter expression treating int as string (#62496)
* fix: label filter expression treats int as string

* refactor: labelFilterRenderer

* test: add tests to labelFilterRenderer

* refactor: use backticks based on the operator not the value

* test: labelFilterRenderer uses the correct value type based on the operator

* test: use it.every rather than having multiple repetitive tests
2023-02-01 14:13:08 +00:00
Sven Grossmann
d7026900bd
LokiContext: Add feature tracking (#62344)
* add feature tracking to LokiContextUi

* only depend on `row.uid`

Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>

---------

Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
2023-01-30 11:30:39 +01:00
Sven Grossmann
da7065d3dc
LokiContext: Fix wrong queries being run when reopened (#62353)
* fix wrong query being run when reopened

* fix typo

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>

* and test for `onClose`

* rename functions

---------

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
2023-01-30 09:26:27 +01:00
Gareth Dawson
b2c8126e6e
Loki: Show query size approximation (#62109)
* feat: make api request to /loki/api/v1/index/stats

* fix: add /index/stats to callResource valid urls

* feat: make call to getQueryStats when the query changes

* feat: render user tooltip displaying the estimated value for processed data

* fix: add new props to component tests

* test: add tests for query size estimation

* fix: disable error message on request failure

* refactor: add suggestions from code review

* refactor: only pass required query string
2023-01-27 17:32:53 +00:00
Ivana Huckova
d0e95f8c95
Loki: Add X-Query-Tags header for logs sample and data sample (#62333) 2023-01-27 16:41:40 +01:00
Sven Grossmann
7c02d9bb8a
Logs: Add experimental support to display a datasource custom UI in LogContext (#62189)
* add loki contextfilter component

* add `getLogRowContextUi` support to DataSourceAPI

* add `runContextQuery` to LogRowContextProvider

* pass `getRowContextUi` to `LogRowContext`

* adapt LogRowContext to show datasource ui

* implement LogRowContextUi in Loki

* add `logsContextDatasourceUi` feature flag

* change state to `Alpha`

* disable the feature if `logsContextDatasourceUi` is not set

* don't fetch labels in the constructor

* adjust to right height

* remove unnecessary eslint disable

* add test for LokiContextUi

* move code down in datasource.ts

* rename `refresh` to `runContextQuery`

* update datasource tests

* don't update if `updateFilter` fn changes

* organized imports in datasource.test.ts

* don't trigger on intialization changes

* change tag to `experimental`

* move `getLogRowContextUi` to props
2023-01-27 15:12:01 +01:00
Ivana Huckova
ea1fcbb866
Explore: Add feature to open log sample in split view (#62097)
* Add tests

* Implement split open to see logs functionality

* Fix imports in test

* Update packages/grafana-data/src/types/logs.ts

Co-authored-by: Matias Chomicki <matyax@gmail.com>

* Update packages/grafana-data/src/types/logs.ts

Co-authored-by: Matias Chomicki <matyax@gmail.com>

* Update default scneario to throw error

* Exit early in getSupplementaryQuery

* Update public/app/features/explore/LogsSamplePanel.tsx

Co-authored-by: Matias Chomicki <matyax@gmail.com>
2023-01-26 16:06:10 +01:00
Stephanie Hingtgen
0a1f31814a
Plugins: add UI for more supported datasources with secure socks proxy feature toggle (#61962) 2023-01-25 08:39:17 -07:00
Ivana Huckova
a0921f2e88
Explore: Implement logs sample in Explore (#61864)
* Implement log samples

* Explore: Implement logs sample panel

* Log samples: Add documentation

* Update docs

* Add info for log sample

* Fix label

* Update

* Default to true

* Fix copy in test

* Update public/app/features/explore/LogsSamplePanel.tsx

Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>

* Use timeZone from grafana/schema

* Rename data props to queryResponse

* Unify name to logs sample

* Remove redundant optional parameters in LogsSamplePanel

* Make intervalMs parameter optional in dataFrameToLogsModel and remove undefined argument when not needed

* Fix incorrect position of copy log line button

* Update public/app/core/logsModel.ts

Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>

Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
2023-01-24 19:10:27 +01:00
Ivana Huckova
c106c7700b
Explore: Create DataSourceWithSupplementaryQueriesSupport interface to support log volume and samples (#61298)
* Create DataSourceWithLogsSampleSupport check and move to 1 place

* Add new SupplementaryQueryType

* Add and change utility functions for loading, storing ancd checking supp queries

* Add logic to redux for processing of new type of supp query

* Implement queryLogsSample used to run samples queries

* Fix tests to include also Log samples

* Add tests

* Temporarily, default to false

* Change comment

* Fix lint error

* Refactor handling of supplementary queries in query.ts

* Fix looping over array

* Remove changes for any => unknowns as in utils.ts

* Fix logic

* Fix incorrect imports after function was moved to different file

* Migrate old log volume key

* Update public/app/features/explore/utils/supplementaryQueries.ts

Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com>

* Refactor to use DataSourceWithSupplementaryQueriesSupport

* Refactor, improve tests,  change internal API

* Update packages/grafana-data/src/types/logs.ts

Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com>

* Add deprecation for DataSourceWithLogsVolumeSupport, but still support it

* Update comment with correct new issue

Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com>
2023-01-20 14:20:49 +01:00
Matias Chomicki
89e77d072f
Loki Query Builder: Fix bug parsing range params (#61678)
feat(loki-query-builder): fix bug parsing range params
2023-01-18 15:54:18 +01:00
Sven Grossmann
6c566a391d
Loki: Use queries maxLines if configured, even if it is zero (#61652)
* user `query.maxLines` even if it is zero

* remove unnecessary comment
2023-01-18 10:14:42 +01:00
Gareth Dawson
54fd1b634f
Loki: Show configured log line limit (#61291)
* feat: show configured line limit

* test: correct failing test

* refactor: update variable names

* fix: ui renders the wrong value given a falsy value

* refactor: use nullish coalescing operator
2023-01-17 08:45:23 +00:00
Esteban Beltran
4454d5eb49
Build: Fix eslint in file (#61568) 2023-01-16 15:42:02 +00:00
Matias Chomicki
7e505ea49c
Loki Autocomplete: Suggest only possible labels for unwrap (#61411)
* feat(loki-autocomplete): filter valid labels for unwrap autocomplete suggestions

* refactor(unwrap): reuse new function in builder
2023-01-16 13:07:02 +01:00
Sven Grossmann
5fe23b4964
Loki: Track obfuscated query (#61325)
* obfuscate query

* also conver numbers and comments

* query obfuscation: simplify obfuscation and keep some identifiers

* Query obfuscation: replace placeholder string with node name

Co-authored-by: Matias Chomicki <matyax@gmail.com>
2023-01-13 16:16:47 +00:00
Gábor Farkas
ed88401a58
logs: json/logfmt-detection, simplify code (#61492)
* logs: json/logfmt: simplify code

* remove obsolete comment

Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>

Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
2023-01-13 14:33:18 +00:00
Sven Grossmann
b816538e09
Loki: Fix misaligned derived fields settings (#61475)
* fix loki datasource settings

* remove unnecessary spacing

* remove unused import
2023-01-13 14:25:03 +01:00
Piotr Jamróz
e8ef0395b1
Glue: Hide run queries button in Correlations Page (#61039)
* Hide run queries button in Correlations Page when showing Loki and Prometheus editors

* Use more semantic selectors

Co-authored-by: Giordano Ricci <me@giordanoricci.com>

* Use more semantic selectors

Co-authored-by: Giordano Ricci <me@giordanoricci.com>

* Post-merge fix (remove duplicate)

Co-authored-by: Giordano Ricci <me@giordanoricci.com>
2023-01-12 21:14:55 +01:00
Ivana Huckova
8bda8b8272
Log volume: Fix functionality if query has multiple comments (#61306)
* Log volume: Fix functionality if query has comments

* Add additional test
2023-01-11 16:21:02 +00:00
Matias Chomicki
ef9a71f483
Loki Autocomplete: Improve handling of trailing spaces in queries (#61184)
* Loki Autocomplete: improve handling of trailing spaces in the query

* Monaco Field: rename resizing handler function

* Fix typo

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
2023-01-10 14:38:22 +01:00
Gareth Dawson
114c8b64aa
Loki: Rename "explain" toggle to "explain query" (#61150)
* feat: rename explain toggle to explain query

* test: correct failing test for explain toggle

* docs: update documentation on explain query toggle

* fix: update capitalization
2023-01-10 12:35:12 +00:00
Sven Grossmann
5ad95a2952
Loki: Fix tracking of queries_with_changed_line_limit_count (#60091)
* change line limit tracking

* updated test
2023-01-09 09:54:57 +01:00
Gareth Dawson
93fe3faed5
Loki: Fix code editor not correctly responding to window resize (#61061)
* fix: code editor not correctly responding to window resize

* trigger build
2023-01-06 10:17:20 +00:00
Gareth Dawson
bd9cce2866
Loki: Add hints for query filters (#60293)
* add hint for label filter

* add hint for line filter

* add feature tracking for hints click

* fix failing tests

* add tests for new query builder hints

* update hint labels

* fix: hint continues to render after adding operation

* add missing title property to hints

* make use of isQueryWithParser and remove isQueryWithLogFmt

* refactor isQueryWithLabelFilter

* always render label operation, even if incomplete

* suggestion

* fix oversight in feature tracking name on hint click

* update query hint label

* improvements

* add missing test for ADD_NO_PIPELINE_ERROR
2023-01-05 13:56:31 +00:00
Stephanie Hingtgen
39b8d3a182
Plugins: add UI for secure socks proxy feature toggle (#60750) 2023-01-04 20:47:27 +05:30
Sven Grossmann
9f9bf4650d
Loki: Fix missing parameters on Query Builder operations (#60677)
* add missing mandatory params

* improve naming

* change let to const
2022-12-22 15:31:41 +01:00
Gareth Dawson
90185bea00
Loki: Change format of query builder hints (#60228)
* change format of query builder hints

* fix tests

* add hint property on query actions

* revert changes to prometheus hints

* respond to feedback

* fix failing tests

* trigger drone

Co-authored-by: Matias Chomicki <matyax@gmail.com>
2022-12-19 16:28:46 +00:00
Gareth Dawson
65f7b93e6b
Loki: Add format explanation to regex operations (#60518)
* change explain messages for regex operations

* update explain messages to use the more accurate RE2
2022-12-19 14:32:51 +00:00
Matias Chomicki
5dfa59884e
Loki Query Editor: Update history items with successive queries (#60327)
feat(loki-monaco-autocomplete): add support to update history with successive queries
2022-12-15 10:03:05 +01:00
Sven Grossmann
ae05c6180c
Loki/ES: Add further items to query tracking (#60347)
* add more tracking to queries from ES and Loki

* improve tracking elasticsearch

* update type assertion

* remove unused import
2022-12-15 09:59:50 +01:00
Matias Chomicki
4be99c56f6
Loki Query Editor: Autocompletion and suggestions improvements (unwrap, parser, extracted labels) (#59103)
* Chore: refactor test to improve internal categorization of scenarios

* feat(loki-monaco-unwrap): add unwrap situation support

* Chore: remove redundant path from aggregation situation

* feat(loki-monaco-unwrap): add unwrap suggestions

* feat(loki-monaco-autocomplete): rename IN_DURATION and add missing tests

* feat(loki-monaco-autocomplete): detect parser and line filter

* feat(loki-monaco-autocomplete): optionally suggest line filters and parsers

* feat(loki-monaco-autocomplete): improve suggestions and update completions tests

* feat(loki-monaco-autocomplete): allow for multiple line filters suggestions

* Chore: update situations test

* Chore: add test case for AFTER_UNWRAP completion

* feat(loki-monaco-autocomplete): use logs query instead of labels for data sample

* Chore: improve getParser function name and add tests

* Chore: update test mock data

* Update public/app/plugins/datasource/loki/components/monaco-query-field/monaco-completion-provider/situation.test.ts

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>

* feat(loki-monaco-autocomplete): improve after unwrap detection

* feat(loki-monaco-autocomplete): remove leftover parser detection

* Chore: completely remove parser suggestion exclusion implementation

It was correct to have more than one parser, so we don't need to exclude parsers if one is present.

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
2022-12-14 11:37:08 -05:00
Matias Chomicki
2c1b65021d
feat(loki-query-autocomplete): suggest unique history items (#60262) 2022-12-14 07:43:06 -05:00
Matias Chomicki
58a41af3f3
Loki Query Editor: Add support to display query parsing errors to users (#59427)
* feat(loki-query-validation): validation proof of concept

* feat(loki-query-validation): refactor and properly display the error portion

* feat(loki-query-validation): add support for multi-line queries

* feat(loki-query-validation): improve display of linting errors to users

* feat(loki-query-validation): add unit tests

* Chore: remove unused import

* wip

* Revert "wip"

This reverts commit 44896f7fa2d33251033f8c37776f4d6f2f43787d.

* Revert "Revert "wip""

This reverts commit f7889f49a6b0bdc5a4b677e9bbb8c62ea3cccb74.

* feat(loki-query-validation): parse original and interpolated query for better validation feedback

* feat(loki-query-validation): refactor interpolated query validation support

* feat(loki-query-validation): improve validation for interpolated queries
2022-12-13 12:07:59 -05:00
Gareth Dawson
1b1f2475c2
Loki: Set custom width for modals in the loki query editor (#59714)
* set custom width for modals in the loki query editor

* convert unit from px to vw

* add media query for smaller devices

* use theme breakpoints instead of @media
2022-12-13 11:09:30 +00:00
Sven Grossmann
8356df081d
Loki/Prometheus: Fix wrong queries executed in split view (#60172)
* add context to monaco editors
2022-12-12 17:50:00 +01:00
Gareth Dawson
22736cc93b
Loki: Update feature tracking for label browser (#59295)
* update feature tracking names

* track when label browser is opened

* remove old feature tracking

* report interaction on modal close

* update

* fix type error

* revert changes to modal

* revert changes to modal

* remove close method from report interaction

* remove close type for grafana_loki_log_browser_closed

* nit pick

* add closeType to grafana_loki_label_browser_closed
2022-12-12 15:35:29 +00:00
Ivana Huckova
3c9ccd4512
Loki: Usage for queries not from dashboards (#60017)
Loki: Usage for queries not from dashboars
2022-12-08 13:04:05 +01:00
Ivana Huckova
601df109af
Loki: Remove annotation, context and volume tracking (#59962)
* Loki: Remove annotation and context tracking

* Implement log volume
2022-12-08 10:05:11 +01:00
Ivana Huckova
1aa94165d9
Loki: Do not track samples (#59960) 2022-12-07 16:24:22 +01:00
Sven Grossmann
d0eeff2fa0
Loki: Add tracking of executed queries (#59887)
* add query tracking

* add app

* add comment

* use `reportInteraction` not `console.log`

* add test to `queryUtils`

* organize imports

* add datasource tests

* change `metrics` to `metric`

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>

* change `parseToArray` to `parseToNodeNamesArray`

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
2022-12-06 15:54:20 -05:00
Ivana Huckova
fdc3adb2c9
Loki: Add tracking for on dashboard load (#59914)
Loki: Add on dashboard load tracking
2022-12-06 21:15:55 +01:00
Sven Grossmann
932349b5ab
Loki: Fix wrongly escaped label values when using LabelFilter (#59812)
* change backticks to quotes

* add unescaping to `addFilterAsLabelFilter`

* fix removal of wrong quotes

* change unescape order
2022-12-06 12:30:03 +01:00
Ida Štambuk
3544250baf
Accessibility: Make QueryEditorHelp examples keyboard interactive (#59355)
* Cloudwatch: A11y - Make example log keyboard interactive

* Change all cheat sheets to buttons

* Make suggestions block
2022-12-05 16:03:24 +01:00
Gareth Dawson
6b5ebf2b4b
Loki: Add improvements to loki label browser (#59387)
* improvements

* refactor label browser modal

* feat(label-browser-modal): fetch labels on modal open

* apply suggestions

* check for log labels after languageProvider start

Co-authored-by: Matias Chomicki <matyax@gmail.com>
2022-11-29 14:07:34 +00:00
Ivana Huckova
28c390bc90
Loki: Fix adhoc parsing if multiple stream selectors and some empty (#58658) 2022-11-25 14:00:48 +01:00
Matias Chomicki
ff87a2641f
Loki Variable Query Editor: Improve stream selector tooltip text (#59311)
* feat(loki-variable-query-editor): improve stream selector tooltip text

* Chore: improve sample stream selector

* Chore: update sample stream selector in tooltip

* Chore: add example of interpolated stream selector
2022-11-24 11:41:02 -05:00
renovate[bot]
e84a01e870
Update jest monorepo to v29 (#58261)
* Update jest monorepo to v29

* update snapshots + wrap test in act

* fix linting errors: jest.mocked now defaults to deep mocking

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
2022-11-24 14:00:41 +00:00
Gareth Dawson
a098bdef58
Loki: Make label browser accessible in query builder (#58525)
* add label browser button to query editor header

* add dynamic button label text

* add LabelBrowserModal.tsx

* toggle label browser modal on click

* pass required props to LabelBrowserModal

* add placeholder to text input

* render label browser inside of the modal

* change button based on label status

* remove label browser button from code mode

* fix element overlap in label browser

* fix undefined app in feature tracking

* remove all any types

* add tests for label browser button

* update modal component width

* update label loading function

* add tests to LabelBrowserModal

* fix broken mock datasource

* update test names

* use stack component for button spacing

* revert modal width

* update label search placeholder

* remove unused import

* add test assertion for closed modal

* remove redundant if statement

* remove unnecessary code

* update error message and fix position

* fix input placeholder text
2022-11-23 16:48:41 +00:00
Gareth Dawson
94372f5f23
Loki: Remove raw query toggle (#59125)
* set default query expression

* always show raw query

* remove raw query title

* remove test for raw query toggle

* remove raw query toggle

* remove default expression

* hide raw query preview if empty

* remove e2e test for raw query toggle

* update test name
2022-11-23 16:07:59 +00:00
Ryan McKinley
d33939da55
DataSourceWithBackend: Add plugin id to the request headers (#58082) 2022-11-14 19:35:50 -05:00
Gareth Dawson
966b47c2ef
Loki: Rename log browser to label browser (#58416)
* rename loki log browser to label browser

* rename loki log browser to label browser
2022-11-09 09:57:05 +00:00
Matias Chomicki
25f79ef2b9
Loki: enable Monaco Query Editor by default (#58080)
* feat(loki-monaco-editor): update tests

* chore(loki): use unified datasource mock function in tests

* chore: enable monaco feature flag in tests

* feat(loki-monaco-editor): add test case for disabled feature

* feat(loki-monaco-editor): enable by default

* Revert "feat(loki-monaco-editor): enable by default"

This reverts commit 08904f94a707a4fa32aa1e7f3f0de377575a7636.

* feat(loki-monaco-editor): enable from registry

* feat(loki-monaco-editor): make feature flag frontend only
2022-11-08 10:22:40 -05:00
Gareth Dawson
2027f4702c
Loki: Add case insensitive line contains operation (#58177)
* add line-contains-case-insensitive operation definition

* add loki operation id for line-contains-case-insensitive

* make query case-insensitive when using line filter

* remove console log from operationUtils.ts

* add line-does-not-contain-case-insensitive operation definition

* add loki operation id for line-does-not-contain-case-insensitive

* make query case insensitive when using line-does-not-contain-case-insensitive

* update title and min-width for line-contains-case-insensitive

* add caseInsensitive optional parameter

* toggle case insensitive on operations

* remove console log

* update operation names

* add test coverage

* update to implement suggestions

* add suggestion
2022-11-07 17:01:06 +00:00
Matias Chomicki
17cce38545
Loki Monaco Editor: implement extracted label keys (#57368)
* feat(loki-monaco-editor): implement extracted label keys

* Chore: add missing responseUtils tests

* feat(loki-monaco-editor): suggest extracted labels

* Chore: fix test case name

* feat(loki-monaco-editor): dont suggest labels in logs query

* Chore: remove console log

* Chore: remove extracted keyword from suggested label

* feat(loki-monaco-editor): do not suggest duplicated labels

* refactor(loki-monaco-editor): pass query and offset to the completions resolver

* Revert "refactor(loki-monaco-editor): pass query and offset to the completions resolver"

This reverts commit d39464fd1a4624d5cd5420156dd2d1e2dad2eecf.

* refactor(loki-monaco-editor): refactor label completions for grouping

* Chore: remove obsolete function
2022-11-07 11:45:07 -05:00
Sven Grossmann
4b1ddba0a8
fixed explain handlers for label- and lineformat (#58135) 2022-11-03 14:57:29 +01:00
Matias Chomicki
c8689fd591
Loki Monaco Editor: grab operator documentation from the operations module (#57525)
* feat(loki-operations): add method to resolve operation docs

* feat(loki-operations): read operation and strip markdown links

* feat(loki-monaco-editor): read parser docs from operations

* feat(loki-monaco-editor): grab docs for more operations

* Chore: update completions test

* Chore: add tests for the operations module

* Chore: fix typo

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>

* Chore: fix typo

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
2022-10-26 15:44:44 +02:00
Virginia Cepeda
9eae793b5d
Alerting: Remove the alert manager selection from the data source configuration (#57369)
* Remove alertmanager dropdown from datasource config

* Avoid sending alertmanagers from loki/prom config editors

* Add test

* Remove unneeded param
2022-10-25 10:53:20 -03:00
Zoltán Bedi
c0b778134e
Revert: Query editor components from grafana-ui (#57436)
* Revert: QueryEditor components from grafana-ui

* Use local version of experimental

* Use experimental for query editor components

* Fix type issues in MSSQL

* point to actual version of experimental package

* point to latest version of experimental

Co-authored-by: Erik Sundell <erik.sundell87@gmail.com>
2022-10-24 17:12:36 +02:00
Ivana Huckova
3d7439d97d
Loki: Fix input history (#57344) 2022-10-24 16:27:56 +02:00
Ivana Huckova
ef78f03a6f
Loki: Fix the name of exported component from LokiQueryEditor.tsx (#57340)
* Loki: Fix editor

* Fix names
2022-10-20 14:49:55 +02:00
Ivana Huckova
3ee450e66b
Loki: Remove unused query editors (#57192)
* Loki: Remove not used query editors

* Move Loki editor to components and rename

* Update public/app/plugins/datasource/loki/components/LokiQueryEditorByApp.test.tsx

Co-authored-by: Matias Chomicki <matyax@gmail.com>

* Fix test

Co-authored-by: Matias Chomicki <matyax@gmail.com>
2022-10-20 11:46:48 +02:00
Ivana Huckova
7928f170ce
Loki: Fix adding of adhoc filters to stream selector when query with empty stream selector (#57280)
* disable double stringify

* Refactor test for addLabelToQuery

* Add tests (TDD for expected behaviour)

* Fix adding ad hoc filters to correct place when no stream selector

* Update

* Update comment

* Fix getAllPositionsInNodeByType

Co-authored-by: Sven Grossmann <svennergr@gmail.com>
2022-10-19 17:24:00 +02:00
Matias Chomicki
93f39b5178
Loki Monaco Editor: add missing documentation and new autocompletion type (#57186)
* feat(loki-monaco-editor): add documentation and pipe operators

- Added documentation for line filters
- Added documentation for parsers
- Improved parser suggestions
- Introduced new PIPE_OPERATION category
- Added missing label_format pipe operation

* feat(loki-monaco-editor): update tests

* Chore: remove unused completion type

* Chore: remove line format
2022-10-19 10:30:44 -04:00
Ivana Huckova
b4a03d0cff
Loki: Fix explain section about $__interval variable (#57188)
* Loki: Update  explain section

* Update

* Update public/app/plugins/datasource/loki/querybuilder/operationUtils.ts

Co-authored-by: Matias Chomicki <matyax@gmail.com>

Co-authored-by: Matias Chomicki <matyax@gmail.com>
2022-10-19 12:01:29 +02:00
Ivana Huckova
b997bc4200
Loki: Remove already selected options from next label filter options in builder (#57187)
* Loki: Filter out duplicated options in loki query builder label name options

* Update test
2022-10-19 11:32:01 +02:00
Matias Chomicki
d2abcbe4a5
feat(loki-monaco-editor): improve line filter suggestions (#57103) 2022-10-18 12:40:12 +02:00
Matias Chomicki
08ffcfdf16
feat(loki-monaco-editor): escape autocompleted label values (#56890) 2022-10-14 08:29:03 +00:00
Matias Chomicki
6a74cd207a
feat(loki-monaco-editor): add support for in_aggregation situation (#56680) 2022-10-11 15:52:57 +00:00
Gareth Dawson
fa09aef4ba
Loki: Add tests for NestedQuery.tsx (#56538)
* WIP: Testing the NestedQuery component

* Add tests for NestedQuery.jsx

* Add aria-labels to select elements

* Update aria-labels

* Create datasource using createLokiDatasource()
2022-10-11 09:22:32 +01:00
Matias Chomicki
1b7e31cd27
Loki Monaco Editor: add component tests (#56658)
* feat(loki-monaco-editor): add component tests

* feat(loki-monaco-editor): rename test case

* Chore: add missing export
2022-10-11 04:15:48 -04:00
Sven Grossmann
62674604b4
Loki: Escape label-values in context queries (#56614) 2022-10-10 14:31:19 +02:00
Ivana Huckova
a4c5801440
Loki: Fix redundant escaping in adhoc filter with regex match (#56447)
* Loki: Fix redundant escaping in adhoc filter with regex match

* Update data.js

* Simplify test

* Simplify test

* Update

* Add more tests
2022-10-07 16:21:59 +02:00
Matias Chomicki
729ce8bb72
Loki: query editor using Monaco (#55391)
* loki: switch to a monaco-based query field, step 1 (#46291)

* loki: use monaco-logql (#46318)

* loki: use monaco-logql

* updated monaco-logql

* fix all the tests (#46327)

* loki: recommend parser (#46362)

* loki: recommend parser

* additional improvements

* more improvements

* type and lint fixes

* more improvements

* trigger autocomplete on focus

* rename

* loki: more smart features (#46414)

* loki: more smart features

* loki: updated syntax-highlight version

* better explanation (#46443)

* better explanation

* improved help-text

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>

* Fix label

* feat(loki-monaco-editor): add monaco-logql as a dependency

* feat(loki-monaco-editor): add back range function removed during merge

* feat(loki-monaco-editor): sync imports with recent changes

* feat(loki-monaco-editor): add missing lang provider functions

* feat(loki-monaco-editor): fix imports

* feat(loki-monaco-editor): display monaco editor by default

Temporarily

* Chore: remove commented code

* Chore: minor refactor to NeverCaseError

* Chore: minor code cleanups

* feat(loki-monaco-editor): add history implementation

Will see how it behaves and base the history slicing on tangible feedback

* feat(loki-monaco-editor): turn completion data provider into a class

* Chore: fix missing imports

* feat(loki-monaco-editor): refactor data provider methods

Move complexity scattered everywhere to the provider

* Chore: clean up redundant code

* Chore: minor comments cleanup

* Chore: simplify override services

* Chore: rename callback

* feat(loki-monaco-editor): use query hints implementation to parse expression

* feat(loki-monaco-editor): improve function name

* Chore: remove superfluous variable in favor of destructuring

* Chore: remove unused imports

* Chore: make method async

* feat(loki-monaco-editor): fix deprecations and errors in situation

* feat(loki-monaco-editor): comment failing test case

* Chore: remove comment from test

* Chore: remove duplicated completion item

* Chore: fix linting issues

* Chore: update language provider test

* Chore: update datasource test

* feat(loki-monaco-editor): create feature flag

* feat(loki-monaco-editor): place the editor under a feature flag

* Chore: add completion unit test

* Chore: add completion data provider test

* Chore: remove unwanted export

* Chore: remove unused export

* Chore(loki-query-field): destructure all props

* chore(loki-completions): remove odd string

* fix(loki-completions): remove rate_interval

Not supported

* fix(loki-completions): remove line filters for after pipe case

We shouldn't offer line filters if we are after first pipe.

* refactor(loki-datasource): update default parameter

* fix(loki-syntax): remove outdated documentation

* Update capitalization in pkg/services/featuremgmt/registry.go

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>

* refactor(situation): use node types instead of names

* Chore: comment line filters pending implementation

It's breaking the build due to a linting error.

* Chore: update feature flag test after capitalization change

* Revert "fix(loki-completions): remove line filters for after pipe case"

This reverts commit 3d003ca4bc.

* Revert "Chore: comment line filters pending implementation"

This reverts commit 84bfe76a6a.

Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
Co-authored-by: Ivana Huckova <ivana.huckova@gmail.com>
2022-10-06 10:35:30 -04:00
Sven Grossmann
0d8ea2bb34
LogContext: Fix scroll position in upper context group (#56370)
* fix log row being falsely added to context

* do not add to many lines

* fix scroll position in context

* more flexible id comparison

* add original refid to context query

* added missing row comparison

* updated comment

Co-authored-by: Matias Chomicki <matyax@gmail.com>

Co-authored-by: Matias Chomicki <matyax@gmail.com>
2022-10-05 16:26:22 +02:00
Ivana Huckova
4469572b27
Loki: Add support for range aggregations with by grouping (#56184)
* Loki: Fix unwrapped range operations with grouping

* Update, fix tests

* Fix modeller
2022-10-05 11:32:33 +02:00
George Rodrigues
8950d86141
fix: some typos (#56171) 2022-10-04 18:43:49 -05:00
Gareth Dawson
05e958f689
Loki: Add tests for LokiOptionFields.tsx (#56183)
* WIP: Added tests to LokiOptionFields.test.tsx

* chore(loki-option-fields): fix error with `userEvent`

Using `fireEvent` prevents the running condition.

* Add tests for LokiOptionFields.tsx

* chore: remove unwanted comments

* chore: update test names

Co-authored-by: Matias Chomicki <matyax@gmail.com>
2022-10-03 15:56:30 +01:00
Gábor Farkas
d2601003cf
Logs: move logs-functions from grafana-data to grafana-main (#55457)
* logs: move utils from grafana-data to grafana

* logs: adjust imports

* updated betterer checksum file
2022-09-30 12:16:47 +02:00
Ivana Huckova
b39d629142
Loki: Show invalid fields in label filter (#55751)
* Loki: Show invalid fields in Label filter

* Update

* Update comment

* Update comment
2022-09-29 13:32:01 +02:00
Ivana Huckova
21a99fba7e
Loki/Prometheus: Fix adding of ad hoc filters when jumping from dashboard to explore (#55915)
* Loki, Prometheus: Fix adding of ad hoc filters when jumping from dashbaord to explore

* Update
2022-09-29 11:17:41 +02:00
Ivana Huckova
5bd65db8a8
Loki: Add new range operation range_counter (#55936)
* Loki: Add new range operation range_counter

* Update yarn.lock
2022-09-28 18:36:36 +02:00
GitStart
ac875a1329
Loki: Remove any from public/app/plugins/datasource/loki/live_streams.test.ts (#55545)
Co-authored-by: gitstart <gitstart@gitstart.com>
Co-authored-by: gitstart <gitstart@users.noreply.github.com>
Co-authored-by: Matheus Benini Ferreira <88898100+MatheusBeniniF@users.noreply.github.com>
Co-authored-by: Nitesh Singh <nitesh.singh@gitstart.dev>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>
Co-authored-by: Rafael Toledo <87545086+Toledodev@users.noreply.github.com>
Co-authored-by: Murilo Amaral <87545137+MuriloAmarals@users.noreply.github.com>
Co-authored-by: Rubens Rafael <70234898+RubensRafael@users.noreply.github.com>
Co-authored-by: Júlio Piubello da Silva Cabral <julio.piubello@gitstart.dev>

Co-authored-by: gitstart <gitstart@users.noreply.github.com>
Co-authored-by: gitstart <gitstart@gitstart.com>
Co-authored-by: Matheus Benini Ferreira <88898100+MatheusBeniniF@users.noreply.github.com>
Co-authored-by: Nitesh Singh <nitesh.singh@gitstart.dev>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>
Co-authored-by: Rafael Toledo <87545086+Toledodev@users.noreply.github.com>
Co-authored-by: Murilo Amaral <87545137+MuriloAmarals@users.noreply.github.com>
Co-authored-by: Rubens Rafael <70234898+RubensRafael@users.noreply.github.com>
Co-authored-by: Júlio Piubello da Silva Cabral <julio.piubello@gitstart.dev>
2022-09-26 16:42:53 +02:00