Skip to content

Commit

Permalink
I edited the README. (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
ikenyal authored Dec 20, 2021
1 parent bc7cb14 commit d92e71c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
40 changes: 20 additions & 20 deletions README.jp.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Coppe

BigQuery用データ品質監視ツール。定期的なBigQueryへの監視、またSlackへの通知を行います。監視項目の追加はYAMLとSQLファイルのみで可能です。
Coppeは、BigQuery用データ品質監視ツールです。定期的なBigQueryへの監視やSlackへの通知を行います。監視項目の追加はYAMLとSQLファイルのみで可能です。

インフラ構成は以下の画像を参照ください。TerraformとGitHub Actionsによって自動デプロイが可能となっております
インフラ構成は下図の通りです。TerraformとGitHub Actionsによる自動デプロイが可能です

![Coppe Infra Diagram drawio](https://user-images.githubusercontent.com/36804811/138837195-c01eea1f-710e-4112-b3b2-aa3759f5adc2.png)

## Required Settings

1. Github Actions Secretsの追加
1. GitHub Actions Secretsの追加

- GOOGLE_APPLICATION_CREDENTIALS_JSON - JSON形式のGCP認証キー

Expand All @@ -21,7 +21,7 @@ BigQuery用データ品質監視ツール。定期的なBigQueryへの監視、
$ gcloud alpha monitoring channels list | grep 'name:'
```

3. **.env.yaml**に環境変数を設定する
3. **.env.yaml**に環境変数を設定

- GCP_PROJECT_ID (デプロイ用のGCPプロジェクトID)
- SLACK_HOOK_URL (アラート通知用のデフォルトのSlack Webhook URL。詳しくは[Alert Channel](#alert-channel))
Expand Down Expand Up @@ -49,7 +49,7 @@ $ gcloud alpha monitoring channels list | grep 'name:'
```

3. GitHubにPush/Merge - Github ActionsとTerraformによって、インフラの設定やデプロイは行われます
3. GitHubにPush/Merge - GitHub ActionsとTerraformによって、インフラの設定やデプロイは行われます


## Format of YAML file
Expand All @@ -72,7 +72,7 @@ $ gcloud alpha monitoring channels list | grep 'name:'

毎週月曜日の12時:0 12 * * MON

詳しくはこちらへ(https://github.com/adhocore/gronx#cron-expression)
詳しくはこちら(https://github.com/adhocore/gronx#cron-expression


### SQL in File
Expand All @@ -99,7 +99,7 @@ SELECT count(*) FROM foo

### SQL Parameters

SQLにパラメーターを設定することもできます。その場合、`params:`に連想配列として書いてください
SQLにパラメーターを設定することもできます。その場合、`params:`に連想配列として記述してください

例:
```
Expand All @@ -112,7 +112,7 @@ SQLにパラメーターを設定することもできます。その場合、`p
```

\* Coppeはテキストテンプレートライブラリを使用しています。書き方など詳しくはこちらへhttps://pkg.go.dev/text/template)
\* Coppeはテキストテンプレートライブラリを使用しています。書き方など詳しくはこちらhttps://pkg.go.dev/text/template)


### SQL Matrix
Expand Down Expand Up @@ -141,12 +141,12 @@ SQLにパラメーターを設定することもできます。その場合、`p
```

\* Coppeはテキストテンプレートライブラリを使用しています。書き方など詳しくはこちらへhttps://pkg.go.dev/text/template)
\* Coppeはテキストテンプレートライブラリを使用しています。書き方など詳しくはこちらhttps://pkg.go.dev/text/template)


### Expected Row Count / Expression

Coppeは期待するクエリ結果として、`row_count:`もしくは`expression:`を利用することができます
Coppeは期待するクエリ結果として、`row_count:`もしくは`expression:`を利用可能です

`row_count:`:クエリ結果の列数

Expand All @@ -160,23 +160,23 @@ Coppeは期待するクエリ結果として、`row_count:`もしくは`expressi
expression: table_name == "foo" && error_count > 10
```

\* 注意:row_countとexpressionはどちらかしか書くことができません
\* 注意:row_countとexpressionは、どちらか一方のみ記載可能です

### Alert Channel

監視項目によって、SLACKの通知チャンネルを使い分けたい場合、環境変数の追加と`channel:`で通知するURLを指定することができます。指定しなかった場合、デフォルトでSLACK_HOOK_URLが使われますが、`channel:`で指定されている場合、SLACK_HOOK_URL_ + `channel:`の値 を環境変数から取得し、通知に使用します。
監視項目によって、Slackの通知チャンネルを使い分けたい場合、環境変数の追加と`channel:`で通知するURLを指定できます。指定しなかった場合、デフォルトでSLACK_HOOK_URLが使われますが、`channel:`で指定されている場合、SLACK_HOOK_URL_ + `channel:`の値を環境変数から取得し、通知に使用します。

例えば、

```
channel: CRITICAL
```

のように指定する場合、環境変数(.env.yaml)に'SLACK_HOOK_URL_CRITICAL'を取得します。もし、環境変数になかった場合は代わりにデフォルトのURLが使用されます。また、`channel:`の値はケース無視(criticalと書いてもCRITICALとして扱われる)ですが、環境変数は大文字で書くようにしてください。
のように指定する場合、環境変数(.env.yaml)に'SLACK_HOOK_URL_CRITICAL'を取得します。もし、環境変数になかった場合は代わりにデフォルトのURLが使用されます。また、`channel:`の値はケース無視(criticalと書いてもCRITICALとして扱われる)されますが、環境変数は大文字で書くようにしてください。

### Alert Message

クエリ結果が期待される値でなかった場合、Slackでの通知を行います。アラートメッセージはクエリ結果を利用・展開して書くこともできます。また、SQlに使用したparamsやmatrixも使用することが可能です
クエリ結果が期待される値でなかった場合、Slackへの通知を行います。アラートメッセージはクエリ結果を利用・展開して書くこともできます。また、SQLに使用したparamsやmatrixも使用することが可能です

それぞれの型は、
- query_result: []map[string]interface{}
Expand Down Expand Up @@ -204,21 +204,21 @@ channel: CRITICAL
```
{{ . }}
```
クエリ結果を[]map[string]interface{}のまま、printfする
で、クエリ結果を[]map[string]interface{}のまま、printfします

```
{{ range . }}
{{ .column_name }}
{{ end }}
```
クエリ結果をループして表示。column_nameにはクエリで取得したカラム名のみ使用可能
クエリ結果をループして表示可能です。なお、column_nameには、クエリで取得したカラム名のみ使用可能です

```
{{ range $i, $row := . }}
{{ $i }} : {{ $row.column_name }}
{{ end }}
```
また、インデックスはこのように取得できる
また、インデックスはこのように取得できます


```
Expand All @@ -230,14 +230,14 @@ channel: CRITICAL
{{ end }}
{{ end }}
```
if文はこのように書ける
if文はこのように記載可能です

\* テキストテンプレートライブラリを使用していますので、書き方など詳しくは[公式ドキュメント](https://pkg.go.dev/text/template)を参照してください。
\* テキストテンプレートライブラリを使用しているので、書き方など詳しくは[公式ドキュメント](https://pkg.go.dev/text/template)を参照してください。

## Contributing

IssueやPull Requestの作成など、コントリビューションは誰でも歓迎です。コントリビューターは[Contributor Covenant](http://contributor-covenant.org/)を遵守することを期待します。

## License

CoppeはMITライセンスを適応してオープンソースとして公開しています
CoppeはMITライセンスを適応してオープンソースとして公開しています[LICENSE](./LICENSE.txt) を参照してください。
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The following is the architecture of Coppe. Easily deployable on Google Cloud Pl

## Required Settings

1. Github Actions Secrets
1. GitHub Actions Secrets

- GOOGLE_APPLICATION_CREDENTIALS_JSON - GCP credential key in JSON format

Expand Down Expand Up @@ -54,7 +54,7 @@ $ gcloud alpha monitoring channels list | grep 'name:'
```

3. Push/Merge to main - Github Actions and Terraform will take care of other infrastructure setup and deployment in GCP.
3. Push/Merge to main - GitHub Actions and Terraform will take care of other infrastructure setup and deployment in GCP.


## Format of YAML file
Expand All @@ -72,7 +72,7 @@ For more details and examples, please refer to https://github.com/adhocore/gronx

### SQL in File

Instead of directly writing SQL in `sql:` row, You can put a path to SQL file in `sql_file:`. Detectable are only files in `sql` directory.
Instead of directly writing SQL in `sql:` row, you can put a path to SQL file in `sql_file:`. Detectable are only files in `sql` directory.

```
- ...
Expand Down Expand Up @@ -156,7 +156,7 @@ In `expression:`, you can write an expression that should be true using the colu

### Alert Channel

You can specify other Slack channel than the default one for alert with `channel:`. For this, You need to add specified Slack Incoming Webhook URL in .env.yaml.
You can specify other Slack channel than the default one for alert with `channel:`. For this, you need to add specified Slack Incoming Webhook URL in .env.yaml.

By default, the URL used for Slack notification is 'SLACK_HOOK_URL' in .env.yaml if nothing specified in `channel:`. If specified, an environment variable for the word in `channel` followed by 'SLACK_HOOK_URL_' is used.

Expand Down

0 comments on commit d92e71c

Please sign in to comment.