Skip to content

Commit

Permalink
Docs refactor work: move API monitoring and audit logging pages to gu…
Browse files Browse the repository at this point in the history
…ides/

PiperOrigin-RevId: 662568597
  • Loading branch information
jdbcode authored and copybara-github committed Aug 13, 2024
1 parent f07834c commit fc77ac9
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 65 deletions.
10 changes: 3 additions & 7 deletions guides/linked/cloud-monitoring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
This notebook demonstrates a mechanism for fetching data from Cloud Monitoring,
filtering it, and presenting the results in a table.

For more information about using Cloud Monitoring with Earth Engine, please see
the "API Monitoring" page in the Earth Engine documentation:
<https://developers.google.com/earth-engine/cloud/api_monitoring>

Disclaimer: these numbers [come with caveats!][caveats]

[caveats]: https://developers.google.com/earth-engine/cloud/api_monitoring#caveats
To learn more about using Cloud Monitoring with Earth Engine, refer to the
[Monitoring Usage](https://developers.google.com/earth-engine/guides/monitoring_usage)
guide in the Earth Engine documentation.
53 changes: 0 additions & 53 deletions samples/javascript/guides/api_monitoring.js

This file was deleted.

34 changes: 34 additions & 0 deletions samples/javascript/guides/monitoring_usage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Copyright 2022 The Google Earth Engine Community Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @fileoverview For the /earth-engine/guides/monitoring_usage page.
*/

// [START earthengine__monitoring_usage__workload_tags]
// Set a default workload tag.
ee.data.setDefaultWorkloadTag('landsat-compositing')
var composite = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2')
.filterDate('2020-01-01', '2021-01-01')
.median();

// Set a workload tag for export.
ee.data.setWorkloadTag('export-jobs');
Export.image.toAsset(composite);
ee.data.resetWorkloadTag(); // Reset to landsat-compositing

ee.data.resetWorkloadTag(true); // Reset back to empty
// [END earthengine__monitoring_usage__workload_tags]
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Examples for /earth-engine/cloud/api_monitoring page."""
"""Examples for /earth-engine/guides/monitoring_usage page."""

# [START earthengine__cloud_api_monitoring__workload_tags]
# [START earthengine__monitoring_usage__workload_tags]
# Authenticate, then initialize with your Cloud Project.
ee.Initialize(project='your-project')

Expand All @@ -29,9 +29,11 @@
# Set a workload tag for export.
ee.data.setWorkloadTag('export-jobs')
ee.batch.Export.image.toAsset(composite).start()
ee.data.resetWorkloadTag()
ee.data.resetWorkloadTag() # Reset to landsat-compositing

# Alternatively, use a workload tag with with.
ee.data.resetWorkloadTag(True) # Reset back to empty

# Alternatively, use a workload tag with the `with` context manager.
with ee.data.workloadTagContext('export-jobs'):
ee.batch.Export.image.toAsset(composite).start()
# [END earthengine__cloud_api_monitoring__workload_tags]
# [END earthengine__monitoring_usage__workload_tags]

0 comments on commit fc77ac9

Please sign in to comment.