32
#Perform2018 Cloud innovation and automation DevOps, Shift-Left & Self-Healing A Performance Clinic with Andi Andreas Grabner DevOps Activist @ Dynatrace

Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

  • Upload
    others

  • View
    7

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

#Perform2018

Cloud innovation and automation

DevOps, Shift-Left & Self-HealingA Performance Clinic with Andi

Andreas Grabner

DevOps Activist @ Dynatrace

Page 2: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

Performance Clinics & More: From AppMon to Dynatrace

Performance Clinics: http://bit.ly/onlineperfclinic

Podcast: http://bit.ly/pureperf

http://dynatrace.ai/coffeebreak

http://www.dynatrace.com/demos

Page 3: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

Dev Perf/Test Ops Biz

Shift-Left: Break Pipeline Earlier

Path to NoOps: Self-Healing, …

Shift-Right: Tags, Deploys, Events

Actionable Feedback Loops

Page 4: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

Shift-Right: Tags, Deployments & Events

docker run –e DT_TAGS=BLUE

dtcli tag srv CartServicev2 GREEN

dtcli evt push host .*demo

version=123 source={git_commit}

dtcli evt push pg tomcat1

desc=JVMMemIncr hint=+100MB

Dynatrace SmartscapeRelease

AutomationDynatrace Automation

API, CLI, Auto-Detection

Page 5: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

AWS DevOps Tutorial: Defining Tags via Environment Variables

#1 Copies to EC2 & Extracts

#2 Executes start_server.sh:

export DT_TAGS=APPLICATION_NAME=$APPLICATION_NAME

export DT_CUSTOM_PROP="DEPLOYMENT_ID=$DEPLOYMENT_ID DEPLOYMENT_GROUP_NAME=$DEPLOYMENT_GROUP_NAME

APPLICATION_NAME=$APPLICATION_NAME“

export DT_CLUSTER_ID="$DEPLOYMENT_GROUP_NAME $APPLICATION_NAME“

pm2 start app.js &> pm2start.log

#2 DT_CUSTOM_PROP

#2 DT_CLUSTER_ID

#2 DT_TAGS

Page 6: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

AWS DevOps Tutorial: Defining Service Tags via Naming Rule

#1

#2 – Call the Tag “DeploymentGroup”

#3 – For Services

#4– Tag Value comes from our Process Environment Variable

#5 – Only apply rule if env variable exists

Page 7: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

AWS DevOps Tutorial: Push CodePipeline Deployment Events to Dynatrace

pushDynatraceDeploymentEventPushes CodePipelineInfo to Dynatrace

Dynatrace Events REST API

+ CodeDeploy Information from same Stage

Page 8: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

AWS DevOps Tutorial: Push CodePipeline Deployment Events to Dynatrace

Monspec (Monitoring as Code)

"SampleJSonService" : {

"etype": "SERVICE",

"environments" : {

"Staging" : {

"tags" : [

{

"context": "CONTEXTLESS",

"key": "DeploymentGroup",

"value": "Staging"

}

]

},

"Production" : {

"tags" : [

{

"context": "CONTEXTLESS",

"key": "DeploymentGroup",

"value": "Production"

}

]

}

},

pushDynatraceDeploymentEvent

Pulls Tag Information from Monspec

Dynatrace Events REST API

Pushes Event for Entities with Tag DeploymentGroup:Staging

Page 9: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

Shift-Left: Continuous Performance Validationc0123bd

myservice:nov17

space:PERF

myservice:nov17

space:PERF

myservice:nov17myservice:nov16 space:PROD

myservice:BLUE

myservice:GREEN

myservice:nov17

space:PROD

myservice:BLUE

myservice:GREEN

space:PROD

myservice:nov16

nov17

Page 10: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

Continuous Performance: Inspired by Dynatrace Performance Architect Team

“Performance Signature”for Build Nov 16

“Performance Signature” for Build Nov 17

“Performance Signature” for every Build

“Multiple Metrics” compared to prev

Timeframe

Simple Regression Detection per Metric

Page 11: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

“Monspec”: Performance Signature as Code for Continuous Performance Validation

Entity: SampleJSonService

Environment: StagingTag: DeploymentGroup:Staging

Environment: ProductionTag: DeploymentGroup:Production

Compare: StagingToProductionSource: Staging; Compare: ProdFactor: Staging = 10% Slower

Compare: StagingToProdYesterdaySource: Staging; Compare: ProdFactor: 10%, Timeshift: 86400s

Compare: StagingToStagingLastHourSource: Staging; Compare: Staging

Factor: 0; Timeshift: 3600s

Compare: StageToStageYesterdaySource: Staging; Compare: Staging

Factor: 0; Timeshift: 86400s

Metrics: ResponseTime (Avg) Metrics: ResponseTime(Max) < 10s Metrics: FailureRate(Avg)Metrics: ResponseCount

Factor: 90% Less vs Production

Environment: Staging Environment: Production

Source (Staging): 1.64ms

Compare (Production): 1.41ms

Threshold (+10%): 1.56ms

Status: VIOLATION

Pipeline Run: Validate Build with StagingToProduction

Page 12: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

“Monspec”: Continuous Build Validation in Action across Pipeline runs!

Run

#1

Run

#2

Run

#3

Run

#4

Run

#5

Run

#6

Run

#7

Page 13: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

“Monitoring as Code”: A look into monspec.json

monspec.json

{

"SampleJSonService" : {

"etype": "SERVICE", // "Options are SERVICE, APPLICATION, HOST, PROCESS_GROUP_INSTANCE"

"name": "SampleNodeJsService",

"environments" : {

"Staging" : {

"tags" : [

{

"context": "CONTEXTLESS",

"key": "DeploymentGroup",

"value": "Staging"

}

]

},

"Production" : {

"tags" : [

{

"context": "CONTEXTLESS",

"key": "DeploymentGroup",

"value": "Production"

}

]

}

},

Environments: Tell us how we can detect these entities in Dynatrace

Entity: What Entity do we want to validate?

Page 14: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

“Monitoring as Code”: A look into monspec.json

monspec.json

{

"SampleJSonService" : {

...

"comparisons" : [

{

"name" : "StagingToProduction",

"source" : "Staging",

"compare" : "Production",

"scalefactorperc" : {

"default": 10,

"com.dynatrace.builtin:service.requestspermin" : 90

},

"shiftcomparetimeframe" : 0,

"shiftsourcetimeframe" : 0,

},

{

"name" : "StagingToProductionYesterday",

"source" : "Staging",

"compare" : "Production",

"scalefactorperc" : {

"default": 10,

"com.dynatrace.builtin:service.requestspermin" : 90

},

"shiftsourcetimeframe" : 0,

"shiftcomparetimeframe" : 86400

}

monspec.json

{

"SampleJSonService" : {

...

"comparisons" : [

{

"name" : "StagingToStagingLastHour",

"source" : "Staging",

"compare" : "Staging",

"scalefactorperc" : { "default": 0},

"shiftsourcetimeframe" : 0,

"shiftcomparetimeframe" : 3600

},

{

"name" : "ProductionToProductionLastH",

"source" : "Production",

"compare" : "Production",

"scalefactorperc" : { "default": 0},

"shiftsourcetimeframe" : 0,

"shiftcomparetimeframe" : 3600

}

],

Page 15: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

“Monitoring as Code”: A look into monspec.json

monspec.json

{

"SampleJSonService" : {

...

"perfsignature" : [

{

"timeseries" : "com.dynatrace.builtin:service.responsetime",

"aggregate" : "avg", // min, max, avg, sum, median, count, percentile

"validate" : "upper", // upper or lower

// "upperlimit" : 100, // Optional: Can be used to define a FIXED THRESHOLD

// "lowerlimit" : 50, // Optional: Can be used to define a FIXED THRESHOLD

},

{

"timeseries" : "com.dynatrace.builtin:service.responsetime",

"aggregate" : “p90"

},

{

"timeseries" : "com.dynatrace.builtin:service.failurerate",

"aggregate" : "avg"

},

{

"timeseries" : "com.dynatrace.builtin:service.requestspermin",

"aggregate" : "count",

“validate" : "lower"

}

],

Metrics: Which Metrics, Aggregation, Upper/Lower Boundaries

Page 16: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

Staging: Register Build Validation!

registerDynatraceBuildValidation

Adds Build Validation Request

Adds Item

Build Validation Request Item- Pipeline Information

- Monspec

- Timestamp + Timeframe

- Comparison Definition Name

validateBuildDynatraceWork CloudWatch Events

(e.g: 1min)

triggersApproves/Rejects IF “In Progress” & Comment Field contains name of RegisterBuildValidation Action

AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3

Dynatrace Entities & Timeseries REST API

Resolves Tags and gets list of Entities

Queries Metrics for these Entities

Updates Build Validation Request- Updated Monspec

- UpdatedStatus

Page 17: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

AWS DevOps Tutorial: Automating Approval Process

Page 18: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

AWS DevOps Tutorial: Build Validation Report

Open in Browser: http://YOURAPIGATEWAY.amazonaws.com/v1/BuildValidationResults

Page 19: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

Path to NoOps: Auto-Remediation, Self-Healing, …

Auto Mitigate!

1 CPU Exhausted? Add a new service instance!

3 Issue with BLUE only? Switch back to GREEN!

?Escalate at 2AM?

2 High Garbage Collection? Adjust/Revert Memory Settings!

4 Hung threads? Restart Service!

5 Still ongoing? Initiate Rollback!

Escalate? Still ongoing?5

1

2

3

4

Mark Bad Commits

Update Dev Tickets

Impact Mitigated??

?

Page 20: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

AWS DevOps Tutorial: Automate Rollback with AWS Lambda and AWS CodeDeploy

Push Deployment Information, e.g: CodeDeploy DeploymentId

Calling Lambda via API Gateway

handleDynatraceProblemNotification

Redeploy previous revision

Uses Dynatrace Events API

to pull CUSTOM_DEPLOYMENT events

Page 21: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

Additional DevOps Tricks!

Page 22: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

Service Naming Rules: Distinguish services between Staging and Production

#1

#2

DEPLOYMENT_GROUP_NAME/Detected ServiceName

#3

Only when DEPLOYMENT_GROUP_NAME exists

Page 23: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

Here is the result! Nicer Service Names!

Page 24: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

Log Rule Events: Automated Problem Detection based on custom Log Messages

Page 25: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

Log Rule Events: Automated Problem Detection based on custom Log Messages

Page 26: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

Log Rule Events: Automated Problem Detection based on custom Log Messages

Page 27: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

Log Rule Events: Automated Problem Detection based on custom Log Messages

Page 28: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

Log Rule Events: Automated Problem Detection based on custom Log Messages

Page 29: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

Actionable Feedback Loops: Business

Success Criteria

Labels become Key User Action

Live Data Queries

New Requirement Definition

Page 30: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags
Page 31: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags
Page 32: Cloud innovation and automation DevOps, Shift-Left & Self ... · AWS DevOps Tutorial: Integrate into Pipeline Monspec from S3 Dynatrace Entities & Timeseries REST API Resolves Tags

Thank you