SlideShare uma empresa Scribd logo
1 de 20
Baixar para ler offline
CQ5
HealthCheck
Automated self-testing
and health check
of live CQ instances
Bertrand Delacrétaz
Senior R&D Developer, Adobe Basel
@bdelacretaz, grep.codeconsult.ch
CQCon, Basel, June 2013
slides revision 2013-06-19
CQ5
HealthCheck Bertrand Delacrétaz, Adobe Basel
picture: anitapeppers on morguefile.com
Themore
configurable,the
morebreakable....let's
testitlive!
Agile software
needs
TESTING
CQ5
HealthCheck Bertrand Delacrétaz, Adobe Basel
Apache Sling Health Check
Webconsole plugin
Rules configured in content
Tagged rules
Webconsole and servlets
RuleBuilder OSGi services
ApacheSling
module,runsin
CQ5.5and
later
Muppet
CQ5
HealthCheck Bertrand Delacrétaz, Adobe Basel
JSON output selectors map to tags
no news (log) is good news!
Rule uses a Logger to complain
rule 1
rule 2
rules
CQ5
HealthCheck Bertrand Delacrétaz, Adobe Basel
Rule defined in content
$ curl -u admin:admin
http://localhost:4502/apps/hc/demo/inactive-bundles.tidy.json
{
"sling:resourceType": "sling/healthcheck/rules",
"namespace": "osgi",
"ruleName": "inactive.bundles.count",
"expression": "<= 3",
"tags": [
"bundles",
"osgi",
"sling"
],
"jcr:primaryType": "nt:unstructured"
}
Execute the osgi:inactive.bundles.count rule
and verify that its output is <= 3
The rules engine executes a tree of such definitions, optionally taking tags into account.
CQ5
HealthCheck Bertrand Delacrétaz, Adobe Basel
HTTP rule execution
$ curl -u admin:admin
http://localhost:4502/apps/hc/demo/inactive-bundles.healthcheck.json
{
"results": [{
"rule": "Rule: InactiveBundlesCount <= 3",
"info": [{
"sling.resource.path": "/apps/hc/demo/inactive-bundles"
}
],
"tags": [
"sling",
"bundles",
"osgi"
]
}
]
}
Rule path with .healthcheck selector
Works with single rules or trees
no news (log) is good news!
CQ5
HealthCheck Bertrand Delacrétaz, Adobe Basel
Rule scripts
$ curl -u admin:admin
http://localhost:4502/apps/hc/demo/script-that-passes.esp
# A rule script must output only TEST_PASSED,
# comments like this one and white space.
# Anything else is considered failure
#(as with the Sling testing tools)
TEST_PASSED
Currently executable only from a
sling/healthcheck/rules container resource.
#thesky
isthelimit
outof the
box
CQ5
HealthCheck Bertrand Delacrétaz, Adobe Basel
Out of the box rulesas of revision 1490454
JMX
beans attributes
jmxbeans:
org.apache.sling:
type=engine,
service=RequestProcessor
RequestsCount < 20
JUnit
tests
junit:
org.apache.sling.hc.demo.tests.ResourcesExistTest
(can use @TestReference for services)
OSGi
bundle
state
osgi:
bundle.state
org.apache.sling.startupfilter.disabler
= active
OSGi
inactive
bundles
osgi:
inactive.bundles.count < 3
Sling default
logins fail
sling:
loginfails
admin#admin
picture:mconnorsonmorguefile.com
Sling
scripts
/apps/hc/demo/somescript.esp
BYOR!
extensibili t y
CQ5
HealthCheck Bertrand Delacrétaz, Adobe Basel
Rule evaluates a SystemAttribute
CQ5
HealthCheck Bertrand Delacrétaz, Adobe Basel
RuleBuilder service builds Rules
check namespace
map ruleName to
SystemAttribute
build Rule
test:constant:5 = 5
namespace:ruleName:qualifier expr
CQ5
HealthCheck Bertrand Delacrétaz, Adobe Basel
DefaultEvaluator expressionscan use custom Evaluator as well
“Some string”
< 5
> 5
<= 5
>= 5
between 5 and 12
public interface Evaluator {
void evaluate(
SystemAttribute a,
String expression,
Logger logger);
}
CQ5
HealthCheck Bertrand Delacrétaz, Adobe Basel
Extensibility summary
Implement a SystemAttribute
getValue(Logger)
Register a RuleBuilder service
check names
build SystemAttribute + Rule
That’s it.
(optionally supply custom Evaluator)
similar
ideas
CQ5
HealthCheck Bertrand Delacrétaz, Adobe Basel
Joerg Hoh’s cq5-healthcheck
https://github.com/joerghoh/cq5-healthcheck
PID = de.joerghoh.cq5.healthcheck.MBeanStatusProvider.b9cb0c91-972b
mbean.name = com.adobe.granite.replication:type=agent,id="publish"
mbean.property = QueueNumEntries.warn.>.100
mbean.providerHint = Warn Queue length
MBean attribute value
ranges or custom
StatusProvider services
CQ:Page for status
Based on OSGi configs:
CQ5
HealthCheck Bertrand Delacrétaz, Adobe Basel
Davide Giannella’s sanitycheck
Adobe Internal github for now: dgiannel/sanitycheck
Servlets as sanity
check services.
CQ page components
for options, forms.
Checks remote CQ
instances via HTTP.
CQ pages to assemble
sanity check pages.
future
CQ5
HealthCheck
Future?
Implement CQ security checklist rules
Execute rules via JMX?
Scheduling of rules execution + reporting
Scheduling and time-based range checks, sampling
periods (thx Radu Cotescu)
Whatareyour
usecases?
Execute rules tagged “startup” at startup
and report or lock instance if WARN.
http://sling.apache.org/documentation/bundles/sling-health-check-tool.html
I’m @bdelacretaz - thanks for attending!
<YOUR IDEA HERE> or on the Apache Sling mailing lists

Mais conteúdo relacionado

Semelhante a Automated self-testing and health check of CQ and Sling instances

Semelhante a Automated self-testing and health check of CQ and Sling instances (20)

Spring batch for large enterprises operations
Spring batch for large enterprises operations Spring batch for large enterprises operations
Spring batch for large enterprises operations
 
What to expect from Java 9
What to expect from Java 9What to expect from Java 9
What to expect from Java 9
 
Why so continuous
Why so continuousWhy so continuous
Why so continuous
 
Test automation introduction training at Polteq
Test automation   introduction training at PolteqTest automation   introduction training at Polteq
Test automation introduction training at Polteq
 
Presto Testing Tools: Benchto & Tempto (Presto Boston Meetup 10062015)
Presto Testing Tools: Benchto & Tempto (Presto Boston Meetup 10062015)Presto Testing Tools: Benchto & Tempto (Presto Boston Meetup 10062015)
Presto Testing Tools: Benchto & Tempto (Presto Boston Meetup 10062015)
 
Maximizing Oracle RAC Uptime
Maximizing Oracle RAC UptimeMaximizing Oracle RAC Uptime
Maximizing Oracle RAC Uptime
 
WebSphere Technical University: Introduction to the Java Diagnostic Tools
WebSphere Technical University: Introduction to the Java Diagnostic ToolsWebSphere Technical University: Introduction to the Java Diagnostic Tools
WebSphere Technical University: Introduction to the Java Diagnostic Tools
 
Continuous Integration/ Continuous Delivery of web applications
Continuous Integration/ Continuous Delivery of web applicationsContinuous Integration/ Continuous Delivery of web applications
Continuous Integration/ Continuous Delivery of web applications
 
Everything as a Code / Александр Тарасов (Одноклассники)
Everything as a Code / Александр Тарасов (Одноклассники)Everything as a Code / Александр Тарасов (Одноклассники)
Everything as a Code / Александр Тарасов (Одноклассники)
 
Everything as a code
Everything as a codeEverything as a code
Everything as a code
 
PVS-Studio in the Clouds: CircleCI
PVS-Studio in the Clouds: CircleCIPVS-Studio in the Clouds: CircleCI
PVS-Studio in the Clouds: CircleCI
 
Web services with laravel
Web services with laravelWeb services with laravel
Web services with laravel
 
apidays Australia 2023 - Unlocking The Power: The Importance Of API Registrat...
apidays Australia 2023 - Unlocking The Power: The Importance Of API Registrat...apidays Australia 2023 - Unlocking The Power: The Importance Of API Registrat...
apidays Australia 2023 - Unlocking The Power: The Importance Of API Registrat...
 
Test Kitchen and Infrastructure as Code
Test Kitchen and Infrastructure as CodeTest Kitchen and Infrastructure as Code
Test Kitchen and Infrastructure as Code
 
Unit testing with Spock Framework
Unit testing with Spock FrameworkUnit testing with Spock Framework
Unit testing with Spock Framework
 
Continuous integration / continuous delivery
Continuous integration / continuous deliveryContinuous integration / continuous delivery
Continuous integration / continuous delivery
 
Come sta la nostra applicazione? Un viaggio alla scoperta degli Health Check ...
Come sta la nostra applicazione? Un viaggio alla scoperta degli Health Check ...Come sta la nostra applicazione? Un viaggio alla scoperta degli Health Check ...
Come sta la nostra applicazione? Un viaggio alla scoperta degli Health Check ...
 
Webinar | Building Apps with the Cassandra Python Driver
Webinar | Building Apps with the Cassandra Python DriverWebinar | Building Apps with the Cassandra Python Driver
Webinar | Building Apps with the Cassandra Python Driver
 
Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3
Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3
Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3
 
Web service with Laravel
Web service with LaravelWeb service with Laravel
Web service with Laravel
 

Mais de Bertrand Delacretaz

Mais de Bertrand Delacretaz (20)

VanillaJS & the Web Platform, a match made in heaven?
VanillaJS & the Web Platform, a match made in heaven?VanillaJS & the Web Platform, a match made in heaven?
VanillaJS & the Web Platform, a match made in heaven?
 
Surviving large online communities with conciseness and clarity
Surviving large online communities with conciseness and clarity Surviving large online communities with conciseness and clarity
Surviving large online communities with conciseness and clarity
 
Repoinit: a mini-language for content repository initialization
Repoinit: a mini-language for content repository initializationRepoinit: a mini-language for content repository initialization
Repoinit: a mini-language for content repository initialization
 
The Moving House Model, adhocracy and remote collaboration
The Moving House Model, adhocracy and remote collaborationThe Moving House Model, adhocracy and remote collaboration
The Moving House Model, adhocracy and remote collaboration
 
GraphQL in Apache Sling - but isn't it the opposite of REST?
GraphQL in Apache Sling - but isn't it the opposite of REST?GraphQL in Apache Sling - but isn't it the opposite of REST?
GraphQL in Apache Sling - but isn't it the opposite of REST?
 
Open Source Changes the World!
Open Source Changes the World!Open Source Changes the World!
Open Source Changes the World!
 
How to convince your left brain (or manager) to follow the Open Source path t...
How to convince your left brain (or manager) to follow the Open Source path t...How to convince your left brain (or manager) to follow the Open Source path t...
How to convince your left brain (or manager) to follow the Open Source path t...
 
L'Open Source change le Monde - BlendWebMix 2019
L'Open Source change le Monde - BlendWebMix 2019L'Open Source change le Monde - BlendWebMix 2019
L'Open Source change le Monde - BlendWebMix 2019
 
Shared Neurons - the Secret Sauce of Open Source communities?
Shared Neurons - the Secret Sauce of Open Source communities?Shared Neurons - the Secret Sauce of Open Source communities?
Shared Neurons - the Secret Sauce of Open Source communities?
 
Sling and Serverless, Best Friends Forever?
Sling and Serverless, Best Friends Forever?Sling and Serverless, Best Friends Forever?
Sling and Serverless, Best Friends Forever?
 
Serverless - introduction et perspectives concrètes
Serverless - introduction et perspectives concrètesServerless - introduction et perspectives concrètes
Serverless - introduction et perspectives concrètes
 
State of the Feather - ApacheCon North America 2018
State of the Feather - ApacheCon North America 2018State of the Feather - ApacheCon North America 2018
State of the Feather - ApacheCon North America 2018
 
Karate, the black belt of HTTP API testing?
Karate, the black belt of HTTP API testing?Karate, the black belt of HTTP API testing?
Karate, the black belt of HTTP API testing?
 
Open Source at Scale: the Apache Software Foundation (2018)
Open Source at Scale: the Apache Software Foundation (2018)Open Source at Scale: the Apache Software Foundation (2018)
Open Source at Scale: the Apache Software Foundation (2018)
 
They don't understand me! Tales from the multi-cultural trenches
They don't understand me! Tales from the multi-cultural trenchesThey don't understand me! Tales from the multi-cultural trenches
They don't understand me! Tales from the multi-cultural trenches
 
Prise de Décisions Asynchrone, Devoxx France 2018 (avec vidéo)
Prise de Décisions Asynchrone, Devoxx France 2018 (avec vidéo)Prise de Décisions Asynchrone, Devoxx France 2018 (avec vidéo)
Prise de Décisions Asynchrone, Devoxx France 2018 (avec vidéo)
 
Project and Community Services the Apache Way
Project and Community Services the Apache WayProject and Community Services the Apache Way
Project and Community Services the Apache Way
 
La Fondation Apache - keynote au Paris Open Source Summit 2017
La Fondation Apache - keynote au Paris Open Source Summit 2017La Fondation Apache - keynote au Paris Open Source Summit 2017
La Fondation Apache - keynote au Paris Open Source Summit 2017
 
Asynchronous Decision Making - FOSS Backstage 2017
Asynchronous Decision Making - FOSS Backstage 2017Asynchronous Decision Making - FOSS Backstage 2017
Asynchronous Decision Making - FOSS Backstage 2017
 
Building an Apache Sling Rendering Farm
Building an Apache Sling Rendering FarmBuilding an Apache Sling Rendering Farm
Building an Apache Sling Rendering Farm
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

Automated self-testing and health check of CQ and Sling instances

  • 1. CQ5 HealthCheck Automated self-testing and health check of live CQ instances Bertrand Delacrétaz Senior R&D Developer, Adobe Basel @bdelacretaz, grep.codeconsult.ch CQCon, Basel, June 2013 slides revision 2013-06-19
  • 2. CQ5 HealthCheck Bertrand Delacrétaz, Adobe Basel picture: anitapeppers on morguefile.com Themore configurable,the morebreakable....let's testitlive! Agile software needs TESTING
  • 3. CQ5 HealthCheck Bertrand Delacrétaz, Adobe Basel Apache Sling Health Check Webconsole plugin Rules configured in content Tagged rules Webconsole and servlets RuleBuilder OSGi services ApacheSling module,runsin CQ5.5and later Muppet
  • 4. CQ5 HealthCheck Bertrand Delacrétaz, Adobe Basel JSON output selectors map to tags no news (log) is good news! Rule uses a Logger to complain rule 1 rule 2
  • 6. CQ5 HealthCheck Bertrand Delacrétaz, Adobe Basel Rule defined in content $ curl -u admin:admin http://localhost:4502/apps/hc/demo/inactive-bundles.tidy.json { "sling:resourceType": "sling/healthcheck/rules", "namespace": "osgi", "ruleName": "inactive.bundles.count", "expression": "<= 3", "tags": [ "bundles", "osgi", "sling" ], "jcr:primaryType": "nt:unstructured" } Execute the osgi:inactive.bundles.count rule and verify that its output is <= 3 The rules engine executes a tree of such definitions, optionally taking tags into account.
  • 7. CQ5 HealthCheck Bertrand Delacrétaz, Adobe Basel HTTP rule execution $ curl -u admin:admin http://localhost:4502/apps/hc/demo/inactive-bundles.healthcheck.json { "results": [{ "rule": "Rule: InactiveBundlesCount <= 3", "info": [{ "sling.resource.path": "/apps/hc/demo/inactive-bundles" } ], "tags": [ "sling", "bundles", "osgi" ] } ] } Rule path with .healthcheck selector Works with single rules or trees no news (log) is good news!
  • 8. CQ5 HealthCheck Bertrand Delacrétaz, Adobe Basel Rule scripts $ curl -u admin:admin http://localhost:4502/apps/hc/demo/script-that-passes.esp # A rule script must output only TEST_PASSED, # comments like this one and white space. # Anything else is considered failure #(as with the Sling testing tools) TEST_PASSED Currently executable only from a sling/healthcheck/rules container resource. #thesky isthelimit
  • 10. CQ5 HealthCheck Bertrand Delacrétaz, Adobe Basel Out of the box rulesas of revision 1490454 JMX beans attributes jmxbeans: org.apache.sling: type=engine, service=RequestProcessor RequestsCount < 20 JUnit tests junit: org.apache.sling.hc.demo.tests.ResourcesExistTest (can use @TestReference for services) OSGi bundle state osgi: bundle.state org.apache.sling.startupfilter.disabler = active OSGi inactive bundles osgi: inactive.bundles.count < 3 Sling default logins fail sling: loginfails admin#admin picture:mconnorsonmorguefile.com Sling scripts /apps/hc/demo/somescript.esp BYOR!
  • 12. CQ5 HealthCheck Bertrand Delacrétaz, Adobe Basel Rule evaluates a SystemAttribute
  • 13. CQ5 HealthCheck Bertrand Delacrétaz, Adobe Basel RuleBuilder service builds Rules check namespace map ruleName to SystemAttribute build Rule test:constant:5 = 5 namespace:ruleName:qualifier expr
  • 14. CQ5 HealthCheck Bertrand Delacrétaz, Adobe Basel DefaultEvaluator expressionscan use custom Evaluator as well “Some string” < 5 > 5 <= 5 >= 5 between 5 and 12 public interface Evaluator { void evaluate( SystemAttribute a, String expression, Logger logger); }
  • 15. CQ5 HealthCheck Bertrand Delacrétaz, Adobe Basel Extensibility summary Implement a SystemAttribute getValue(Logger) Register a RuleBuilder service check names build SystemAttribute + Rule That’s it. (optionally supply custom Evaluator)
  • 17. CQ5 HealthCheck Bertrand Delacrétaz, Adobe Basel Joerg Hoh’s cq5-healthcheck https://github.com/joerghoh/cq5-healthcheck PID = de.joerghoh.cq5.healthcheck.MBeanStatusProvider.b9cb0c91-972b mbean.name = com.adobe.granite.replication:type=agent,id="publish" mbean.property = QueueNumEntries.warn.>.100 mbean.providerHint = Warn Queue length MBean attribute value ranges or custom StatusProvider services CQ:Page for status Based on OSGi configs:
  • 18. CQ5 HealthCheck Bertrand Delacrétaz, Adobe Basel Davide Giannella’s sanitycheck Adobe Internal github for now: dgiannel/sanitycheck Servlets as sanity check services. CQ page components for options, forms. Checks remote CQ instances via HTTP. CQ pages to assemble sanity check pages.
  • 20. CQ5 HealthCheck Future? Implement CQ security checklist rules Execute rules via JMX? Scheduling of rules execution + reporting Scheduling and time-based range checks, sampling periods (thx Radu Cotescu) Whatareyour usecases? Execute rules tagged “startup” at startup and report or lock instance if WARN. http://sling.apache.org/documentation/bundles/sling-health-check-tool.html I’m @bdelacretaz - thanks for attending! <YOUR IDEA HERE> or on the Apache Sling mailing lists