code: def metrics(function, api, start, period):
      
      from c7n.mu import LambdaManager
      manager = LambdaManager(boto3.Session)
      start = parse_date(start)
      period = int(abs(parse_timedelta(period).total_seconds()))
  
      print("Lambda Metrics")
      metrics = manager.metrics(
          [{'FunctionName': function}],
          start=start, end=datetime.utcnow(),
          period=period)
      for k in ('Invocations', 'Throttles', 'Errors'):
          values = [n['Sum'] for n in metrics[0][k]]
          render_metrics(k, values)
  
      if not api:
          return
  
      print("Api Metrics")
      metrics = gateway_metrics(
          boto3.Session, api, "latest", start, datetime.utcnow(), period)
      for k, data in metrics.items():
          if "Count" in k:
              values = [n['Sum'] for n in data]
          else:
              values = [n['Average'] for n in data]
          render_metrics(k, values)
  
      print("Db Metrics")
      metrics = db_metrics(
          boto3.Session, "Sphere11.Dev.ResourceLocks",
          start, datetime.utcnow(), period)
      for k, data in metrics.items():
          values = [n['Average'] for n in data]
          render_metrics(k, values)
docs: lambda/api/db metrics