Skip to content

Commit 7cb3f29

Browse files
Feat: Add annotations query support (#46)
1 parent 11c41a4 commit 7cb3f29

13 files changed

Lines changed: 1433 additions & 17 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ Asset, Run, and Channel queries are cached to speed up regular expression querie
8686

8787
Both caches may be cleared for a panel by clicking the "Clear cache" button next to the Query Mode selector.
8888

89+
#### Annotations
90+
91+
Annotations are supported and enable querying Sift Annotations or using regular Sift data queries to visualize data, such as enum state changes, as annotations.
92+
8993
## Learn More
9094

9195
- [Sift](https://www.siftstack.com/)

jest.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
// generally used by snapshots, but can affect specific tests
33
process.env.TZ = 'UTC';
44

5+
const { grafanaESModules, nodeModulesToTransform } = require('./.config/jest/utils');
6+
57
module.exports = {
68
// Jest configuration provided by Grafana scaffolding
79
...require('./.config/jest.config'),
810
// Increase default timeout for all tests to 15 seconds
911
testTimeout: 15000,
12+
// Add nanoid and leven to the list of ES modules to transform
13+
transformIgnorePatterns: [nodeModulesToTransform([...grafanaESModules, 'nanoid', 'leven'])],
1014
};

pkg/plugin/celUtils/cel_utils.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,16 @@ func GreaterThan(field string, value float64) string {
8686
return fmt.Sprintf("%s > %v", field, value)
8787
}
8888

89+
// GreaterThanOrEqual generates a CEL expression that checks whether a field is greater than or equal to a given string value.
90+
func GreaterThanOrEqual(field string, value string) string {
91+
return fmt.Sprintf(`%s >= %s`, field, value)
92+
}
93+
94+
// LessThanOrEqual generates a CEL expression that checks whether a field is less than or equal to a given string value.
95+
func LessThanOrEqual(field string, value string) string {
96+
return fmt.Sprintf(`%s <= %s`, field, value)
97+
}
98+
8999
// Contains generates a CEL expression that checks whether a string field contains a given value.
90100
func Contains(field, value string) string {
91101
return fmt.Sprintf(`%s.contains('%s')`, field, value)

0 commit comments

Comments
 (0)