Skip to content

Instantly share code, notes, and snippets.

View alexamies's full-sized avatar

Alex Amies alexamies

View GitHub Profile
@alexamies
alexamies / Analyzing-Client-Errors-README.md
Last active July 11, 2018 16:22
Monitoring of HTTP network services

Client Errors Monitoring project

This is a simple probe for measuring sources of HTTP connection latency, including DNS lookup, TLS handshake, connection establishment, and data transfer.

Enable the Stackdriver and Kubernetes Engine APIs in the Cloud Console. You will need to enable Stackdriver premium for use of custom metrics.

Export the name of your project and zone to the shell environment

@alexamies
alexamies / A--Monitoring-End-to-End-Message-Latency-README.md
Last active February 11, 2019 04:51
Monitoring End-to-End Message Latency with Stackdriver

Monitoring End-to-End Message Latency with Stackdriver

Enable the PubSub, Stackdriver, and Kubernetes Engine APIs in the Cloud Console. You will need to enable Stackdriver premium for use of custom metrics.

Export the name of your project and zone to the shell environment

export PROJECT_ID=[YOUR PROJECT ID]
gcloud config set project $PROJECT_ID
ZONE=us-west1-a
gcloud config set compute/zone $ZONE
@alexamies
alexamies / Dockerfile-define-metrics
Last active October 5, 2018 22:29
Mesh of HTTP Probes
FROM google/cloud-sdk:latest
ADD define_metrics.py /
ADD *.json /
ADD config.yaml /
RUN pip install pyyaml
RUN pip install --upgrade google-cloud-monitoring
CMD [ "python", "./define_metrics.py", "$GOOGLE_APPLICATION_CREDENTIALS"]
@alexamies
alexamies / Dockerfile
Last active October 5, 2018 22:28
Example of a HTTP probe with OpenCensus
FROM golang:1.10
WORKDIR /go/src/http_probe
COPY *.json .
COPY *.yaml .
COPY *.go .
RUN go get -d -v ./...
RUN go install -v ./...
// Copyright 2018 Google, Inc. All rights reserved.
//
// 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,
@alexamies
alexamies / README.md
Last active February 2, 2021 10:35
Using NGINX with Brotli

Using NGINX with Brotli

This Gist demonstrates enabling Brotli in Nginx in App Engine Flex using a custom container.

Running in Docker locally

Use of basic Nginx image adapting the example nginx.conf adapted from Full Example Configuration

docker run --rm -itd --name test-nginx \
  -v $(pwd):/usr/share/nginx/html:ro \
@alexamies
alexamies / .eslintrc.json
Last active October 5, 2018 22:26
Cloud Builder JavaScript Lint Example
{
"extends": "google"
}
@alexamies
alexamies / README.md
Last active October 8, 2018 18:44
Wrapping Google Cloud Functions HTTP Triggers in Endpoints

Wrapping Google Cloud Functions HTTP Triggers in Endpoints

As the Google Cloud Functions (GCF) ecosystem develops there are many useful examples of functions becoming available. However, it is still kind of hard to lock down the HTTP functions. For example, you may want to add authentication and protect the functions from attacks from the open Internet. On the other hand, Google Cloud Endpoints have been around for a little longer and designed specifically for HTTP access.

@alexamies
alexamies / README.md
Last active October 16, 2018 23:32
Using Chrome Dev Tools with Google Cloud

Using Chrome Dev Tools with Google Cloud

This file contains instructions for optimizing a static web site on Google Cloud Platform with Chrome Developer Tools. The final solution is contained in index.html. Intermediate solutions have are given in files index1.html, etc.

Setting up a Static Website on Google Cloud Storage

Static content can be easily hosted on GCP using the GCS features for Hosting a Static Website.

package io.opencensus.http;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
/**
* Excercise the Jetty HttpClient
*
*/
public class HttpClientApp {