Skip to content

Instantly share code, notes, and snippets.

View jkschneider's full-sized avatar

Jonathan Schnéider jkschneider

View GitHub Profile
@jkschneider
jkschneider / atlas
Last active June 16, 2017 23:04
Initialization actions for Netflix Atlas on a Google Cloud Dataproc master
#!/bin/sh
#
# /etc/init.d/mysystem
# Subsystem file for "Atlas" server
#
# chkconfig: 2345 95 05 (1)
# description: Atlas server daemon
ATLAS_VERSION=1.5.3
RETVAL=0
@jkschneider
jkschneider / TempPrometheusVaryingHistogram.java
Created August 28, 2017 22:34
What happens when we add new buckets to a Prometheus Histogram dynamically?
package io.micrometer.core.samples;
import com.sun.net.httpserver.HttpServer;
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.atomic.DoubleAdder;
/**
* Copyright 2017 Pivotal Software, Inc.
*
* 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
@jkschneider
jkschneider / DistributionFilterProperties.java
Created January 17, 2018 22:39
Properties POJOs for MeterFilter configuration
package io.micrometer.core.instrument.config;
import java.time.Duration;
/**
* Filter properties that are common to both distribution summaries and timers.
*/
public abstract class DistributionFilterProperties extends MeterFilterProperties {
/**
* Controls whether to publish a histogram structure for those monitoring systems that support
@jkschneider
jkschneider / application.properties
Last active January 24, 2018 22:21
Demonstration of meter filtering in IDEs
management.metrics.enabled.my.timer=false
management.metrics.summaries.minimum-expected-value.my.summary=10
management.metrics.summaries.maximum-expected-value.my.summary=10
management.metrics.summaries.percentile-histogram.my.summary=true
# Map<String, Long[]>
management.metrics.summaries.sla.my.summary=10
# Map<String, Duration>
management.metrics.summaries.histogram-expiry.my.summary=10s
@jkschneider
jkschneider / Micrometer354.java
Created February 6, 2018 04:44
Micrometer 354
package io.micrometer.core.samples;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.Tags;
import io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics;
import io.micrometer.core.samples.utils.SampleRegistries;
import reactor.core.publisher.Flux;
import java.time.Duration;
import java.util.concurrent.atomic.AtomicLong;
@jkschneider
jkschneider / GaugeCollection.java
Created February 6, 2018 18:58
Micrometer 400
package io.micrometer.core.samples;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.Tags;
import io.micrometer.core.samples.utils.SampleConfig;
import java.util.Collections;
import java.util.List;
public class GaugeCollection {
public class Slack320 {
public static void main(String[] args) {
MeterRegistry registry = SampleRegistries.graphite();
Counter counter = registry.counter("serviceName", "client",
"token", "statistic", "timeout_connect");
RandomEngine r = new MersenneTwister64(0);
Normal dist = new Normal(0, 1, r);
Flux.interval(Duration.ofMillis(10))
@jkschneider
jkschneider / abstract.md
Created April 8, 2018 14:05
Repave and repair talk

Repave and repair your applications with confidence

If a security vulnerability is reported in a common java library today, would you be able to identify affected applications and repair your whole organization before dinner time?

In this talk, we're going to stitch together a continuous delivery platform, application monitoring, automated canary analysis, and organization-wide code search to show you how you can identify affected applications in minutes and repair your organization's code. We'll start with the assumption that we are working with a complex multi-platform (some K8S, some GCP, multiple Cloud Foundry foundations over private VSphere) environment like those found in many organizations.

Some of the tools we'll demonstrate include Spinnaker for continuous delivery, Kayenta for automated canary analysis, Micrometer for metrics collection, Prometheus for monitoring, and Rewrite for code search.

Bio

@jkschneider
jkschneider / MicrometerRegisry.java
Created May 29, 2018 21:36
Mapping from Spectator -> Micrometer
package io.micrometer.spectator;
import com.netflix.spectator.api.*;
import io.micrometer.core.instrument.MeterRegistry;
import java.util.Collections;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
public class MicrometerRegistry extends AbstractRegistry {