Skip to content

Instantly share code, notes, and snippets.

View fieldju's full-sized avatar

Justin Field fieldju

View GitHub Profile
package com.nike.kayenta.events;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableList;
import com.netflix.kayenta.canaryanalysis.domain.CanaryAnalysisExecutionStatusResponse;
import com.netflix.kayenta.canaryanalysis.event.StandaloneCanaryAnalysisExecutionCompletedEvent;
import com.nike.kayenta.model.EventType;
import com.nike.kayenta.model.NikeKayentaConfig;
import com.nike.kayenta.model.NotificationChannel;
import com.nike.kayenta.service.*;
server:
ssl:
enabled: false
port: '8090'
address: localhost
redis:
connection: ${services.redis.baseUrl:redis://localhost:6379}
kayenta:
@fieldju
fieldju / rollup.config.js
Last active May 15, 2019 22:29
work in progress config for @spinnaker/core
const alias = require('rollup-plugin-alias');
// Cant use rollup-plugin-typescript until the following issue is resolved, rollup-plugin-typescript2 is slow, but works :(
// https://github.com/rollup/rollup-plugin-typescript/issues/109
// const typescript = require('rollup-plugin-typescript');
const typescript = require('rollup-plugin-typescript2');
const postcss = require('rollup-plugin-postcss');
const path = require('path');
const { minify } = require('html-minifier');
const external = require('@yelo/rollup-node-external');
const rollupPostcssLessLoader = require('rollup-plugin-postcss-webpack-alias-less-loader');
@fieldju
fieldju / rollup.config.js
Last active May 12, 2019 00:29
rollup config
const { existsSync } = require('fs');
const typescript = require('rollup-plugin-typescript');
const postcss = require('rollup-plugin-postcss');
const pify = require('pify');
const path = require('path');
const less = require('less');
const importCwd = require('import-cwd');
const humanlizePath = filepath => path.relative(process.cwd(), filepath);
const NODE_MODULE_PATH = path.join(__dirname, 'node_modules');
@fieldju
fieldju / Optional.ts
Created April 2, 2019 15:53
optional-ts
export default class Optional<T> {
private readonly value: T | null | undefined;
constructor(value: T | null | undefined = null) {
this.value = value;
}
static ofNullable<T>(value: T | undefined | null): Optional<T> {
return new Optional(value);
}
{
"name": "node-golden-signals-example",
"description": "Golden Signals for the Nike SignalFx Node Metrics Lib with Express middleware.",
"judge": {
"judgeConfigurations": {},
"name": "NetflixACAJudge-v1.0"
},
"metrics": [
{
"name": "95th Percentile Request Latency for /hello",
Request method: POST
Request URI: http://localhost:61444/canary?metricsAccountName=sfx-integration-test-account&storageAccountName=in-memory-store
Proxy: <none>
Request params: <none>
Query params: metricsAccountName=sfx-integration-test-account
storageAccountName=in-memory-store
Form params: <none>
Path params: <none>
Headers: Accept=*/*
Content-Type=application/json; charset=UTF-8
@fieldju
fieldju / api.yaml
Last active December 4, 2018 19:23
openapi: 3.0.1
paths:
/aggregated_canary_analyses/v1:
post:
summary: Start an aggregated canary analysis execution stage
description: >
This endpoint triggers a canary analysis stage that will run for {requestBody.lifetime} seconds.
The stage will conduct {requestBody.lifetime} / {requestBody.interval} canary judgements.
The canary judgments will source the data at a data point per {requestBody.step} second resolution.
-------------------------------------------------------------------------------------------
2018-08-28 19:28:15.919 | POST /canary/18bc2d36-b9e8-4954-bd90-47fafddc1bd1
query:
application=hello
parentPipelineExecutionId=01CP0ZS3Z058V1HHSK511H0AAF
metricsAccountName=nde-ci-account-dd
configurationAccountName=nde-ci-account
storageAccountName=nde-ci-account
protected List<Double> getTimeSeriesDataFromChannelMessages(List<ChannelMessage> channelMessages) {
// TODO If an error message is present at all does that mean everything is garbage?
channelMessages.parallelStream().filter(channelMessage -> channelMessage.getType().equals(ERROR_MESSAGE))
.findAny()
.ifPresent(error -> {
ChannelMessage.ErrorMessage errorMessage = (ChannelMessage.ErrorMessage) error;
// TODO How do you get the errors from these objects?
List<Object> errros = errorMessage.getErrors();