def metrics_from_mdl(mdl):
  """
  Return a set() representing the metrics in the given MDL JSON object.

  Each entry is a tuple of either:
    ('entity', entity_name, metric_name)
  or
    ('role', role_name, metric_name)
  """
  metrics = set()
  for entity_def in mdl['metricEntityTypeDefinitions']:
    for metric_def in entity_def['metricDefinitions']:
      metrics.add(('entity', entity_def['name'], metric_def['name']))
  for role_def in mdl['roles']:
    for metric_def in role_def['metricDefinitions']:
      metrics.add(('role', role_def['name'], metric_def['name']))
  return metrics