* WIP
* Refactor, plus update source of error in response_parser
* Adjust test
* Use methods and httpclient from errorsource
* Update pkg/tsdb/elasticsearch/data_query.go
Co-authored-by: Scott Lepper <scott.lepper@gmail.com>
* Return nil error
* Fix test
* Fix integration test
---------
Co-authored-by: Scott Lepper <scott.lepper@gmail.com>
* Elasticsearch: Add tracing do data source
* Fix tests
* Address feedback
* Update pkg/tsdb/elasticsearch/response_parser.go
Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
* Update pkg/tsdb/elasticsearch/response_parser.go
Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
* Track error across both spans
* Add span for decoding of response
* Fix test
* Update setting of errors + fix test
---------
Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
* Elasticsearch: Adjust naming in logging according to convention
* Log response parsing per response
* Update
* Fix logging of errors when no response
* Add path to error loggigng
* Update pkg/tsdb/elasticsearch/response_parser.go
* add `id` field to elasticsearch
* add comment
* slightly better perf
* only add `id` to logs frames
* only add `id` for logs responses
* concat `index` and `id`
* change snapshot generation to false
* use better loop
* fix tests
* moved up
* Elasticsearch: Fix passing of limit and datalinks to logs data frame
* Update public/app/core/logsModel.ts
Co-authored-by: François Massot <francois.massot@gmail.com>
---------
Co-authored-by: François Massot <francois.massot@gmail.com>
* Elasticsearch: Fix parsing of invalid time
* Fix lint
* Add more test data to data.js
* Add tests
* Fix lint
* Update pkg/tsdb/elasticsearch/client/search_request.go
* Elasticsearch: Fix processing of percentiles on backend
* Remove redundant logic as we do this in addMetricValue
* Refactor for less cyclomatic complexity
* Remove changes in createFieldsFromPropKeys
* Elasticsearch: Add highlight for logs
* Fix running of queries trough backend only when shouldRunTroughBackend
* Fix incorrect json in test string
* Address feedback
* Keep order of words same
* Elasticsearch: Use displayName field for naming
* Change solution to frame.Name to be backward compatible
* Fix snapshot tests
* Use Time and Value for time and value fields
* Use variables from grafana-plugin-sdk-go for name
* Elasticsearch: Add processing of logs query to backend
* Add and fix tests
* Add snapshot tests
* Fix test in ES client
* Small updates, remove redundant logic
* Refactor setPreferredVisType to improve readability
* WIP
* WIP
* Refactor
* Add tests
* Cleanup
* Fix whitespace
* Fix test and lint
* In snapshot tests update counter to be number
* Add boolean value for snapshot testing
* Update pkg/tsdb/elasticsearch/response_parser.go
Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
* Update pkg/tsdb/elasticsearch/response_parser.go
Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
* Use generic to reuse logic when creating fields
* Use nullable fields
* Fix lint
* WIP (#63272)
wip
* Fix snapshot test after we changed field types to nullable
---------
Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
Look for 'caused_by.reason' in ES error response
When the ES response does not contain `reason` or `root_cause[0].reason`
is empty, there is no information for the user to know what is going
wrong.
An example of the error message after this change:
```
Failed to evaluate queries and expressions: failed to execute query A: Trying to create too many buckets. Must be less than or equal to: [65536] but this number of buckets was exceeded. This limit can be set by changing the [search.max_buckets] cluster level setting.
```
Related to https://github.com/grafana/grafana/issues/61246
* Elasticsearch: Fix calculation of trimEdges
When a value of trimEdges is set greater than 1 we need to drop both the
first and last sample of the data from the response.
* Elasticsearch: Fix reading trimEdges from the query settings
Currently the trimEdges property in the JSON panel is stored as a string
and not directly as a number.
This caused that the reading of the value failed in the go backend
because the simplejson.Int() method doesn't properly handle this case.
This failure when decoding the value goes unnoticed because of the early
return causing the trimEdges configuration to be ignored.
* Refactor castToInt to also return an error
Add a new test case that sets the `trimEdges` property as a quoted
number.
Refactor usage of legacy data contracts. Moves legacy data contracts
to pkg/tsdb/legacydata package.
Refactor pkg/expr to be a proper service/dependency that can be provided
to wire to remove some unneeded dependencies to SSE in ngalert and other places.
Refactor pkg/expr to not use the legacydata,RequestHandler and use
backend.QueryDataHandler instead.
* Migrate Elasticsearch to backend plugin SDK
* Fix linting
* Move away from Convey!
* Rebase commit
* Small logger fix
* Fixes according to reviewer's comments
* Fixes according to reviewer's comments
* Fixes according to reviewer's comments
* More cleanup
* Move things around - small refactoring
* Fix typo
* Update calculator - add tests
* Fixes according to reviewer's comments
* Revert "Revert "Elasticsearch: add frozen indices search support (#27472)" (#27726)"
This reverts commit 4c7131425b.
* Make label width a bit more consistent
* Add documentation for X-Pack & Frozen Indices support in Elasticsearch
* Change UI & docs casing
* create default empty dataframe
* Remove backticks and simplify regex
* small doc improvement
* Rebase (broken tests)
* Removed tables - refactored processAggregationDocs func
* Tests cleanup
* Nit - add space in percentile legend titles
* Fix labels naming - use metricAggType map
* Fix bug which appended same fields over and over again
* Replace test with dataframes
* Fix tests
* Add nolint:gocyclo - will need refactoring
* Move frames tags assignment
* Add failing test fo when ES server is booting up
* Revert "Add failing test fo when ES server is booting up"
This reverts commit fd14a1fd5e.
Co-authored-by: Elfo404 <me@giordanoricci.com>