Skip to main content

A Python Library for Trace Analysis

  • Conference paper
  • First Online:
Runtime Verification (RV 2022)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 13498))

Included in the following conference series:

Abstract

We present a Python library for trace analysis named PyContract. PyContract is a shallow internal DSL, in contrast to many trace analysis tools that implement external or deep internal DSLs. The library has been used in a project for analysis of logs from NASA’s Europa Clipper mission. We describe our design choices, explain the API via examples, and present an experiment comparing PyContract against other state-of-the-art tools from the research and industrial communities.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 59.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 74.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    A data class is a class decorated with @dataclass, which allows to perform pattern matching over objects of the class, including their parameters.

  2. 2.

    CommaSuite has been designed to be used to monitor the logs from automated tests in nightly builds, where “the traces are short enough, and the nights long enough”.

References

  1. Ancona, D., Franceschini, L., Ferrando, A., Mascardi, V.: RML: theory and practice of a domain specific language for runtime verification. Sci. Compute. Programm. 205, 102610 (2021)

    Google Scholar 

  2. Barringer, H., Goldberg, A., Havelund, K., Sen, K.: Rule-based runtime verification. In: Steffen, B., Levi, G. (eds.) VMCAI 2004. LNCS, vol. 2937, pp. 44–57. Springer, Heidelberg (2004). https://doi.org/10.1007/978-3-540-24622-0_5

    Chapter  MATH  Google Scholar 

  3. Barringer, H., Havelund, K.: TraceContract: A Scala DSL for Trace Analysis. In: Butler, M., Schulte, W. (eds.) FM 2011. LNCS, vol. 6664, pp. 57–72. Springer, Heidelberg (2011). https://doi.org/10.1007/978-3-642-21437-0_7

    Chapter  Google Scholar 

  4. Barringer, H., Rydeheard, D., Havelund, K.: Rule systems for run-time monitoring: from Eagle to RuleR. In: Sokolsky, O., Taşıran, S. (eds.) RV 2007. LNCS, vol. 4839, pp. 111–125. Springer, Heidelberg (2007). https://doi.org/10.1007/978-3-540-77395-5_10

    Chapter  Google Scholar 

  5. Basin, D.A., Klaedtke, F., Marinovic, S., Zălinescu, E.: Monitoring of temporal first-order properties with aggregations. Formal Methods Syst. Des. 46(3), 262–285 (2015)

    Google Scholar 

  6. Cheng, K.-T., Krishnakumar, A.: Automatic functional test generation using the extended finite state machine model. In: 30th ACM/IEEE Design Automation Conference, pp. 86–91 (1993)

    Google Scholar 

  7. Colombo, C., Pace, G.J., Schneider, G.: LARVA – safer monitoring of real-time Java programs (tool paper). In: Proceedings of the 2009 Seventh IEEE International Conference on Software Engineering and Formal Methods, SEFM 2009, pp. 33–37. IEEE Computer Society, Washington, DC (2009)

    Google Scholar 

  8. CommaSuite. https://projects.eclipse.org/projects/technology.comma

  9. D’Angelo, B., et al.: LOLA: runtime monitoring of synchronous systems. In: Proceedings of TIME 2005: the 12th International Symposium on Temporal Representation and Reasoning, pp. 166–174. IEEE (2005)

    Google Scholar 

  10. Daut. https://github.com/havelund/daut

  11. Decker, N., Leucker, M., Thoma, D.: Monitoring modulo theories. Softw. Tools Technol. Transf. (STTT), 18(2), 205–225 (2016)

    Google Scholar 

  12. Europa Clipper mission. https://europa.nasa.gov

  13. Experiments Repository. https://bitbucket.org/seanmk/rv-bench

  14. Gibbons, J., Wu, N.: Folding domain-specific languages: deep and shallow embeddings (functional pearl). In: Proceedings of the 19th ACM SIGPLAN International Conference on Functional Programming, ICFP 2014, pp. 339–347. Association for Computing Machinery, New York (2014)

    Google Scholar 

  15. Hallé, S., Villemaire, R.: Runtime enforcement of web service message contracts with data. IEEE Trans. Serv. Comput. 5(2), 192–206 (2012)

    Article  Google Scholar 

  16. Havelund, K.: Data automata in Scala. In: 2014 Theoretical Aspects of Software Engineering Conference, TASE 2014, Changsha, China, 1–3 September, 2014, pp. 1–9. IEEE Computer Society (2014)

    Google Scholar 

  17. Havelund, K.: Rule-based runtime verification revisited. Softw. Tools Technol. Transf. (STTT) 17(2), 143–170 (2015)

    Google Scholar 

  18. Kauffman, S., Havelund, K., Joshi, R.: nfer – a notation and system for inferring event stream abstractions. In: Falcone, Y., Sánchez, C. (eds.) RV 2016. LNCS, vol. 10012, pp. 235–250. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-46982-9_15

    Chapter  Google Scholar 

  19. Kim, M., Kannan, S., Lee, I., Sokolsky, O.: Java-MaC: a run-time assurance tool for Java. In: Proceedings of the 1st International Workshop on Runtime Verification (RV’01). Electronic Notes in Theoretical Computer Science, vol. 55(2). Elsevier (2001)

    Google Scholar 

  20. Kurklu, E., Havelund, K.: A flight rule checker for the LADEE Lunar spacecraft. In: 17th International Colloquium on Theoretical Aspects of Computing (ICTAC’20), vol. TBD of LNCS (2020)

    Google Scholar 

  21. Kurtev, I., Schuts, M., Hooman, J., Swagerman, D.-J.: Integrating interface modeling and analysis in an industrial setting. In: Proceedings of the 5th International Conference on Model-Driven Engineering and Software Development (MODELSWARD 2017), pp. 345–352. SciTePress, February 2017

    Google Scholar 

  22. Meredith, P.O., Jin, D., Griffith, D., Chen, F., Roşu, G.: An overview of the MOP runtime verification framework. Int. J. Softw. Tech. Technol. Transf., 249–289 (2011). https://doi.org/10.1007/s10009-011-0198-6

  23. PyContract. https://github.com/pyrv/pycontract

  24. PyPi Stats Website. https://pypistats.org

  25. Python pattern matching. https://peps.python.org/pep-0636

  26. Reger, G., Cruz, H.C., Rydeheard, D.: MarQ: monitoring at runtime with QEA. In: Baier, C., Tinelli, C. (eds.) TACAS 2015. LNCS, vol. 9035, pp. 596–610. Springer, Heidelberg (2015). https://doi.org/10.1007/978-3-662-46681-0_55

    Chapter  Google Scholar 

  27. Sipser, M.: Introduction to the Theory of Computation, 3rd edn. MA, Course Technology, Boston (2013)

    MATH  Google Scholar 

  28. StackOverflow Developer Survey (2021). https://insights.stackoverflow.com/survey/2021

  29. OMG Systems Modeling Language (SysML). http://www.omgsysml.org

  30. Tufte, E.R., Goeler, N.H., Benson, R.: Envisioning information, vol. 126. Graphics press Cheshire, CT (1990)

    Google Scholar 

  31. OMG Unified Modeling Language (UML). http://www.omg.org/spec/UML

Download references

Acknowledgments

Part of the research was funded by the ERC Advanced Grant LASSO, the Villum Investigator Grant S4OS, and DIREC, Digital Research Center Denmark. Part of the research was performed at Jet Propulsion Laboratory, California Institute of Technology, under a contract with the National Aeronautics and Space Administration. Part of the research was carried out as part of the Accelerando program under the responsibility of ESI (TNO) with Philips as the carrying industrial partner. The Accelerando research is supported by the Netherlands Organisation for Applied Scientific Research TNO.

Author information

Authors and Affiliations

Authors

Corresponding authors

Correspondence to Dennis Dams , Klaus Havelund or Sean Kauffman .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Dams, D., Havelund, K., Kauffman, S. (2022). A Python Library for Trace Analysis. In: Dang, T., Stolz, V. (eds) Runtime Verification. RV 2022. Lecture Notes in Computer Science, vol 13498. Springer, Cham. https://doi.org/10.1007/978-3-031-17196-3_15

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-17196-3_15

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-17195-6

  • Online ISBN: 978-3-031-17196-3

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics