Skip to content

Instantly share code, notes, and snippets.

View joaoh82's full-sized avatar

João Henrique Machado Silva joaoh82

View GitHub Profile
@joaoh82
joaoh82 / option1.js
Created October 25, 2018 08:35
option 1
['Max', 'Remaining'].forEach(metric => {
const metricName = `limits.salesforce.${limit}.${metric}`;
const value = limits[limit][metric];
console.log(
`MONITORING|${unixEpochTimestamp}|${value}|${metricType}|${metricName}|#${tagsTrackBeta}`
);
});
@joaoh82
joaoh82 / option2.js
Created October 25, 2018 08:35
option 2
const maxMetricName = `limits.salesforce.${limit}.Max`;
const reminingMatricName = `limits.salesforce.${limit}.Remaining`;
const { Max, Remaining } = limits[limit];
console.log(`MONITORING|${unix_epoch_timestamp}|${Max}|${metric_type}|${maxMetricName}|#${tags}`);
console.log(`MONITORING|${unix_epoch_timestamp}|${Remaining}|${metric_type}|${remainingMetricName}|#${tags}`);
{
"config": {
"phases": [
{
"duration": 120,
"arrivalRate": 10,
"rampTo": 20,
"name": "Warm up the ALB/ECS service"
},
{
Feature gRPC REST
Contract Required (*.proto) Optional (OpenAPI)
Transport HTTP/2 HTTP
Payload Protobuf (small and binary) JSON (large and human readable)
Prescriptiveness Strict specification Loose. Any HTTP is valid
Streaming Client/Server/Bi-Directional Client/Server
Broswer support No (requires grpc-web) Yes
Security Transport (HTTPS) Transport (HTTPS)
Client code-gen Yes OpenAPI + third0party tooling
package main
import (
"errors"
"fmt"
"testing"
"github.com/stretchr/testify/require"
)
package main
import (
"errors"
"fmt"
"testing"
"github.com/stretchr/testify/require"
)
package main
import (
"errors"
"fmt"
"testing"
"github.com/stretchr/testify/require"
)
package main
import (
"errors"
"fmt"
"testing"
"github.com/stretchr/testify/require"
)
package main
import "fmt"
import "golang.org/x/net/context"
// A message processes parameter and returns the result on resChan.
// ctx is places in a struct, but this is ok to do.
type message struct {
resChan chan<- int
parameter string
package gocontext
import (
"context"
"net/http"
)
type SomeMiddleware interface {
HandleHTTPC(ctx context.Context, rw http.ResponseWriter, req *http.Request, next http.Handler)
}