Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ieaves committed Nov 3, 2023
1 parent 0576679 commit 4bd3d23
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 17 deletions.
16 changes: 11 additions & 5 deletions docs/pages/integrations/airflow.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,27 @@ The Airflow integration consumes OpenLineage metadata from Airflow.
| source | The name of the source, see [sources](/concepts/sources) | my-source |
| Name | Name for connection | Airflow |
| Namespace | Namespace for the connection, see [namespaces](/concepts/namespace) | default |
| api_secret | Input an api_secret which will be used to verify each message | super_secret |
| namespaces | Optional | |

### Webhook

Grai will open an endpoint at `/api/v1/openlineage/<connection_id>/<api_secret>/` which can be used to receive Airflow OpenLineage events.
<Callout type="info" emoji="ℹ️">
In order to authenticate your webhook, you will need to create an API key in the Grai web app.
</Callout>

Grai will open an endpoint at `/api/v1/openlineage/<connection_id>/` which can be used to receive Airflow OpenLineage events.

See the [OpenLineage Airflow docs](https://openlineage.io/docs/integrations/airflow/) for how to configure your client to send OpenLineage events.

An example config:

```
```yaml copy
transport:
url: "https://api.grai.io",
endpoint: "/api/v1/openlineage/<connection_id>/<api_secret>/"
type: "http"
url: "https://api.grai.io/api/v1/openlineage/<connection_id>/"
auth:
type: "api_key"
api_key: "<your_grai_api_key>"
```
## Python Library
Expand Down
17 changes: 12 additions & 5 deletions docs/pages/integrations/openlineage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,28 @@ The OpenLineage integration consumes OpenLineage metadata from various systems.
| source | The name of the source, see [sources](/concepts/sources) | my-source |
| Name | Name for connection | OpenLineage |
| Namespace | Namespace for the connection, see [namespaces](/concepts/namespace) | default |
| api_secret | Input an api_secret which will be used to verify each message | super_secret |
| namespaces | Optional | |

### Webhook

Grai will open an endpoint at `/api/v1/openlineage/<connection_id>/<api_secret>/` which can be used to receive OpenLineage events. You should point your OpenLineage clients to this endpoint.
<Callout type="info" emoji="ℹ️">
In order to authenticate your webhook, you will need to create an API key in the Grai web app.
</Callout>


Grai will open an endpoint at `/api/v1/openlineage/<connection_id>/` which can be used to receive OpenLineage events. You should point your OpenLineage clients to this endpoint.

See the [OpenLineage docs](https://openlineage.io/docs/client/python) for how to configure your client to send events to a webhook.

An example config:

```
```yaml copy
transport:
url: "https://api.grai.io",
endpoint: "/api/v1/openlineage/<connection_id>/<api_secret>/"
type: "http"
url: "https://api.grai.io/api/v1/openlineage/<connection_id>/"
auth:
type: "api_key"
api_key: "<your_grai_api_key>"
```
## Python Library
Expand Down
9 changes: 5 additions & 4 deletions grai-server/app/connections/tests/test_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from lineage.models import Source
from workspaces.models import Membership, Organisation, Workspace, WorkspaceAPIKey
from users.models import User
from django.urls import reverse


@pytest.fixture
Expand Down Expand Up @@ -680,7 +681,7 @@ def test_dbt_cloud_not_active(test_connection_dbt_cloud, client, hmac_secret):

@pytest.mark.django_db
def test_openlineage(client, test_connection_openlineage, workspace_api_key):
url = f"/api/v1/openlineage/{test_connection_openlineage.id}/"
url = reverse("connections:openlineage", args=[test_connection_openlineage.id])

body = {}
auth_headers = {
Expand All @@ -696,7 +697,7 @@ def test_openlineage(client, test_connection_openlineage, workspace_api_key):

@pytest.mark.django_db
def test_openlineage_no_connection(client, workspace_api_key):
url = f"/api/v1/openlineage/{uuid.uuid4()}/"
url = reverse("connections:openlineage", args=[uuid.uuid4()])

body = {}
auth_headers = {
Expand All @@ -710,7 +711,7 @@ def test_openlineage_no_connection(client, workspace_api_key):

@pytest.mark.django_db
def test_openlineage_invalid_api_key(client, test_connection_openlineage):
url = f"/api/v1/openlineage/{test_connection_openlineage.id}/"
url = reverse("connections:openlineage", args=[test_connection_openlineage.id])

body = {}
auth_headers = {
Expand All @@ -727,7 +728,7 @@ def test_openlineage_not_active(client, test_connection_openlineage, workspace_a
test_connection_openlineage.is_active = False
test_connection_openlineage.save()

url = f"/api/v1/openlineage/{test_connection_openlineage.id}/"
url = reverse("connections:openlineage", args=[test_connection_openlineage.id])

body = {}
auth_headers = {
Expand Down
2 changes: 1 addition & 1 deletion grai-server/app/connections/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,5 +327,5 @@ def open_lineage(request, connection: Connection):
urlpatterns = router.urls + [
path("external-runs/", create_run),
path("dbt-cloud/", dbt_cloud, name="dbt-cloud"),
path("openlineage/<uuid:connection>/", open_lineage),
path("openlineage/<uuid:connection>/", open_lineage, name="openlineage"),
]
2 changes: 0 additions & 2 deletions grai-server/app/seed/connectors.json
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,6 @@
{
"name": "api_secret",
"required": true,
"secret": true,
"order": 0
},
{
Expand Down Expand Up @@ -669,7 +668,6 @@
{
"name": "api_secret",
"required": true,
"secret": true,
"order": 0
},
{
Expand Down

0 comments on commit 4bd3d23

Please sign in to comment.