92
CHALLENGES IN A MICROSERVICES AGE: MONITORING, LOGGING AND TRACING ON OPENSHIFT Martin Etmajer Technology Lead @Dynatrace May 4, 2017

Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Embed Size (px)

Citation preview

Page 1: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

CHALLENGES IN A MICROSERVICES AGE:MONITORING, LOGGING AND TRACING ON OPENSHIFT

Martin EtmajerTechnology Lead @DynatraceMay 4, 2017

Page 2: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

WHY A CHALLENGE?

Page 3: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Microservice A Microservice B Microservice C

Page 4: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Microservice B

Runtime Environment Runtime Environment Runtime Environment

Microservice A Microservice C

Page 5: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Microservice B DataStore

Runtime Environment Runtime Environment Runtime Environment

Microservice A DataStore

Microservice C DataStore

Page 6: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Microservice A DataStore

Microservice B DataStore

Microservice C DataStore

Runtime Environment Runtime Environment Runtime Environment

3 6

+3+2

5 9

Page 7: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Microservice A Microservice B Microservice C

Runtime Environment Runtime Environment Runtime Environment

-3-2

DataStore

3

DataStore

6

DataStore

5 9

Page 8: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Microservice A

Load Balancing

Microservice B

Load Balancing

Microservice C

Runtime Environment Runtime Environment Runtime Environment

Load Balancing

DataStore

DataStore

DataStore

3 6

Page 9: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Microservice A

Load Balancing

Microservice B

Load Balancing

Microservice C

Runtime Environment Runtime Environment Runtime Environment

Load Balancing

DataStore

DataStore

DataStore

3 6

Page 10: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Microservice A

Load Balancing

Microservice B

Load Balancing

Microservice C

Runtime Environment Runtime Environment Runtime Environment

Load Balancing

DataStore

DataStore

DataStore

Messaging System

3 6

Page 11: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Microservice A

Load Balancing

Microservice B

Load Balancing

Microservice C

Runtime Environment Runtime Environment Runtime Environment

Load Balancing

Messaging System

API Gateways

DataStore

DataStore

DataStore

3 6

Page 12: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Microservice A

Load Balancing

Microservice B

Load Balancing

Microservice C

Runtime Environment Runtime Environment Runtime Environment

Load Balancing

Messaging System

API Gateways

DataStore

DataStore

DataStore

languages

application servers,container runtimes,…

load balancing

discovery & routing

security

messaging

storage3 6

Page 13: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Red Hat „Hello World“ MSA

Demo

Page 14: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift
Page 15: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift
Page 16: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift
Page 17: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

MONITORING

Page 18: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Monitoringcontainer health checks with OpenShift Liveness Probes

What?

● a liveness probe periodically checks if a container is able to handle requests

● when a condition has not been met within a given timeout, the probe fails

● if a probe fails, the container is killed and subjected to its restart policy

Page 19: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Monitoringcontainer health checks with OpenShift Liveness Probes

How?

1 livenessProbe:

2 httpGet:

3 path: /health

4 port: 8080

5 initialDelaySeconds: 15

6 timeoutSeconds: 1

set in spec.containers.livenessProbe of Pod config

Page 20: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Monitoringcontainer health checks with OpenShift Liveness Probes

How?

1 livenessProbe:

2 httpGet:

3 path: /health

4 port: 8080

5 initialDelaySeconds: 15

6 timeoutSeconds: 1

supports HTTP Get, Container Command and TCP Socket types

Page 21: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Monitoringcontainer health checks with OpenShift Liveness Probes

How?

Demo

Page 22: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

MonitoringWhere are the fancy dashboards?

Source: d3js.org - Data-Driven Documents

Page 23: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Heapster Hawkular Metrics

Monitoringcontainer, pod and node metrics with Heapster and Hawkular Metrics

Page 24: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift
Page 25: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

collects resource usage data, etc.

Page 26: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

exposes metrics via REST

Page 27: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

supports variousstorage backends

Page 28: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Heapster

gathers metrics

runs in a Pod

exposes metrics

influxdb

GCL

elasticsearch

GCM

graphite

kafka

Page 29: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

e.g. Hawkular

Page 30: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

HawkularA collection of open source monitoring components by Red Hat

Page 31: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

HawkularA collection of open source monitoring components by Red Hat

metrics storage engine

Page 32: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

HawkularA collection of open source monitoring components by Red Hat

distributed tracing andapplication performance management

Page 33: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

HawkularA collection of open source monitoring components by Red Hat

alerting

Page 34: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

HawkularA collection of open source monitoring components by Red Hat

feed for Jolokia and Prometheus metrics

Page 35: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

a metrics storage engine

with a REST interface

Page 36: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Monitoringcontainer, pod and node metrics with Heapster and Hawkular Metrics

! ! ! ! !

gathers metricssends metricsvisualizes metrics

Demo

Page 37: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift
Page 38: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift
Page 39: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift
Page 40: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift
Page 41: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift
Page 42: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift
Page 43: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift
Page 44: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Hawkular OpenShift Agent Jolokia Prometheus

Monitoringapplication level metrics with Hawkular OpenShift Agent (HOSA)

Page 45: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

feeds Jolokia/Prometheus metrics data into Hawkular

Page 46: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Monitoringapplication level metrics with Hawkular OpenShift Agent (HOSA)

! ! ! ! !

is deployed via a DaemonSet

Page 47: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Monitoringapplication level metrics with Hawkular OpenShift Agent (HOSA)

! ! ! ! !HOSA HOSA HOSA HOSA HOSA

runs

Page 48: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Monitoringapplication level metrics with Hawkular OpenShift Agent (HOSA)

! ! ! ! !HOSA HOSA HOSA HOSA HOSA

gathers metricssends metrics

applications

Page 49: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Monitoringapplication level metrics with Hawkular OpenShift Agent (HOSA)

! ! ! ! !HOSA HOSA HOSA HOSA HOSA

gathers metrics

application containers

Page 50: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift
Page 51: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift
Page 52: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift
Page 53: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift
Page 54: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Monitoringapplication level metrics with Hawkular OpenShift Agent (HOSA)

How?

1 kind: ConfigMap

2 apiVersion: v1

3 metadata:

4 name: my-hosa-config

5 data:

6 hawkular-openshift-agent: |

7 endpoints:

8 - type: jolokia 15 - type: prometheus

9 protocol: http 16 protocol: http

10 port: 8778 17 port: 8080

11 path: /jolokia/ 18 path: /metrics/

12 metrics 19 metrics:

13 - name: java.lang:type=Memory 20 - name: process_start_time_seconds

14 type: gauge 21 type: gauge

ConfigMap defines agent configuration

Page 55: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Monitoringapplication level metrics with Hawkular OpenShift Agent (HOSA)

How?

1 spec:

2 volumes:

3 - name: hawkular-openshift-agent

4 configMap:

5 name: my-hosa-config

a volume named „hawkular-openshift-agent“ tells HOSA to monitor this Pod

Demo

Page 56: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Monitoringapplication level metrics with Hawkular OpenShift Agent (HOSA)

How?

1 kind: ConfigMap

2 apiVersion: v1

3 metadata:

4 name: my-hosa-config

5 data:

6 hawkular-openshift-agent: |

7 endpoints:

8 - type: jolokia 15 - type: prometheus

9 protocol: http 16 protocol: http

10 port: 8778 17 port: 8080

11 path: /jolokia/ 18 path: /metrics/

12 metrics 19 metrics:

13 - name: java.lang:type=Memory 20 - name: process_start_time_seconds

14 type: gauge 21 type: gauge

Jolokia ?

Page 57: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

JolokiaJMX on Capsaicin

access JMX MBeans remotely via REST

Page 58: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

$ mv $JOLOKIA_HOME/agents/jolokia.war $TOMCAT_HOME/webapps$ $TOMCAT_HOME/bin/catalina.sh start

JolokiaJMX on Capsaicin installs a Jolokia WAR agent into Apache Tomcat

Page 59: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Monitoringapplication level metrics with Hawkular OpenShift Agent (HOSA)

How?

1 kind: ConfigMap

2 apiVersion: v1

3 metadata:

4 name: my-hosa-config

5 data:

6 hawkular-openshift-agent: |

7 endpoints:

8 - type: jolokia 15 - type: prometheus

9 protocol: http 16 protocol: http

10 port: 8778 17 port: 8080

11 path: /jolokia/ 18 path: /metrics/

12 metrics 19 metrics:

13 - name: java.lang:type=Memory 20 - name: process_start_time_seconds

14 type: gauge 21 type: gauge

Prometheus ?

Page 60: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

PrometheusA monitoring system for metrics data

Page 61: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

PrometheusA monitoring system for metrics data

metrics storage engine

Page 62: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

PrometheusA monitoring system for metrics data

various exporters expose metrics fromnodes, database engines and cloud componentry

Page 63: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

PrometheusA monitoring system for metrics data

alerting

Page 64: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

# build.gradle # Application.java

1 dependencies { 1 public void registerMetricServlet() {

2 compile 'io.prometheus.simpleclient.0.0.21' 2 // Expose Promtheus metrics.

3 compile 'io.prometheus.simpleclient_hotspot.0.0.21' 3 context.addServlet(new ServletHolder(new MetricsServlet()), "/metrics");

4 compile 'io.prometheus.simpleclient_servlet.0.0.21' 4 // Add metrics about CPU, JVM memory etc.

5 } 5 DefaultExports.initialize();

6 }

PrometheusA monitoring system for metrics data

exposes default JMX metrics: CPU, Memory, Garbage Collection, etc.

Page 65: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Where to start?

Page 66: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

LOGGING

Page 67: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

how to process all these data?

Page 68: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Loggingapplication events with Elasticsearch, Fluentd and Kibana (EFK)

FluentdElasticsearch Kibana

Page 69: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

unifies your logging infrastructure; supports almost 200 plugins

Page 70: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

! ! ! ! !

is deployed via a DaemonSet

Loggingapplication events with Elasticsearch, Fluentd and Kibana (EFK)

Page 71: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

! ! ! ! !

deploys

Fluentd Fluentd Fluentd Fluentd Fluentd

Loggingapplication events with Elasticsearch, Fluentd and Kibana (EFK)

Page 72: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

application events with Elasticsearch, Fluentd and Kibana (EFK)

! ! ! ! !

watches container logs

Fluentd Fluentd Fluentd Fluentd Fluentd

ingests log datavia configuration

Logging

query

ElasticsearchKibana Application

Demo

Page 73: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift
Page 74: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift
Page 75: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

DISTRIBUTED TRACING

Page 76: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift
Page 77: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

design goals

Page 78: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Google Dappertrace

(transaction)

initiator

processes

remote calls

Source: Google Dapper Paper

spans(timed operations)

annotations,event data

Page 79: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

ZipKinA distributed tracing system timescale

spans

Page 80: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

a standard API for reporting distributed traces

with various client libraries

Page 81: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

OpenTracingA vendor-neutral open standard for distributed tracing

The problem?

● instrumentation is challenging: tracing context must propagate within and between processes

● unreasonable to ask all vendor and FOSS software to be intrumented by a single tracing vendor

The solution?

● allow developers to instrument their own code using OpenTracing client libraries

● have the application maintainer choose the tracing technology via configuration change

Page 82: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

Hawkular APMDistributed Tracing and Application Performance Management

Page 83: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift
Page 84: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

JaegerA distributed tracing system

Source: Jaeger Architecture – jaeger.readthedocs.io

Page 85: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

SOLVES THE CHALLENGE?

Page 86: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift
Page 87: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

DynatraceAll-in-one monitoring, now!

! ! ! ! !

dynatrace/oneagent

Page 88: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

DynatraceAll-in-one monitoring, now!

! ! ! ! !

deploys

Page 89: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift
Page 90: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift
Page 91: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift

THANK YOUplus.google.com/+RedHat

linkedin.com/company/red-hat

youtube.com/user/RedHatVideos

facebook.com/redhatinc

twitter.com/RedHatNews

Page 92: Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat OpenShift