Skip to content

Commit

Permalink
feat: add getMetricValueByName function
Browse files Browse the repository at this point in the history
Retrieves last metric value based off of the name provided
  • Loading branch information
ZuperZee committed Nov 6, 2020
1 parent 7b2178d commit 0eeee2c
Show file tree
Hide file tree
Showing 12 changed files with 434 additions and 76 deletions.
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"editor.formatOnSave": true,
"files.exclude": {
"**/node_modules/*": true
}
},
"cSpell.words": [
"grafana"
]
}
6 changes: 2 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# Changelog for component-template
# Changelog for grafana-metric

## v0.0.0 (YYYY/MM/DD)

### Breaking changes

### Features / enhancements

### Bug fixes
- Add getMetricValueByName which retrieves last metric value based off of the name provided.
23 changes: 6 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
# Component name
# HTMLGraphics metric

A short description of the component

E.g. This component adds two numbers together.
It also has a variable and function that returns "something".
Retrieves metric value from Grafana's [data interface](https://grafana.com/docs/grafana/latest/packages_api/data/paneldata/).

## Usage

Description/example on how to use the component.

### add

```ts
import { add } from "@gapit/component-template";

add(2, 3); // Returns 5
```
### getMetricValueByName

### SOMETHING_VARIABLE
Retrieves last metric value based off of the name provided.

```ts
import { SOMETHING_VARIABLE } from "@gapit/component-template";
import { getMetricValueByName } from "@gapit/grafana-metric";

console.log(SOMETHING_VARIABLE); // Returns "something
getMetricValueByName("metric-name"); // Returns metric value
```
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
roots: ["<rootDir>/src", "<rootDir>/test"],
roots: ["<rootDir>/src"],
testMatch: ["**/__tests__/**/*.+(ts|js)", "**/?(*.)+(spec|test).+(ts|js)"],
transform: {
"^.+\\.(ts)$": "ts-jest",
Expand Down
Loading

0 comments on commit 0eeee2c

Please sign in to comment.