Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CSC510 Lecture 23

CSC510 Lecture 23

Observability
(20261019)

Avatar for Javier Gonzalez-Sanchez

Javier Gonzalez-Sanchez PRO

October 30, 2026

More Decks by Javier Gonzalez-Sanchez

Other Decks in Programming

Transcript

  1. Today’s question • Our distributed application works. • What happens

    when one service fails? • How do we follow a reading across Lambda, DynamoDB, S3, SNS, SQS, and MQTT? • How can you inspect results without AWS Console credentials? 02
  2. Three pillars of observability • Logs — What happened? Structured

    application events and errors. (CloudWatch) • Metrics — How often, how long, and how many failures? (CloudWatch) • Traces — Where did one request spend time across instrumented services? (X-Ray) 04
  3. Who reports what? AWS Lambda • Metrics: Invoca ons, errors,

    dura on. • Logs: Execu on events and structured applica on logs. • Traces: Func on execu on and instrumented AWS SDK calls (when enabled). DynamoDB, S3, SNS, SQS fi ti fi ti ti ti ti ti ti ti ti ti • Metrics: Requests, latency, errors, throughput, or queue ac vity (service-dependent). • Logs: Selected API ac vity through CloudTrail or service-speci c logging when con gured. • Traces: Opera ons when instrumented through the calling applica on.
  4. Who reports what? Amazon Bedrock AgentCore Gateway • Metrics: Gateway

    requests, errors, and latency. • Logs: MCP tool ac vity and gateway errors (when con gured). • Traces: Gateway processing and tool invoca on paths (when enabled and supported). Amazon Cognito ti fi fi ti ti ti ti ti ti ti ti • Metrics: Authen ca on-related ac vity and failures (supported metrics). • Logs: Authen ca on events and API audit records through con gured logging and CloudTrail. • Traces: No automa c end-to-end distributed tracing of JWT valida on.
  5. Identi iers Reading UUID — What are we processing? •

    Iden es one logical reading across DynamoDB, S3, SNS, SQS, and MQTT. • Remains the same across services and retries. • Generated by our applica on (UUID.randomUUID()). Lambda Request ID — Which execu on processed it? • Iden es one speci c Lambda invoca on. • Changes with each retry or new invoca on. • Generated by AWS (context.getAwsRequestId()). ti ti ti ti ti ti ti fi ti f fi fi ti ti Trace ID — Where did the execu on go? • Connects instrumented opera ons across distributed services. • Helps iden fy execu on paths, latency, and failures. • Generated by a tracing system (AWS X-Ray). 06
  6. Structured events: common schema { "course": "CSC5100", "readingId": "29bbc7e8-...", "service":

    "S3", "event":"SAVE", "status": "SUCCESS", "durationMs":42 } 07
  7. (

  8. We want this message 05 message 04 Logger trace() debug()

    info () warn () error() 16 message 03 message 02 message 01
  9. ConsoleAppender Appender message 05 message 04 Logger trace() debug() info

    () warn () error() 17 message 03 message 02 message 01
  10. )

  11. Example long start = System.nanoTime(); try { storage.save(id, json); TemperatureObservability.log(

    id, requestId, "Storage", "SAVE", "SUCCESS", start); } catch (RuntimeException e) { TemperatureObservability.log( id, requestId, "Storage", "SAVE", "FAILURE", start); throw e; }
  12. Logger Available too L mbd Logger logger = context.getLogger(); logger.log("L

    mbd invoked"); logger.log("Received event: " + event); --- a a a a a a a a a a a a a a a a <dependency> <groupId>com. m zon ws</groupId> < rtif ctId> ws-l mbd -j v -core</ rtif ctId> <version>1.2.3</version> </dependency>
  13. Footnote import java.io.File; import java.io.PrintStream; public class Main { public

    static void main(String[] args) throws Exception { // Redirect standard output to a file PrintStream file = new PrintStream(new File("output.txt")); System.setOut(file); System.out.println("Hello World"); System.out.println("This goes to the file!"); file.close(); } }
  14. CloudWatch Logs Insights Query Language fields @timestamp, readingId, service, event,

    status, durationMs | filter readingId = "YOUR-UUID" | sort @timestamp asc | limit 100 10
  15. CloudWatch Metrics: operational health • Lambda Invocations — request volume.

    • Lambda Errors — unhandled execution failures (not every HTTP 4xx/5xx). • Lambda Duration — processing time. 11
  16. Public dashboard: what viewers can see • A read-only public

    dashboard: invocation counts, errors, duration, sanitized events. • Public sharing does not require student AWS credentials. • Public widgets are fixed; arbitrary Logs Insights exploration needs authenticated access. 13
  17. Con iguration sequence • 1. Verify Lambda CloudWatch logging and

    seven-day retention. • 2. Deploy structured event logging and test a POST request. • 3. Create Logs Insights queries and metric widgets. f • 4. Publish a sanitized, read-only dashboard; test the shared link.
  18. De inition • AWS X-R y is distributed tr cing

    service th t helps developers underst nd how requests tr vel through pplic tions nd AWS services. How do we use it? a a a a a a a a a a a a a a a a a a a a a a f a a • En ble ctive tr cing in AWS L mbd . • Instrument downstre m oper tions when needed. • Explore tr ces in CloudW tch → X-R y tr ces. • Ex mine execution p ths, service dependencies, nd l tency.
  19. Takeaways • Observability is engineered, not automatically guaranteed. • Structured

    events + correlation IDs make the system diagnosable. • Metrics describe health; • Traces describe instrumented request paths. • Public dashboards are for safe, curated views—not raw log access. 17
  20. CSC 5100 Modern Software Engineering Javier Gonzalez-Sanchez, Ph.D. [email protected] Fall

    2026 Copyright Notice. These slides are provided exclusively for educational use in CSC 5100 within the California State University system. Redistribution or use for any other purpose is prohibited without prior written permission.