Skip to content

Commit

Permalink
feat: Add grafana importer (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
yufeiminds authored Jun 8, 2023
1 parent 0f15041 commit f49e1f3
Show file tree
Hide file tree
Showing 114 changed files with 34,800 additions and 421 deletions.
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE/proposal.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Proposal [Number]: [Proposal Name]

* Proposal: [Preview Link]()
* Has Proof of Concept: (Yes/No)
- Proposal: [Preview Link]()
- Has Proof of Concept: (Yes/No)
16 changes: 15 additions & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: 1.18
go-version: 1.19
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
Expand All @@ -43,3 +43,17 @@ jobs:

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.19
- name: Run Unit Test
run: ./hack/make -v test:unit
# - run: curl -SsL https://downloads.gauge.org/stable | sh -s -- --location=/usr/local/bin
# - name: Run Acceptance Test
# run: ./hack/make -v test:acc
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ coverage.txt
# vendor/

# Output file
# Docs
.build/
out/

# VS Code extension
*.vsix

Expand All @@ -31,7 +32,7 @@ rl.sh
dist/
test.output
tmp/
internal/testing/specs/*.spec
internal/testing/specs/

# Local Netlify folder
.netlify
Expand All @@ -40,3 +41,6 @@ internal/testing/specs/*.spec
.vscode/
.idea/
*.swp

# Config with credentials
datakit.conf
1 change: 1 addition & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# disable line-length
MD013: false
MD033: false
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
specs

*.go
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ A command-line tool to help users interact with Guance Cloud.

## Features

| Topic | Feature | Proposals | User Specification | Related Projects |
| -------------------------------------- | ----------------- |-----------------------------------------------------------| ---------------------------------------- | ------------------------------------------------------------ |
| 🔧 _Command-line Interface_ | **Core** | [A001](./proposals/A001-guance-cli-overview.md) | [View](specs/guance.spec.md) | This repository |
| 🚅 _Resource Exporter_ | **Console** | WIP | [View](specs/iac/import/console.spec.md) | [![terraform-guance-dashboard](https://img.shields.io/badge/guance-terraform--guance--dashboard-blue?style=flat-square&logo=github)](https://github.com/GuanceCloud/terraform-guance-dashboard)<br/>[![terraform-guance-monitor](https://img.shields.io/badge/guance-terraform--guance--monitor-blue?style=flat-square&logo=github)](https://github.com/GuanceCloud/terraform-guance-monitor) |
| | **Grafana** | [C002](./proposals/C002-importer-grafana.md) | [View](specs/iac/import/grafana.spec.md) | [![json-model](https://img.shields.io/badge/guance-json--model-blue?style=flat-square&logo=github)](https://github.com/GuanceCloud/json-model) |
| 🚀 _Continuation Integration / Testing_ | **JMeter** | [C001](./proposals/C001-continuous-integration-jmeter.md) | WIP | [![jmeter](https://img.shields.io/badge/apache-jmeter-blue?style=flat-square&logo=github)](https://github.com/apache/jmeter) |
| | **JUnit** | WIP | WIP | [![junit](https://img.shields.io/badge/junit--team-junit5-blue?style=flat-square&logo=github)](https://github.com/junit-team/junit5) |
| 📦 *Components Installer* | **DataKit** | WIP | WIP | [![DataKit](https://img.shields.io/badge/guance-DataKit-blue?style=flat-square&logo=github)](https://github.com/GuanceCloud/DataKit) |
| | **SCheck** | WIP | WIP | [![SCheck](https://img.shields.io/badge/guance-SCheck-blue?style=flat-square&logo=github)](https://github.com/GuanceCloud/SCheck) |
| 🔭 _Ecosystem Integration_ | **GitHub Action** | - | WIP | [![setup-guance](https://img.shields.io/badge/guance-setup--guance-blue?style=flat-square&logo=github)](https://github.com/GuanceCloud/setup-guance) |
| | **DevContainer** | - | WIP | WIP |
| Topic | Feature | Proposals | User Specification | Related Projects |
| --------------------------------------- | ----------------- | --------------------------------------------------------- | ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 🔧 _Command-line Interface_ | **Core** | [A001](./proposals/A001-guance-cli-overview.md) | [View](specs/guance.spec.md) | - |
| 🚅 _Resource Exporter_ | **Console** | - | [View](specs/iac/import/console/console.spec.md) | [![terraform-guance-dashboard](https://img.shields.io/badge/guance-terraform--guance--dashboard-blue?style=flat-square&logo=github)](https://github.com/GuanceCloud/terraform-guance-dashboard)<br/>[![terraform-guance-monitor](https://img.shields.io/badge/guance-terraform--guance--monitor-blue?style=flat-square&logo=github)](https://github.com/GuanceCloud/terraform-guance-monitor) |
| | **Grafana** | [C002](./proposals/C002-importer-grafana.md) | [View](specs/iac/import/grafana/grafana.spec.md) | [![json-model](https://img.shields.io/badge/guance-json--model-blue?style=flat-square&logo=github)](https://github.com/GuanceCloud/json-model) |
| 🚀 _Continuation Integration / Testing_ | **JMeter** | [C001](./proposals/C001-continuous-integration-jmeter.md) | WIP | [![jmeter](https://img.shields.io/badge/apache-jmeter-blue?style=flat-square&logo=github)](https://github.com/apache/jmeter) |
| | **JUnit** | WIP | WIP | [![junit](https://img.shields.io/badge/junit--team-junit5-blue?style=flat-square&logo=github)](https://github.com/junit-team/junit5) |
| 📦 _Components Installer_ | **DataKit** | WIP | WIP | [![DataKit](https://img.shields.io/badge/guance-DataKit-blue?style=flat-square&logo=github)](https://github.com/GuanceCloud/DataKit) |
| | **SCheck** | WIP | WIP | [![SCheck](https://img.shields.io/badge/guance-SCheck-blue?style=flat-square&logo=github)](https://github.com/GuanceCloud/SCheck) |
| 🔭 _Ecosystem Integration_ | **GitHub Action** | - | WIP | [![setup-guance](https://img.shields.io/badge/guance-setup--guance-blue?style=flat-square&logo=github)](https://github.com/GuanceCloud/setup-guance) |
| | **DevContainer** | - | WIP | WIP |

References:

Expand Down
2 changes: 1 addition & 1 deletion docs/references/guance.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ Guance Cloud Command-Line Interface

- [guance iac](guance_iac.md) - Infrastructure as Code

###### Auto generated by spf13/cobra on 8-May-2023
###### Auto generated by spf13/cobra on 6-Jun-2023
2 changes: 1 addition & 1 deletion docs/references/guance_iac.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ Infrastructure as Code
- [guance](guance.md) - Guance Cloud Command-Line Interface
- [guance iac import](guance_iac_import.md) - Import external resource as Guance Cloud IaC resource

###### Auto generated by spf13/cobra on 8-May-2023
###### Auto generated by spf13/cobra on 6-Jun-2023
14 changes: 4 additions & 10 deletions docs/references/guance_iac_import.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,16 @@

Import external resource as Guance Cloud IaC resource

```
guance iac import [flags]
```

### Options

```
-f, --file string File path to import.
-h, --help help for import
-o, --out string Output file path.
-r, --resource string Source type, supports dashboard, monitor now.
-t, --target string Target type, supports terraform-module now.
-h, --help help for import
```

### SEE ALSO

- [guance iac](guance_iac.md) - Infrastructure as Code
- [guance iac import console](guance_iac_import_console.md) - Import Guance Cloud Console resources
- [guance iac import grafana](guance_iac_import_grafana.md) - (Alpha) Import grafana resources

###### Auto generated by spf13/cobra on 8-May-2023
###### Auto generated by spf13/cobra on 6-Jun-2023
23 changes: 23 additions & 0 deletions docs/references/guance_iac_import_console.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## guance iac import console

Import Guance Cloud Console resources

```
guance iac import console [flags]
```

### Options

```
-f, --file string File path to import.
-h, --help help for console
-o, --out string Output file path.
-r, --resource string Source type, supports dashboard, monitor now.
-t, --target string Target type, supports terraform-module now.
```

### SEE ALSO

- [guance iac import](guance_iac_import.md) - Import external resource as Guance Cloud IaC resource

###### Auto generated by spf13/cobra on 6-Jun-2023
22 changes: 22 additions & 0 deletions docs/references/guance_iac_import_grafana.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## guance iac import grafana

(Alpha) Import grafana resources

```
guance iac import grafana [flags]
```

### Options

```
-f, --file string File path to import.
-h, --help help for grafana
-o, --out string Output file path.
-t, --target string Target type, supports terraform-module now.
```

### SEE ALSO

- [guance iac import](guance_iac_import.md) - Import external resource as Guance Cloud IaC resource

###### Auto generated by spf13/cobra on 6-Jun-2023
48 changes: 48 additions & 0 deletions docs/references/man/guance-iac-import-console.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
.nh
.TH "GUANCE-IAC-IMPORT-CONSOLE" "1" "Jun 2023" "Auto generated by spf13/cobra" ""

.SH NAME
.PP
guance-iac-import-console - Import Guance Cloud Console resources


.SH SYNOPSIS
.PP
\fBguance iac import console [flags]\fP


.SH DESCRIPTION
.PP
Import Guance Cloud Console resources


.SH OPTIONS
.PP
\fB-f\fP, \fB--file\fP=""
File path to import.

.PP
\fB-h\fP, \fB--help\fP[=false]
help for console

.PP
\fB-o\fP, \fB--out\fP=""
Output file path.

.PP
\fB-r\fP, \fB--resource\fP=""
Source type, supports dashboard, monitor now.

.PP
\fB-t\fP, \fB--target\fP=""
Target type, supports terraform-module now.


.SH SEE ALSO
.PP
\fBguance-iac-import(1)\fP


.SH HISTORY
.PP
6-Jun-2023 Auto generated by spf13/cobra
44 changes: 44 additions & 0 deletions docs/references/man/guance-iac-import-grafana.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
.nh
.TH "GUANCE-IAC-IMPORT-GRAFANA" "1" "Jun 2023" "Auto generated by spf13/cobra" ""

.SH NAME
.PP
guance-iac-import-grafana - (Alpha) Import grafana resources


.SH SYNOPSIS
.PP
\fBguance iac import grafana [flags]\fP


.SH DESCRIPTION
.PP
(Alpha) Import grafana resources


.SH OPTIONS
.PP
\fB-f\fP, \fB--file\fP=""
File path to import.

.PP
\fB-h\fP, \fB--help\fP[=false]
help for grafana

.PP
\fB-o\fP, \fB--out\fP=""
Output file path.

.PP
\fB-t\fP, \fB--target\fP=""
Target type, supports terraform-module now.


.SH SEE ALSO
.PP
\fBguance-iac-import(1)\fP


.SH HISTORY
.PP
6-Jun-2023 Auto generated by spf13/cobra
22 changes: 3 additions & 19 deletions docs/references/man/guance-iac-import.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.nh
.TH "GUANCE-IAC-IMPORT" "1" "May 2023" "Auto generated by spf13/cobra" ""
.TH "GUANCE-IAC-IMPORT" "1" "Jun 2023" "Auto generated by spf13/cobra" ""

.SH NAME
.PP
Expand All @@ -17,32 +17,16 @@ Import external resource as Guance Cloud IaC resource


.SH OPTIONS
.PP
\fB-f\fP, \fB--file\fP=""
File path to import.

.PP
\fB-h\fP, \fB--help\fP[=false]
help for import

.PP
\fB-o\fP, \fB--out\fP=""
Output file path.

.PP
\fB-r\fP, \fB--resource\fP=""
Source type, supports dashboard, monitor now.

.PP
\fB-t\fP, \fB--target\fP=""
Target type, supports terraform-module now.


.SH SEE ALSO
.PP
\fBguance-iac(1)\fP
\fBguance-iac(1)\fP, \fBguance-iac-import-console(1)\fP, \fBguance-iac-import-grafana(1)\fP


.SH HISTORY
.PP
8-May-2023 Auto generated by spf13/cobra
6-Jun-2023 Auto generated by spf13/cobra
4 changes: 2 additions & 2 deletions docs/references/man/guance-iac.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.nh
.TH "GUANCE-IAC" "1" "May 2023" "Auto generated by spf13/cobra" ""
.TH "GUANCE-IAC" "1" "Jun 2023" "Auto generated by spf13/cobra" ""

.SH NAME
.PP
Expand Down Expand Up @@ -29,4 +29,4 @@ Infrastructure as Code

.SH HISTORY
.PP
8-May-2023 Auto generated by spf13/cobra
6-Jun-2023 Auto generated by spf13/cobra
4 changes: 2 additions & 2 deletions docs/references/man/guance.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.nh
.TH "GUANCE" "1" "May 2023" "Auto generated by spf13/cobra" ""
.TH "GUANCE" "1" "Jun 2023" "Auto generated by spf13/cobra" ""

.SH NAME
.PP
Expand Down Expand Up @@ -29,4 +29,4 @@ Guance Cloud Command-Line Interface

.SH HISTORY
.PP
8-May-2023 Auto generated by spf13/cobra
6-Jun-2023 Auto generated by spf13/cobra
24 changes: 23 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,43 @@ go 1.19
require (
github.com/hashicorp/go-multierror v1.1.1
github.com/magefile/mage v1.15.0
github.com/mitchellh/mapstructure v1.5.0
github.com/prometheus/prometheus v0.44.0
github.com/spf13/cobra v1.7.0
github.com/stretchr/testify v1.8.4
github.com/tidwall/gjson v1.14.4
github.com/tidwall/sjson v1.2.5
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/dennwc/varint v1.0.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/grafana/regexp v0.0.0-20221122212121-6b5c0a4cb7fd // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.15.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/goleak v1.2.1 // indirect
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect
golang.org/x/sys v0.7.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit f49e1f3

Please sign in to comment.