Get Started Developing
Lightup's REST API enables the developer to make changes to their Lightup cluster programmatically. The API can be accessed via standard REST calls, as described in the API Reference. Alternately, it can be accessed via Lightup's python SDK, a light library of wrappers that lets you easily write python programs that access your workspaces, metrics, monitors, and incidents.
The SDK is simple to use and very powerful. Here's a simple example that shows how you can unpause all metrics in a particular workspace.
from lightctl.lightup_client import LightupClient
lightup = LightupClient()
workspaces = lightup.workspace.list_workspaces()
for workspace in workspaces:
workspace_id = workspace["uuid"]
metrics = lightup.metric.list_metrics(workspace_id)
for metric in metrics:
if not metric["config"]["isLive"]:
metric["config"]["isLive"] = True
print(f'Unpausing name: {metric["metadata"]["name"]} uuid: {metric["metadata"]["uuid"]}')
lightup.metric.update_metric(workspace_id, metric["metadata"]["uuid"], metric)
A python class is available for each object in the Lightup system. Each class provides a simple set of methods that allows the python developer to interact with objects of that type.
- HealthzClient: get healthz info for cluster
- IncidentClient: get incidents by workspace, monitor, and time
- MetricClient: get, create, delete, and update metrics
- MonitorClient: get, create, delete, and update monitors
- ProfilerClient: get and update configuration associated with schemas, tables, and columns
- SourceClient: get, create, delete, and update datasources
- UserClient: get users associated with a workspace, and add, remove, and update users in a workspace
- WorkspaceClient: get, create, and delete workspaces
The documentation in the following sections describes the methods associated with each class.
Updated about 1 year ago