-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove MR mapping for cloud run and cloud functions (#250)
* Support metric exporter for cloud run * Enable metrics-exporter example to run as cloud run job (#249) * Add readme with steps to run the example * Add script to run example as Cloud Run Job * Replace GCR with Artifact Registry * Rename GOOGLE_CLOUD_RUN_JOB_REGION to GOOGLE_CLOUD_RUN_REGION * Remove resource mapping for cloud-run As per the exporter spec, we do not support pushing metric to cloud-run. This change will cause cloud_run_revision to be treated as a generic_task. * Update the autoinstrument example to run in cloud-run * Remove mapping for cloud functions Cloud functions is also not writable for user-defined metrics, therefore removing its explicit mapping so that it defaults to generic_task. * Refactor: extract image name to a variable * Update README to streamline service invocation instructions * Update readme with instructions for command line
- Loading branch information
Showing
3 changed files
with
113 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright 2023 Google LLC | ||
# | ||
# 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. | ||
# | ||
CONTAINER_REGISTRY=cloud-run-applications | ||
REGISTRY_LOCATION=us-central1 | ||
IMAGE_NAME="${REGISTRY_LOCATION}-docker.pkg.dev/${GOOGLE_CLOUD_PROJECT}/${CONTAINER_REGISTRY}/hello-autoinstrument-java" | ||
|
||
if [[ -z "${GOOGLE_CLOUD_PROJECT}" ]]; then | ||
echo "GOOGLE_CLOUD_PROJECT environment variable not set" | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "${GOOGLE_APPLICATION_CREDENTIALS}" ]]; then | ||
echo "GOOGLE_APPLICATION_CREDENTIALS environment variable not set" | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "${GOOGLE_CLOUD_RUN_REGION}" ]]; then | ||
echo "GOOGLE_CLOUD_RUN_REGION environment variable not set" | ||
exit 1 | ||
fi | ||
|
||
echo "ENVIRONMENT VARIABLES VERIFIED" | ||
|
||
echo "CREATING CLOUD ARTIFACT REPOSITORY" | ||
gcloud artifacts repositories create ${CONTAINER_REGISTRY} --repository-format=docker --location=${REGISTRY_LOCATION} --description="Sample applications to run on Google Cloud Run" | ||
echo "CREATED ${CONTAINER_REGISTRY} in ${REGISTRY_LOCATION}" | ||
|
||
echo "BUILDING SAMPLE APP IMAGE" | ||
gradle clean jib --image "${IMAGE_NAME}" | ||
|
||
echo "RUNNING SAMPLE APP ON PORT 8080" | ||
gcloud run deploy hello-autoinstrument-cloud-run \ | ||
--image="${IMAGE_NAME}" \ | ||
--region="${GOOGLE_CLOUD_RUN_REGION}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters