observable microservices with microprofile …...microservices with microprofile opentracing and...

26
1 Observable microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer OPTIONAL SECTION MARKER OR TITLE

Upload: others

Post on 25-May-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

1

Observable microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetryPavol LoffaySenior Software Engineer

OPTIO

NAL SECTION

MARKER O

R TITLE

Page 2: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

2

● Introduction to distributed tracing● MicroProfile-OpenTracing● Demo tracing in Quarkus with Jaeger● OpenTelemetry

Agenda

Page 3: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

3

● Software Engineer at Red Hat● Distributed tracing: Jaeger, OpenTracing,

OpenTelemetry● MicroProfile-OpenTracing

Pavol Loffay

Page 4: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

Why tracing?

4

Page 5: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

5

Modern distributed systems are complex.

Loading a page can involve 100s services and multiple nodes.

Page 6: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

CORPORATE SLIDE TEMPLATES

6

Page 7: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

7

We want to tell what happened with the request.

Which service or component caused the problem under which conditions.

Page 8: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

8

Metrics - no context, which request caused a spike? Logs - hard to correlate, parallel requests, multiple hosts.

Page 9: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

9

Monitoring tools must tell stories

Metrics and logs have no context or describe only one instance.

Distributed tracing tells story about the whole the transaction.

Page 10: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

Distributed Tracing

10

Page 11: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

11

Distributed Tracing concepts

A

B

C D

E

{context}{context}

{context}{context}

TraceID → {context} A

B

E

C

D

time

TRACE

SPANS

Page 12: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

12

Distributed Tracing conceptsIn-process context propagation

Page 13: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

MicroProfile-OpenTracing

13

Page 14: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

14

● Tracing API● Vendor neutral● No data/wire format

● Uses OpenTracing semantics and API

● Defines additional API

MicroProfile-OpenTracing

Page 15: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

15

● JAX-RS● MicroProfile Rest

Client

@Path("/")

public class Handler {

@GET

@Path("/hello")

public Response hello() {

Response response = client

.target("http://localhost:8090/api")

.request()

.get();

String entity = response.readEntity(String.class);

response.close();

return Response.ok(entity).build();

}

}

MicroProfile-OpenTracingAuto instrumentation

Page 16: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

16

● @Traced● @Inject

io.opentracing.Tracer

@Path("/")

public class Handler {

@Inject

private io.opentracing.Tracer tracer;

@GET

@Path("/hello")

@Traced(operationName = "bonjour")

public Response hello() {

return Response.ok().build();

}

@GET

@Path("/ping")

@Traced(false)

public Response ping() {

return Response.ok().build();

}

}

MicroProfile-OpenTracingExplicit instrumentation

Page 17: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

17

● MP Config● mp.opentracing.server.operation-name-provider

○ GET:foo.bar.UserHandler.getUser○ /user/{id}

● mp.opentracing.server.skip-pattern○ /health|/foo/bar*

MicroProfile-OpenTracingConfiguration

Page 18: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

18

DemoQuarkus application

https://github.com/pavolloffay/quarkus-tracing

Page 19: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

19

● Operation names for MP Rest Client● More annotations● Automatically trace CDI● MicroProfile-Reactive Messaging● MicroProfile-Fault tolerance

MicroProfile-OpenTracingRoadmap

Page 20: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

OpenTelemetry

20

Page 21: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

21

● “The next major version of OpenTracing and OpenCensus”

● CNCF (Google, Microsoft, LightStep, Dynatrace, DataDog…)

OpenTelemetry

Page 22: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

22

● API, SDK● Data format and W3C Trace-Context● Tracing, Metrics, (Logs)● Named tracers/meters tracer =

OpenTelemetry.getTracerFactory().getTracer("io.opentelemetry.contrib.mongodb", "semver:1.0.0");

● Agent/Collector

OpenTelemetry

Page 23: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

23

Page 24: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

24

1. New specification2. Expose OpenTelemetry in MP-OT3. Hybrid: new project and use OT shim

OpenTelemetry in MP

Page 25: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

25

Start with distributed tracing as early as possible.

Go to MicroProfile forum and vote which proposal you like!

Page 26: Observable microservices with MicroProfile …...microservices with MicroProfile OpenTracing and looking beyond to OpenTelemetry Pavol Loffay Senior Software Engineer TITLE 2 Introduction

linkedin.com/company/red-hat

youtube.com/user/RedHatVideos

facebook.com/redhatinc

twitter.com/RedHat

26

Red Hat is the world’s leading provider of enterprise

open source software solutions. Award-winning support,

training, and consulting services make Red Hat a trusted

adviser to the Fortune 500.

Thank you

OPTIO

NAL SECTION

MARKER O

R TITLE