SlideShare uma empresa Scribd logo
1 de 18
Code Instrumentation
Mennan Tekbir
20-Aug’13
A Real Life Experience
• A person has sent an mail to the C levels of company
about a complaint.
• Then the request comes top level to the down.( CEO -
> CTO -> Director -> Dept. Man -> Man -> Developer )
• The developer, analyze the code but unable to find
any information about the complaint. Because the
complaint was about a situation that happened 4
months ago.
• Analyze, code reading, testing, again code reading, …
• A few days later, the problem has been solved.
• … but a few days have been passed
• …
not instrumented code
FUNCTION ExecuteWebService
(
pic_RequestXML IN NCLOB,
pis_ServiceName IN VARCHAR2,
pis_ChannelName IN VARCHAR2,
pin_TransactionId IN NUMBER
) RETURN INTEGER
...
...
BEGIN
...
...
vs_SOAPEnvelopeXMLNS := 'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"';
vs_SOAPFaultXPATH := '/soap:Envelope/soap:Body/soap:Fault';
...
...
RETURN cn_SUCCESS;
EXCEPTION
WHEN OTHERS THEN
...
...
RETURN cn_FAILURE;
END;
instrumentation[1] : Add Trace information into the
code(function calls, input parameters etc.)
FUNCTION ExecuteWebService
(
pic_RequestXML IN NCLOB,
pis_ServiceName IN VARCHAR2,
pis_ChannelName IN VARCHAR2,
pin_TransactionId IN NUMBER
) RETURN INTEGER
...
...
BEGIN
LogInfo( 'Executing ExecuteWebService function.' );
LogInfo('[ServiceName,ChannelName,TransactionId]');
LogInfo( '[' || pis_ServiceName || ',' || pis_ChannelName || ',' || pin_TransactionId || ']' );
...
...
vs_SOAPEnvelopeXMLNS := 'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"';
vs_SOAPFaultXPATH := '/soap:Envelope/soap:Body/soap:Fault';
...
...
RETURN cn_SUCCESS;
EXCEPTION
WHEN OTHERS THEN
...
...
RETURN cn_FAILURE;
END;
instrumentation[2] : Add Debug information into the
code(Error code, exception messages etc)
FUNCTION ExecuteWebService
(
pic_RequestXML IN NCLOB,
pis_ServiceName IN VARCHAR2,
pis_ChannelName IN VARCHAR2,
pin_TransactionId IN NUMBER
) RETURN INTEGER
...
...
BEGIN
LogInfo( 'Executing ExecuteWebService function.' );
LogInfo('[ServiceName,ChannelName,TransactionId]');
LogInfo( '[' || pis_ServiceName || ',' || pis_ChannelName || ',' || pin_TransactionId || ']' );
...
...
vs_SOAPEnvelopeXMLNS := 'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"';
vs_SOAPFaultXPATH := '/soap:Envelope/soap:Body/soap:Fault';
...
...
RETURN cn_SUCCESS;
EXCEPTION
WHEN OTHERS THEN
...
...
vs_ErrorMessage := 'Error in ExecuteWebService function :' || SQLERRM;
vs_ErrorMessage := vs_ErrorMessage || cs_NEWLINE || dbms_utility.format_error_backtrace;
vs_ErrorMessage := vs_ErrorMessage || cs_NEWLINE || 'UTL_HTTP Detail SQL Code = ' || vs_DetailSQLCode;
vs_ErrorMessage := vs_ErrorMessage || cs_NEWLINE || 'UTL_HTTP Detail SQL Message = ' || vs_DetailSQLMessage;
LogError(vs_ErrorMessage );
RETURN cn_FAILURE;
END;
instrumentation[3] : Add Performance information into
the code(performance counters, timing and profiling)
FUNCTION ExecuteWebService
(
pic_RequestXML IN NCLOB,
pis_ServiceName IN VARCHAR2,
pis_ChannelName IN VARCHAR2,
pin_TransactionId IN NUMBER
) RETURN INTEGER
...
...
BEGIN
SetStartTime();
LogInfo( 'Executing ExecuteWebService function.' );
LogInfo('[ServiceName,ChannelName,TransactionId]');
LogInfo( '[' || pis_ServiceName || ',' || pis_ChannelName || ',' || pin_TransactionId || ']' );
...
...
SetStatistics('INIT');
vs_SOAPEnvelopeXMLNS := 'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"';
vs_SOAPFaultXPATH := '/soap:Envelope/soap:Body/soap:Fault';
...
...
RETURN cn_SUCCESS;
EXCEPTION
WHEN OTHERS THEN
...
...
vs_ErrorMessage := 'Error in ExecuteWebService function :' || SQLERRM;
vs_ErrorMessage := vs_ErrorMessage || cs_NEWLINE || dbms_utility.format_error_backtrace;
vs_ErrorMessage := vs_ErrorMessage || cs_NEWLINE || 'UTL_HTTP Detail SQL Code = ' || vs_DetailSQLCode;
vs_ErrorMessage := vs_ErrorMessage || cs_NEWLINE || 'UTL_HTTP Detail SQL Message = ' || vs_DetailSQLMessage;
LogError(vs_ErrorMessage );
RETURN cn_FAILURE;
END;
Please, please, please instrument your code![*]
• Dev: Why is this call failing?
• Me: What are the parameter values you are calling it with in your code?
• Dev: Values X, Y and Z.
• Me: Have you called the routine directly with those values?
• Dev: Yes, and it worked fine.
• Me: That would suggest those are not the values you are really using then.
• Dev: But they are.
• Me: How do you know. Have to traced the variable values before you made the call.
• Dev: No, but they are the correct values.
• Me: Can you put in some trace messages to check?
• Dev: (walks away) … grumble … grumble … stupid trace … wasting my time …
• Me: (some time later) So what values were you passing in?
• Dev: One of the values was not what I was expecting, which is why it broke.
No matter who you are or how cool you think you are at programming,
you can never know exactly what is going on in your code unless you
instrument it. Just shut up and do it!
Experience tells me you will read this and ignore it, but that is a big
mistake! A real professional *always* comments and instruments their
code!
[*] : from Tim Hall
Definition
From Wikipedia, the free encyclopedia
• In context of computer programming, instrumentation
refers to an ability to monitor or measure the level of a
product's performance, to diagnose errors and to write
trace information.
• Programmers implement instrumentation in the form of
code instructions that monitor specific components in a
system (for example, instructions may output logging
information to appear on screen).
• When an application contains instrumentation code, it can
be managed using a management tool.
• Instrumentation is necessary to review the performance of
the application.
• Instrumentation approaches can be of two types, source
instrumentation and binary instrumentation.
Definition – cont.
In programming, instrumentation means the ability of an application to
incorporate:
• Code tracing - receiving informative messages about the execution of
an application at run time.
• Debugging and (structured) exception handling - tracking down and
fixing programming errors in an application under development.
• Profiling (computer programming) - a means by which dynamic
program behaviors can be measured during a training run with a
representative input. This is useful for properties of a program which
cannot be analyzed statically with sufficient precision, such as alias
analysis.
• Performance counters - components that allow the tracking of the
performance of the application.
• Computer data logging - components that allow the logging and
tracking of major events in the execution of the application.
http://softfluent.files.wordpress.com/2012/06/image.png
Our case against debugging[*]
• We have reproduced this experience several times,
with various customers, and noticed that about 50%
of project time is spent debugging and not
producing code. And we are not even talking about
the testing process here. Amazingly, we have
recently seen a question on a LinkedIn group about
the time spent in debugging, and 50% was the
number mentioned as the first response to this
thread by a developer. By the way, we need to
congratulate the guy for pulling out this number as
he is fully aware of where his time goes, which
obviously is not the case for many developers.
[*] from http://blog.softfluent.com/2011/04/20/our-case-against-debugging/
Our case against debugging – cont.
• The main reason would be obvious to a financial guy. It
is the "capex" versus "opex" difference. Debugging is an
operational expense. Once you closed the debugger, all
that you have learned vanishes and your time has been
spent without any remaining value. As a comparison,
imagine you have spent the same time putting
appropriate tracing in relevant functions, outputting the
key parameter values to a relevant file in a manner that
can be reproduced and configured. You will get the same
benefits as a developer to check that your program does
what it should and detect potential mistakes. But at the
same time, you will have prepared future analysis once
the program evolves. Tracing is a capital expense.
Our case against debugging – cont.
• Pushing the reasoning a bit further, one can
easily understand that this is also a matter
of team versus individual vision. The investment
put in tracing will benefit to everybody while the
debugging approach is an individual process that
cannot easily be shared. As an example, I had a
"magnetic resonance imaging" exam last month,
and I was surprised and happy that all this exam
was actually recorded and given to me on a CD. I
am now able to share it with my usual doctor as
well as any specialist that I would like to have a
second look at the exam.
Our case against debugging – cont.
• Similarly, it is also a matter of developer machine versus
production environment. As computing gets more and
more complex, with server-based and cloud-based
infrastructure, as well as load-balancing or security
constraints, the developer desktop – although simulating
those infrastructures – will more and more differ from the
real execution context. The risk of not being able to debug
some scenarios is higher and tracing is often the only real
option to understand what is happening. By the way, think
about what is happening with airplanes. We have very
powerful simulators that can simulate anything one can
imagine. Still, we put black boxes in aircrafts to
understand what happened under unpredicted
circumstances. So tracing has to be done anyway.
Effective Code Instrumentation? [*]
From Achilles : All too often I read statements about some new
framework and their "benchmarks." My question is a general one
but to the specific points of:
1. What approach should a developer take to effectively
instrument code to measure performance?
2. When reading about benchmarks and performance testing, what
are some red-flags to watch out for that might not represent real
results?
And best answer from : Patrick
There are two methods of measuring performance: using code
instrumentation and using sampling… (please read the
conversation..)
[*] : from http://stackoverflow.com/questions/2345081/effective-code-instrumentation
Instrumentation [*]
• To the developers that say “this is extra code that will just make my code
run slower” I respond “well fine, we will take away V$ views, there will be
no SQL_TRACE, no 10046 level 12 traces, in fact – that entire events
subsystem in Oracle, it is gone”. Would Oracle run faster without this
stuff? Undoubtedly – not. It would run many times slower, perhaps
hundreds of times slower. Why? Because you would have no clue where to
look to find performance related issues. You would have nothing to go
on. Without this “overhead” (air quotes intentionally used to denote
sarcasm there), Oracle would not have a chance of performing as well as it
does. Because you would not have a change to make it perform
well. Because you would not know where even to begin.
• So, a plea to all developers, get on the instrumentation bandwagon. You’ll
find your code easier to debug (note how Oracle doesn’t fly a developer to
your site to debug the kernel, there is enough instrumentation to do it
remotely). You’ll find your code easier to tune. You’ll find your code easier
to maintain over time. Also, make this instrumentation part of the
production code, don’t leave it out! Why? Because, funny thing about
production – you are not allowed to drop in “debug” code at the drop of a
hat, but you are allowed to update a row in a configuration table, or in a
configuration file! Your trace code, like Oracle’s should always be there, just
waiting to be enabled.
[*] : from Tom Kyte
How to Instrument
• Use database tables for logging, tracing and performance counters.
Archive these log information, when it is not frequently analyzed. If not
necessary, erase these table data, otherwise DBAs will complain.
• It can also be used file system(utl_file package) for logging. But note
that, database tables are very easy to analyze and query.
• Use Oracle’s built-in tools for performance monitoring and profiling.
(Statspack, AWR reports, PL/SQL Hierarcihal Profiler etc)
• Only log, necessary information. These log records are read by human
eyes. Tons of log information are very difficult to read and analyze.
• Please analyze the log and trace information. Be proactive. Take actions
before something goes wrong.
• Instrumentation shall be a quality issue and shall not be skipped. It is a
code dicipline.
• In Code Review process, reviewer shall mark un-instrumented code.
Ref..
• http://en.wikipedia.org/wiki/Instrumentation_(computer_programming)
• http://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/Instru
mentsUserGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40004652-CH1-
SW1
• http://blog.softfluent.com/2012/06/04/code-instrumentation-best-practices/
• http://blog.softfluent.com/2011/04/20/our-case-against-debugging/
• http://www.oracle-base.com/blog/2013/08/16/please-please-please-instrument-your-code/
• http://msdn.microsoft.com/en-us/library/aa983649(v=vs.71).aspx
• http://stackoverflow.com/questions/2345081/effective-code-instrumentation

Mais conteúdo relacionado

Mais procurados

Clickhouse MeetUp@ContentSquare - ContentSquare's Experience Sharing
Clickhouse MeetUp@ContentSquare - ContentSquare's Experience SharingClickhouse MeetUp@ContentSquare - ContentSquare's Experience Sharing
Clickhouse MeetUp@ContentSquare - ContentSquare's Experience SharingVianney FOUCAULT
 
한국어 문서 추출요약 AI 경진대회- 좌충우돌 후기
한국어 문서 추출요약 AI 경진대회- 좌충우돌 후기한국어 문서 추출요약 AI 경진대회- 좌충우돌 후기
한국어 문서 추출요약 AI 경진대회- 좌충우돌 후기Hangil Kim
 
OSMC 2022 | The Power of Metrics, Logs & Traces with Open Source by Emil-Andr...
OSMC 2022 | The Power of Metrics, Logs & Traces with Open Source by Emil-Andr...OSMC 2022 | The Power of Metrics, Logs & Traces with Open Source by Emil-Andr...
OSMC 2022 | The Power of Metrics, Logs & Traces with Open Source by Emil-Andr...NETWAYS
 
Testen mit, durch und in Scrum
Testen mit, durch und in ScrumTesten mit, durch und in Scrum
Testen mit, durch und in ScrumFrank Düsterbeck
 
High Available Task Scheduling Design using Kafka and Kafka Streams | Naveen ...
High Available Task Scheduling Design using Kafka and Kafka Streams | Naveen ...High Available Task Scheduling Design using Kafka and Kafka Streams | Naveen ...
High Available Task Scheduling Design using Kafka and Kafka Streams | Naveen ...HostedbyConfluent
 
RPC에서 REST까지 간단한 개념소개
RPC에서 REST까지 간단한 개념소개RPC에서 REST까지 간단한 개념소개
RPC에서 REST까지 간단한 개념소개Wonchang Song
 
Interactive real-time dashboards on data streams using Kafka, Druid, and Supe...
Interactive real-time dashboards on data streams using Kafka, Druid, and Supe...Interactive real-time dashboards on data streams using Kafka, Druid, and Supe...
Interactive real-time dashboards on data streams using Kafka, Druid, and Supe...DataWorks Summit
 
GPT : Generative Pre-Training Model
GPT : Generative Pre-Training ModelGPT : Generative Pre-Training Model
GPT : Generative Pre-Training ModelZimin Park
 
Server monitoring using grafana and prometheus
Server monitoring using grafana and prometheusServer monitoring using grafana and prometheus
Server monitoring using grafana and prometheusCeline George
 
GraphQL Advanced
GraphQL AdvancedGraphQL Advanced
GraphQL AdvancedLeanIX GmbH
 
Network embedding
Network embeddingNetwork embedding
Network embeddingSOYEON KIM
 
Data engineering zoomcamp introduction
Data engineering zoomcamp  introductionData engineering zoomcamp  introduction
Data engineering zoomcamp introductionAlexey Grigorev
 
현업 엔지니어의 시각에서 본 알고리즘 공부의 장점과 단점
현업 엔지니어의 시각에서 본 알고리즘 공부의 장점과 단점현업 엔지니어의 시각에서 본 알고리즘 공부의 장점과 단점
현업 엔지니어의 시각에서 본 알고리즘 공부의 장점과 단점Wonha Ryu
 
Training Week: Create a Knowledge Graph: A Simple ML Approach
Training Week: Create a Knowledge Graph: A Simple ML Approach Training Week: Create a Knowledge Graph: A Simple ML Approach
Training Week: Create a Knowledge Graph: A Simple ML Approach Neo4j
 
Introduction to Named Entity Recognition
Introduction to Named Entity RecognitionIntroduction to Named Entity Recognition
Introduction to Named Entity RecognitionTomer Lieber
 
Tracking and business intelligence
Tracking and business intelligenceTracking and business intelligence
Tracking and business intelligenceSebastian Schleicher
 
Argo Workflows 3.0, a detailed look at what’s new from the Argo Team
Argo Workflows 3.0, a detailed look at what’s new from the Argo TeamArgo Workflows 3.0, a detailed look at what’s new from the Argo Team
Argo Workflows 3.0, a detailed look at what’s new from the Argo TeamLibbySchulze
 

Mais procurados (20)

Clickhouse MeetUp@ContentSquare - ContentSquare's Experience Sharing
Clickhouse MeetUp@ContentSquare - ContentSquare's Experience SharingClickhouse MeetUp@ContentSquare - ContentSquare's Experience Sharing
Clickhouse MeetUp@ContentSquare - ContentSquare's Experience Sharing
 
Power-up services with gRPC
Power-up services with gRPCPower-up services with gRPC
Power-up services with gRPC
 
한국어 문서 추출요약 AI 경진대회- 좌충우돌 후기
한국어 문서 추출요약 AI 경진대회- 좌충우돌 후기한국어 문서 추출요약 AI 경진대회- 좌충우돌 후기
한국어 문서 추출요약 AI 경진대회- 좌충우돌 후기
 
OSMC 2022 | The Power of Metrics, Logs & Traces with Open Source by Emil-Andr...
OSMC 2022 | The Power of Metrics, Logs & Traces with Open Source by Emil-Andr...OSMC 2022 | The Power of Metrics, Logs & Traces with Open Source by Emil-Andr...
OSMC 2022 | The Power of Metrics, Logs & Traces with Open Source by Emil-Andr...
 
New relic
New relicNew relic
New relic
 
Testen mit, durch und in Scrum
Testen mit, durch und in ScrumTesten mit, durch und in Scrum
Testen mit, durch und in Scrum
 
High Available Task Scheduling Design using Kafka and Kafka Streams | Naveen ...
High Available Task Scheduling Design using Kafka and Kafka Streams | Naveen ...High Available Task Scheduling Design using Kafka and Kafka Streams | Naveen ...
High Available Task Scheduling Design using Kafka and Kafka Streams | Naveen ...
 
New relic
New relicNew relic
New relic
 
RPC에서 REST까지 간단한 개념소개
RPC에서 REST까지 간단한 개념소개RPC에서 REST까지 간단한 개념소개
RPC에서 REST까지 간단한 개념소개
 
Interactive real-time dashboards on data streams using Kafka, Druid, and Supe...
Interactive real-time dashboards on data streams using Kafka, Druid, and Supe...Interactive real-time dashboards on data streams using Kafka, Druid, and Supe...
Interactive real-time dashboards on data streams using Kafka, Druid, and Supe...
 
GPT : Generative Pre-Training Model
GPT : Generative Pre-Training ModelGPT : Generative Pre-Training Model
GPT : Generative Pre-Training Model
 
Server monitoring using grafana and prometheus
Server monitoring using grafana and prometheusServer monitoring using grafana and prometheus
Server monitoring using grafana and prometheus
 
GraphQL Advanced
GraphQL AdvancedGraphQL Advanced
GraphQL Advanced
 
Network embedding
Network embeddingNetwork embedding
Network embedding
 
Data engineering zoomcamp introduction
Data engineering zoomcamp  introductionData engineering zoomcamp  introduction
Data engineering zoomcamp introduction
 
현업 엔지니어의 시각에서 본 알고리즘 공부의 장점과 단점
현업 엔지니어의 시각에서 본 알고리즘 공부의 장점과 단점현업 엔지니어의 시각에서 본 알고리즘 공부의 장점과 단점
현업 엔지니어의 시각에서 본 알고리즘 공부의 장점과 단점
 
Training Week: Create a Knowledge Graph: A Simple ML Approach
Training Week: Create a Knowledge Graph: A Simple ML Approach Training Week: Create a Knowledge Graph: A Simple ML Approach
Training Week: Create a Knowledge Graph: A Simple ML Approach
 
Introduction to Named Entity Recognition
Introduction to Named Entity RecognitionIntroduction to Named Entity Recognition
Introduction to Named Entity Recognition
 
Tracking and business intelligence
Tracking and business intelligenceTracking and business intelligence
Tracking and business intelligence
 
Argo Workflows 3.0, a detailed look at what’s new from the Argo Team
Argo Workflows 3.0, a detailed look at what’s new from the Argo TeamArgo Workflows 3.0, a detailed look at what’s new from the Argo Team
Argo Workflows 3.0, a detailed look at what’s new from the Argo Team
 

Semelhante a Code instrumentation

From Duke of DevOps to Queen of Chaos - Api days 2018
From Duke of DevOps to Queen of Chaos - Api days 2018From Duke of DevOps to Queen of Chaos - Api days 2018
From Duke of DevOps to Queen of Chaos - Api days 2018Christophe Rochefolle
 
Intro to C++ - Class 2 - Objects & Classes
Intro to C++ - Class 2 - Objects & ClassesIntro to C++ - Class 2 - Objects & Classes
Intro to C++ - Class 2 - Objects & ClassesBlue Elephant Consulting
 
Intro To C++ - Class 2 - An Introduction To C++
Intro To C++ - Class 2 - An Introduction To C++Intro To C++ - Class 2 - An Introduction To C++
Intro To C++ - Class 2 - An Introduction To C++Blue Elephant Consulting
 
Week 4 Assignment - Software Development PlanScenario-Your team has be.docx
Week 4 Assignment - Software Development PlanScenario-Your team has be.docxWeek 4 Assignment - Software Development PlanScenario-Your team has be.docx
Week 4 Assignment - Software Development PlanScenario-Your team has be.docxestefana2345678
 
Test-Driven Developments are Inefficient; Behavior-Driven Developments are a ...
Test-Driven Developments are Inefficient; Behavior-Driven Developments are a ...Test-Driven Developments are Inefficient; Behavior-Driven Developments are a ...
Test-Driven Developments are Inefficient; Behavior-Driven Developments are a ...Abdelkrim Boujraf
 
PVS-Studio and CppCat: An Interview with Andrey Karpov, the Project CTO and D...
PVS-Studio and CppCat: An Interview with Andrey Karpov, the Project CTO and D...PVS-Studio and CppCat: An Interview with Andrey Karpov, the Project CTO and D...
PVS-Studio and CppCat: An Interview with Andrey Karpov, the Project CTO and D...Andrey Karpov
 
What is going on - Application diagnostics on Azure - TechDays Finland
What is going on - Application diagnostics on Azure - TechDays FinlandWhat is going on - Application diagnostics on Azure - TechDays Finland
What is going on - Application diagnostics on Azure - TechDays FinlandMaarten Balliauw
 
We continue checking Microsoft projects: analysis of PowerShell
We continue checking Microsoft projects: analysis of PowerShellWe continue checking Microsoft projects: analysis of PowerShell
We continue checking Microsoft projects: analysis of PowerShellPVS-Studio
 
JavaOne 2015: Top Performance Patterns Deep Dive
JavaOne 2015: Top Performance Patterns Deep DiveJavaOne 2015: Top Performance Patterns Deep Dive
JavaOne 2015: Top Performance Patterns Deep DiveAndreas Grabner
 
Automotive Cybersecurity: Test Like a Hacker
Automotive Cybersecurity: Test Like a HackerAutomotive Cybersecurity: Test Like a Hacker
Automotive Cybersecurity: Test Like a HackerForAllSecure
 
Production Debugging at Code Camp Philly
Production Debugging at Code Camp PhillyProduction Debugging at Code Camp Philly
Production Debugging at Code Camp PhillyBrian Lyttle
 
Пирамида Тестирования через призму ROI калькулятора и прочая геометрия
Пирамида Тестирования через призму ROI калькулятора и прочая геометрияПирамида Тестирования через призму ROI калькулятора и прочая геометрия
Пирамида Тестирования через призму ROI калькулятора и прочая геометрияSQALab
 
Test Pyramid vs Roi
Test Pyramid vs Roi Test Pyramid vs Roi
Test Pyramid vs Roi COMAQA.BY
 
Monitoring As Code: How to Integrate App Monitoring Into Your Developer Cycle
Monitoring As Code: How to Integrate App Monitoring Into Your Developer CycleMonitoring As Code: How to Integrate App Monitoring Into Your Developer Cycle
Monitoring As Code: How to Integrate App Monitoring Into Your Developer CycleAtlassian
 

Semelhante a Code instrumentation (20)

From Duke of DevOps to Queen of Chaos - Api days 2018
From Duke of DevOps to Queen of Chaos - Api days 2018From Duke of DevOps to Queen of Chaos - Api days 2018
From Duke of DevOps to Queen of Chaos - Api days 2018
 
Intro to C++ - Class 2 - Objects & Classes
Intro to C++ - Class 2 - Objects & ClassesIntro to C++ - Class 2 - Objects & Classes
Intro to C++ - Class 2 - Objects & Classes
 
Intro To C++ - Class 2 - An Introduction To C++
Intro To C++ - Class 2 - An Introduction To C++Intro To C++ - Class 2 - An Introduction To C++
Intro To C++ - Class 2 - An Introduction To C++
 
Pragmatic Code Coverage
Pragmatic Code CoveragePragmatic Code Coverage
Pragmatic Code Coverage
 
Week 4 Assignment - Software Development PlanScenario-Your team has be.docx
Week 4 Assignment - Software Development PlanScenario-Your team has be.docxWeek 4 Assignment - Software Development PlanScenario-Your team has be.docx
Week 4 Assignment - Software Development PlanScenario-Your team has be.docx
 
Test-Driven Developments are Inefficient; Behavior-Driven Developments are a ...
Test-Driven Developments are Inefficient; Behavior-Driven Developments are a ...Test-Driven Developments are Inefficient; Behavior-Driven Developments are a ...
Test-Driven Developments are Inefficient; Behavior-Driven Developments are a ...
 
PVS-Studio and CppCat: An Interview with Andrey Karpov, the Project CTO and D...
PVS-Studio and CppCat: An Interview with Andrey Karpov, the Project CTO and D...PVS-Studio and CppCat: An Interview with Andrey Karpov, the Project CTO and D...
PVS-Studio and CppCat: An Interview with Andrey Karpov, the Project CTO and D...
 
What is going on - Application diagnostics on Azure - TechDays Finland
What is going on - Application diagnostics on Azure - TechDays FinlandWhat is going on - Application diagnostics on Azure - TechDays Finland
What is going on - Application diagnostics on Azure - TechDays Finland
 
OOSE UNIT-1.pdf
OOSE UNIT-1.pdfOOSE UNIT-1.pdf
OOSE UNIT-1.pdf
 
We continue checking Microsoft projects: analysis of PowerShell
We continue checking Microsoft projects: analysis of PowerShellWe continue checking Microsoft projects: analysis of PowerShell
We continue checking Microsoft projects: analysis of PowerShell
 
JavaOne 2015: Top Performance Patterns Deep Dive
JavaOne 2015: Top Performance Patterns Deep DiveJavaOne 2015: Top Performance Patterns Deep Dive
JavaOne 2015: Top Performance Patterns Deep Dive
 
Oopp Lab Work
Oopp Lab WorkOopp Lab Work
Oopp Lab Work
 
Computers in management
Computers in managementComputers in management
Computers in management
 
Automotive Cybersecurity: Test Like a Hacker
Automotive Cybersecurity: Test Like a HackerAutomotive Cybersecurity: Test Like a Hacker
Automotive Cybersecurity: Test Like a Hacker
 
Production Debugging at Code Camp Philly
Production Debugging at Code Camp PhillyProduction Debugging at Code Camp Philly
Production Debugging at Code Camp Philly
 
Bug Tracking System
Bug Tracking SystemBug Tracking System
Bug Tracking System
 
Benchmarking PyCon AU 2011 v0
Benchmarking PyCon AU 2011 v0Benchmarking PyCon AU 2011 v0
Benchmarking PyCon AU 2011 v0
 
Пирамида Тестирования через призму ROI калькулятора и прочая геометрия
Пирамида Тестирования через призму ROI калькулятора и прочая геометрияПирамида Тестирования через призму ROI калькулятора и прочая геометрия
Пирамида Тестирования через призму ROI калькулятора и прочая геометрия
 
Test Pyramid vs Roi
Test Pyramid vs Roi Test Pyramid vs Roi
Test Pyramid vs Roi
 
Monitoring As Code: How to Integrate App Monitoring Into Your Developer Cycle
Monitoring As Code: How to Integrate App Monitoring Into Your Developer CycleMonitoring As Code: How to Integrate App Monitoring Into Your Developer Cycle
Monitoring As Code: How to Integrate App Monitoring Into Your Developer Cycle
 

Último

USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 

Último (20)

USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 

Code instrumentation

  • 2. A Real Life Experience • A person has sent an mail to the C levels of company about a complaint. • Then the request comes top level to the down.( CEO - > CTO -> Director -> Dept. Man -> Man -> Developer ) • The developer, analyze the code but unable to find any information about the complaint. Because the complaint was about a situation that happened 4 months ago. • Analyze, code reading, testing, again code reading, … • A few days later, the problem has been solved. • … but a few days have been passed • …
  • 3. not instrumented code FUNCTION ExecuteWebService ( pic_RequestXML IN NCLOB, pis_ServiceName IN VARCHAR2, pis_ChannelName IN VARCHAR2, pin_TransactionId IN NUMBER ) RETURN INTEGER ... ... BEGIN ... ... vs_SOAPEnvelopeXMLNS := 'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"'; vs_SOAPFaultXPATH := '/soap:Envelope/soap:Body/soap:Fault'; ... ... RETURN cn_SUCCESS; EXCEPTION WHEN OTHERS THEN ... ... RETURN cn_FAILURE; END;
  • 4. instrumentation[1] : Add Trace information into the code(function calls, input parameters etc.) FUNCTION ExecuteWebService ( pic_RequestXML IN NCLOB, pis_ServiceName IN VARCHAR2, pis_ChannelName IN VARCHAR2, pin_TransactionId IN NUMBER ) RETURN INTEGER ... ... BEGIN LogInfo( 'Executing ExecuteWebService function.' ); LogInfo('[ServiceName,ChannelName,TransactionId]'); LogInfo( '[' || pis_ServiceName || ',' || pis_ChannelName || ',' || pin_TransactionId || ']' ); ... ... vs_SOAPEnvelopeXMLNS := 'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"'; vs_SOAPFaultXPATH := '/soap:Envelope/soap:Body/soap:Fault'; ... ... RETURN cn_SUCCESS; EXCEPTION WHEN OTHERS THEN ... ... RETURN cn_FAILURE; END;
  • 5. instrumentation[2] : Add Debug information into the code(Error code, exception messages etc) FUNCTION ExecuteWebService ( pic_RequestXML IN NCLOB, pis_ServiceName IN VARCHAR2, pis_ChannelName IN VARCHAR2, pin_TransactionId IN NUMBER ) RETURN INTEGER ... ... BEGIN LogInfo( 'Executing ExecuteWebService function.' ); LogInfo('[ServiceName,ChannelName,TransactionId]'); LogInfo( '[' || pis_ServiceName || ',' || pis_ChannelName || ',' || pin_TransactionId || ']' ); ... ... vs_SOAPEnvelopeXMLNS := 'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"'; vs_SOAPFaultXPATH := '/soap:Envelope/soap:Body/soap:Fault'; ... ... RETURN cn_SUCCESS; EXCEPTION WHEN OTHERS THEN ... ... vs_ErrorMessage := 'Error in ExecuteWebService function :' || SQLERRM; vs_ErrorMessage := vs_ErrorMessage || cs_NEWLINE || dbms_utility.format_error_backtrace; vs_ErrorMessage := vs_ErrorMessage || cs_NEWLINE || 'UTL_HTTP Detail SQL Code = ' || vs_DetailSQLCode; vs_ErrorMessage := vs_ErrorMessage || cs_NEWLINE || 'UTL_HTTP Detail SQL Message = ' || vs_DetailSQLMessage; LogError(vs_ErrorMessage ); RETURN cn_FAILURE; END;
  • 6. instrumentation[3] : Add Performance information into the code(performance counters, timing and profiling) FUNCTION ExecuteWebService ( pic_RequestXML IN NCLOB, pis_ServiceName IN VARCHAR2, pis_ChannelName IN VARCHAR2, pin_TransactionId IN NUMBER ) RETURN INTEGER ... ... BEGIN SetStartTime(); LogInfo( 'Executing ExecuteWebService function.' ); LogInfo('[ServiceName,ChannelName,TransactionId]'); LogInfo( '[' || pis_ServiceName || ',' || pis_ChannelName || ',' || pin_TransactionId || ']' ); ... ... SetStatistics('INIT'); vs_SOAPEnvelopeXMLNS := 'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"'; vs_SOAPFaultXPATH := '/soap:Envelope/soap:Body/soap:Fault'; ... ... RETURN cn_SUCCESS; EXCEPTION WHEN OTHERS THEN ... ... vs_ErrorMessage := 'Error in ExecuteWebService function :' || SQLERRM; vs_ErrorMessage := vs_ErrorMessage || cs_NEWLINE || dbms_utility.format_error_backtrace; vs_ErrorMessage := vs_ErrorMessage || cs_NEWLINE || 'UTL_HTTP Detail SQL Code = ' || vs_DetailSQLCode; vs_ErrorMessage := vs_ErrorMessage || cs_NEWLINE || 'UTL_HTTP Detail SQL Message = ' || vs_DetailSQLMessage; LogError(vs_ErrorMessage ); RETURN cn_FAILURE; END;
  • 7. Please, please, please instrument your code![*] • Dev: Why is this call failing? • Me: What are the parameter values you are calling it with in your code? • Dev: Values X, Y and Z. • Me: Have you called the routine directly with those values? • Dev: Yes, and it worked fine. • Me: That would suggest those are not the values you are really using then. • Dev: But they are. • Me: How do you know. Have to traced the variable values before you made the call. • Dev: No, but they are the correct values. • Me: Can you put in some trace messages to check? • Dev: (walks away) … grumble … grumble … stupid trace … wasting my time … • Me: (some time later) So what values were you passing in? • Dev: One of the values was not what I was expecting, which is why it broke. No matter who you are or how cool you think you are at programming, you can never know exactly what is going on in your code unless you instrument it. Just shut up and do it! Experience tells me you will read this and ignore it, but that is a big mistake! A real professional *always* comments and instruments their code! [*] : from Tim Hall
  • 8. Definition From Wikipedia, the free encyclopedia • In context of computer programming, instrumentation refers to an ability to monitor or measure the level of a product's performance, to diagnose errors and to write trace information. • Programmers implement instrumentation in the form of code instructions that monitor specific components in a system (for example, instructions may output logging information to appear on screen). • When an application contains instrumentation code, it can be managed using a management tool. • Instrumentation is necessary to review the performance of the application. • Instrumentation approaches can be of two types, source instrumentation and binary instrumentation.
  • 9. Definition – cont. In programming, instrumentation means the ability of an application to incorporate: • Code tracing - receiving informative messages about the execution of an application at run time. • Debugging and (structured) exception handling - tracking down and fixing programming errors in an application under development. • Profiling (computer programming) - a means by which dynamic program behaviors can be measured during a training run with a representative input. This is useful for properties of a program which cannot be analyzed statically with sufficient precision, such as alias analysis. • Performance counters - components that allow the tracking of the performance of the application. • Computer data logging - components that allow the logging and tracking of major events in the execution of the application.
  • 11. Our case against debugging[*] • We have reproduced this experience several times, with various customers, and noticed that about 50% of project time is spent debugging and not producing code. And we are not even talking about the testing process here. Amazingly, we have recently seen a question on a LinkedIn group about the time spent in debugging, and 50% was the number mentioned as the first response to this thread by a developer. By the way, we need to congratulate the guy for pulling out this number as he is fully aware of where his time goes, which obviously is not the case for many developers. [*] from http://blog.softfluent.com/2011/04/20/our-case-against-debugging/
  • 12. Our case against debugging – cont. • The main reason would be obvious to a financial guy. It is the "capex" versus "opex" difference. Debugging is an operational expense. Once you closed the debugger, all that you have learned vanishes and your time has been spent without any remaining value. As a comparison, imagine you have spent the same time putting appropriate tracing in relevant functions, outputting the key parameter values to a relevant file in a manner that can be reproduced and configured. You will get the same benefits as a developer to check that your program does what it should and detect potential mistakes. But at the same time, you will have prepared future analysis once the program evolves. Tracing is a capital expense.
  • 13. Our case against debugging – cont. • Pushing the reasoning a bit further, one can easily understand that this is also a matter of team versus individual vision. The investment put in tracing will benefit to everybody while the debugging approach is an individual process that cannot easily be shared. As an example, I had a "magnetic resonance imaging" exam last month, and I was surprised and happy that all this exam was actually recorded and given to me on a CD. I am now able to share it with my usual doctor as well as any specialist that I would like to have a second look at the exam.
  • 14. Our case against debugging – cont. • Similarly, it is also a matter of developer machine versus production environment. As computing gets more and more complex, with server-based and cloud-based infrastructure, as well as load-balancing or security constraints, the developer desktop – although simulating those infrastructures – will more and more differ from the real execution context. The risk of not being able to debug some scenarios is higher and tracing is often the only real option to understand what is happening. By the way, think about what is happening with airplanes. We have very powerful simulators that can simulate anything one can imagine. Still, we put black boxes in aircrafts to understand what happened under unpredicted circumstances. So tracing has to be done anyway.
  • 15. Effective Code Instrumentation? [*] From Achilles : All too often I read statements about some new framework and their "benchmarks." My question is a general one but to the specific points of: 1. What approach should a developer take to effectively instrument code to measure performance? 2. When reading about benchmarks and performance testing, what are some red-flags to watch out for that might not represent real results? And best answer from : Patrick There are two methods of measuring performance: using code instrumentation and using sampling… (please read the conversation..) [*] : from http://stackoverflow.com/questions/2345081/effective-code-instrumentation
  • 16. Instrumentation [*] • To the developers that say “this is extra code that will just make my code run slower” I respond “well fine, we will take away V$ views, there will be no SQL_TRACE, no 10046 level 12 traces, in fact – that entire events subsystem in Oracle, it is gone”. Would Oracle run faster without this stuff? Undoubtedly – not. It would run many times slower, perhaps hundreds of times slower. Why? Because you would have no clue where to look to find performance related issues. You would have nothing to go on. Without this “overhead” (air quotes intentionally used to denote sarcasm there), Oracle would not have a chance of performing as well as it does. Because you would not have a change to make it perform well. Because you would not know where even to begin. • So, a plea to all developers, get on the instrumentation bandwagon. You’ll find your code easier to debug (note how Oracle doesn’t fly a developer to your site to debug the kernel, there is enough instrumentation to do it remotely). You’ll find your code easier to tune. You’ll find your code easier to maintain over time. Also, make this instrumentation part of the production code, don’t leave it out! Why? Because, funny thing about production – you are not allowed to drop in “debug” code at the drop of a hat, but you are allowed to update a row in a configuration table, or in a configuration file! Your trace code, like Oracle’s should always be there, just waiting to be enabled. [*] : from Tom Kyte
  • 17. How to Instrument • Use database tables for logging, tracing and performance counters. Archive these log information, when it is not frequently analyzed. If not necessary, erase these table data, otherwise DBAs will complain. • It can also be used file system(utl_file package) for logging. But note that, database tables are very easy to analyze and query. • Use Oracle’s built-in tools for performance monitoring and profiling. (Statspack, AWR reports, PL/SQL Hierarcihal Profiler etc) • Only log, necessary information. These log records are read by human eyes. Tons of log information are very difficult to read and analyze. • Please analyze the log and trace information. Be proactive. Take actions before something goes wrong. • Instrumentation shall be a quality issue and shall not be skipped. It is a code dicipline. • In Code Review process, reviewer shall mark un-instrumented code.
  • 18. Ref.. • http://en.wikipedia.org/wiki/Instrumentation_(computer_programming) • http://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/Instru mentsUserGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40004652-CH1- SW1 • http://blog.softfluent.com/2012/06/04/code-instrumentation-best-practices/ • http://blog.softfluent.com/2011/04/20/our-case-against-debugging/ • http://www.oracle-base.com/blog/2013/08/16/please-please-please-instrument-your-code/ • http://msdn.microsoft.com/en-us/library/aa983649(v=vs.71).aspx • http://stackoverflow.com/questions/2345081/effective-code-instrumentation