You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Upload of audio solution
* mp3 not supported in solution
* formatting
* Update README.md
* Update tools/ml-audio-content-moderation/README.md
Co-Authored-By: Jacob Ferriero <[email protected]>
* Update tools/ml-audio-content-moderation/README.md
Co-Authored-By: Jacob Ferriero <[email protected]>
* Update tools/ml-audio-content-moderation/README.md
Co-Authored-By: Jacob Ferriero <[email protected]>
* Update tools/ml-audio-content-moderation/README.md
Co-Authored-By: Jacob Ferriero <[email protected]>
* Update tools/ml-audio-content-moderation/README.md
Co-Authored-By: Jacob Ferriero <[email protected]>
* Updated fstring
* Started to incorporate some changes requested from PR
* Move from tool to example
* pypi versioning of packages; some typehinting
* type hinting
* Formatting/fixing tests
* fixed bugs on deploying to gcf
* updated to use five buckets
* updates for five buckets missing full upload
* updates to UI that were requested
* Update #2 to UI code
* Two class descriptions
* Updated docs to use Cloud Shell as an option
* Updating changes for terraform
* Change exception to be NotFound
* Terraform edits and added license
* Readded compiled angular folders
* Updating README with new wording
* Fixed ordering of logs to capture errrs from JSON
* Removed blank line
* python 3 comment
* Initial upload
* Notes on BQ scheduler
* Updated with more documentation on new view
* Added screenshot
* Updating gce-usage-log image
* Added in more instructions; interval view contains all historical VM info; scheduled query updated to daily instead of hourly
* Added sample query to interval description
* removing angular source
* Update tools/gce-usage-log/README.md
Co-Authored-By: Jacob Ferriero <[email protected]>
* Update tools/gce-usage-log/README.md
Co-Authored-By: Jacob Ferriero <[email protected]>
* Update tools/gce-usage-log/gce_interval_view.sql
Co-Authored-By: Jacob Ferriero <[email protected]>
* Update tools/gce-usage-log/README.md
Co-Authored-By: Jacob Ferriero <[email protected]>
* Update tools/gce-usage-log/README.md
Co-Authored-By: Jacob Ferriero <[email protected]>
* Updating nits and datastudio copy ability
Copy file name to clipboardExpand all lines: README.md
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@ Common solutions and tools developed by Google Cloud's Professional Services tea
6
6
## Examples
7
7
The examples folder contains example solutions across a variety of Google Cloud Platform products. Use these solutions as a reference for your own or extend them to fit your particular use case.
8
8
9
+
9
10
*[Audio Content Profiling](examples/ml-audio-content-profiling) - A tool that builds a pipeline to scale the process of moderating audio files for inappropriate content using machine learning APIs.
10
11
*[BigQuery Audit Log Dashboard](examples/bigquery-audit-log) - Solution to help audit BigQuery usage using Data Studio for visualization and a sample SQL script to query the back-end data source consisting of audit logs.
11
12
*[BigQuery Billing Dashboard](examples/bigquery-billing-dashboard) - Solution to help displaying billing info using Data Studio for visualization and a sample SQL script to query the back-end billing export table in BigQuery.
Copy file name to clipboardExpand all lines: tools/gce-usage-log/README.md
+122-6Lines changed: 122 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,10 @@ This project is designed to provide you with tools to capture an ongoing record
4
4
5
5
As your GCP organization grows, you may want to understand the business context of your overall GCE instance footprint. An accounting of your GCE resource usage can be analyzed to optimize autoscaling strategies, to aid in capacity forecasting, and to assist in your internal resource accounting. Further insights can be drawn by segmenting your fleet based on labels or network tags (to represent entities such as production environment or team).
6
6
7
+
8
+
<b>Pre-requisites: The schema from audit logs requires your VMs to include both the labels and tags fields when creating the individual resource.
9
+
</b>
10
+
7
11
## 1. Overview
8
12
9
13
This project will capture events relevant to your GCE instance usage and log them in BigQuery in way that surfaces your GCE vCPUs (cores), RAM, and attached persistent (standard and SSD) or scratch (local SSD) disks, sliceable by zone, project, network tags, labels, and whether the instance was preemptible.
@@ -20,13 +24,24 @@ The audit logs will have separate entries for the creation and deletion of an in
20
24
21
25
A process is run to capture your existing footprint into a table (`_initial_vm_inventory`) in the same BigQuery dataset. This is required to capture the state of running instances for which a `create` instance event has not already been logged.
22
26
23
-
### 1.3 BigQuery View
27
+
### 1.3.1 BigQuery Base View
24
28
25
29
A view is created which joins the audit log and initial VM inventory tables to provide a more user-friendly view (`_gce_usage_log`), calculating cores and RAM from the machine type listed in the audit log events.
26
30
27
31
The resulting schema of the view looks like this:
28
32
29
-

33
+

34
+
35
+
36
+
### 1.3.2 BigQuery Interval View
37
+
38
+
An additional view can be created to also visualize point-in-time VM inventory (`_gce_usage_log_interval`). This displays
39
+
the inventory on a specified time-interval, such as aggregating all VMs in hourly increments.
40
+
41
+
The resulting schema of this interval view looks like this:
*`your_table` is the desired name for where the result will live
217
+
*`your_interval_unit` is DAY, HOUR, MINUTE, SECOND or any [supported date format](https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions#timestamp_trunc)
218
+
*`your_interval_amount` is any integer representing the frequency of intervals to calculate.
219
+
For example, if you wanted to create a time-series dataset looking at the inventory of VMs on an
220
+
hourly cadence, you would choose `HOUR` for `TIME_INTERVAL_UNIT` and `1` for `TIME_INTERVAL_AMOUNT`.
221
+
If you wanted to see the inventory at 5-minute increments, you would choose `MINUTE` and 5, respectively.
--display_name="Interval usage of GCE Usage Logs" \
237
+
--replace=true \
238
+
--schedule='every 24 hours'"$INTERVAL_VIEW"
239
+
Note: As a default, it is configured to run every 24 hours, but you can scheduled it more/less frequently as needed.
240
+
There is also no default expiration set, but this can be added if you only need historical data from a certain timeframe.
241
+
242
+
185
243
## 3. Using the dataset
186
244
245
+
### 3.2.1 How to Use the Interval View
246
+
187
247
Now that your dataset is ready, how do you query it?
188
248
249
+
The interval view allows to see aggregated point-in-time statistics. To find resource usage for a specific time-frame, you can query for the aggregate usage information for the month of
250
+
September by using the sample query below as an example. You can adjust the timeframe by altering the WHERE clause
251
+
or choose to only selectcertain fields depending on what you are trying to predict.
252
+
253
+
254
+
```sql
255
+
SELECT
256
+
custom_interval as hour,
257
+
count(instance_id) as num_instances,
258
+
SUM(cores) as total_cores,
259
+
SUM(memory_mb) as total_memory_mb,
260
+
SUM(pd_standard_size_gb) as total_pd_standard_size_gb,
261
+
SUM(pd_ssd_size_gb) as total_pd_ssd_size_gb,
262
+
SUM(local_ssd_size_gb) as total_local_ssd_size_gb
263
+
264
+
FROM `gce_usage_log._gce_usage_log_interval`
265
+
266
+
WHERE
267
+
custom_interval >= "2019-09-01" AND custom_interval <"2019-10-01"
268
+
269
+
GROUP BY 1
270
+
```
271
+
272
+
The results will look something like this (Note that the aggregated statistics will most likely
273
+
vary forworkloads as VM resources change over hour, but they do notin this example.)
0 commit comments