Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃帀 New Source: FullStory [Low code CDK] #25465

Merged
merged 26 commits into from
May 1, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
56ec9ec
initial commit
amogh-opsverse Apr 25, 2023
e5dc3cf
Update spec.yaml
amogh-opsverse Apr 25, 2023
0649f2f
Delete TODO.md
amogh-opsverse Apr 25, 2023
2b8f129
Update manifest.yaml
amogh-opsverse Apr 25, 2023
5979f2e
updating with requested changes
amogh-opsverse Apr 25, 2023
139d643
add fullstory source integration doc
amogh-opsverse Apr 25, 2023
a525f8d
updating docs and logo
amogh-opsverse Apr 25, 2023
d1bf72b
Merge branch 'master' into fullstory
amogh-opsverse Apr 26, 2023
0685bd4
Update manifest.yaml
amogh-opsverse Apr 27, 2023
8312aef
Update manifest.yaml
amogh-opsverse Apr 27, 2023
300c30a
Update configured_catalog.json to remove incremental sync
amogh-opsverse Apr 27, 2023
72cad9f
Update acceptance-test-config.yml to remove incremental tests
amogh-opsverse Apr 27, 2023
0127614
Merge branch 'master' into fullstory
amogh-opsverse Apr 27, 2023
eed6ef6
Merge branch 'master' into fullstory
amogh-opsverse May 1, 2023
fa0ebaf
Delete expected_records.jsonl
amogh-opsverse May 1, 2023
5bf2bce
Update abnormal_state.json
amogh-opsverse May 1, 2023
6097174
Update acceptance-test-config.yml
amogh-opsverse May 1, 2023
77812b5
update accpt test
marcosmarxm May 1, 2023
8b5c057
remove start date from spec not used
marcosmarxm May 1, 2023
5bac5e1
fix tests
marcosmarxm May 1, 2023
4f8f8e5
add fullstory to source def file
marcosmarxm May 1, 2023
6847b85
Rename eventdefs.json to eventDefs.json
marcosmarxm May 1, 2023
ac6fc45
Merge branch 'master' into fullstory
amogh-opsverse May 1, 2023
08fc4eb
correct dockerfile version in source def
marcosmarxm May 1, 2023
23990cc
auto-bump connector version
octavia-squidington-iii May 1, 2023
541554f
Merge branch 'master' into fullstory
amogh-opsverse May 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*
!Dockerfile
!main.py
!source_fullstory
!setup.py
!secrets
38 changes: 38 additions & 0 deletions airbyte-integrations/connectors/source-fullstory/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM python:3.9.11-alpine3.15 as base

# build and load all requirements
FROM base as builder
WORKDIR /airbyte/integration_code

# upgrade pip to the latest version
RUN apk --no-cache upgrade \
&& pip install --upgrade pip \
&& apk --no-cache add tzdata build-base


COPY setup.py ./
# install necessary packages to a temporary folder
RUN pip install --prefix=/install .

# build a clean environment
FROM base
WORKDIR /airbyte/integration_code

# copy all loaded and built libraries to a pure basic image
COPY --from=builder /install /usr/local
# add default timezone settings
COPY --from=builder /usr/share/zoneinfo/Etc/UTC /etc/localtime
RUN echo "Etc/UTC" > /etc/timezone

# bash is installed for more convenient debugging.
RUN apk --no-cache add bash

# copy payload code only
COPY main.py ./
COPY source_fullstory ./source_fullstory

ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.1.0
LABEL io.airbyte.name=airbyte/source-fullstory
82 changes: 82 additions & 0 deletions airbyte-integrations/connectors/source-fullstory/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Fullstory Source

This is the repository for the Fullstory configuration based source connector.
For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.com/integrations/sources/fullstory).

## Local development

#### Building via Gradle
You can also build the connector in Gradle. This is typically used in CI and not needed for your development workflow.

To build using Gradle, from the Airbyte repository root, run:
```
./gradlew :airbyte-integrations:connectors:source-fullstory:build
```

#### Create credentials
**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.com/integrations/sources/fullstory)
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_fullstory/spec.yaml` file.
Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
See `integration_tests/sample_config.json` for a sample config file.

**If you are an Airbyte core member**, copy the credentials in Lastpass under the secret name `source fullstory test creds`
and place them into `secrets/config.json`.

### Locally running the connector docker image

#### Build
First, make sure you build the latest Docker image:
```
docker build . -t airbyte/source-fullstory:dev
```

You can also build the connector image via Gradle:
```
./gradlew :airbyte-integrations:connectors:source-fullstory:airbyteDocker
```
When building via Gradle, the docker image name and tag, respectively, are the values of the `io.airbyte.name` and `io.airbyte.version` `LABEL`s in
the Dockerfile.

#### Run
Then run any of the connector commands as follows:
```
docker run --rm airbyte/source-fullstory:dev spec
docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-fullstory:dev check --config /secrets/config.json
docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-fullstory:dev discover --config /secrets/config.json
docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-fullstory:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
```
## Testing

#### Acceptance Tests
Customize `acceptance-test-config.yml` file to configure tests. See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference) for more information.
If your connector requires to create or destroy resources for use during acceptance tests create fixtures for it and place them inside integration_tests/acceptance.py.

To run your integration tests with Docker, run:
```
./acceptance-test-docker.sh
```

### Using gradle to run tests
All commands should be run from airbyte project root.
To run unit tests:
```
./gradlew :airbyte-integrations:connectors:source-fullstory:unitTest
```
To run acceptance and custom integration tests:
```
./gradlew :airbyte-integrations:connectors:source-fullstory:integrationTest
```

## Dependency Management
All of your dependencies should go in `setup.py`, NOT `requirements.txt`. The requirements file is only used to connect internal Airbyte dependencies in the monorepo for local development.
We split dependencies between two groups, dependencies that are:
* required for your connector to work need to go to `MAIN_REQUIREMENTS` list.
* required for the testing need to go to `TEST_REQUIREMENTS` list

### Publishing a new version of the connector
You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
1. Make sure your changes are passing unit and integration tests.
1. Bump the connector version in `Dockerfile` -- just increment the value of the `LABEL io.airbyte.version` appropriately (we use [SemVer](https://semver.org/)).
1. Create a Pull Request.
1. Pat yourself on the back for being an awesome contributor.
1. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master.
3 changes: 3 additions & 0 deletions airbyte-integrations/connectors/source-fullstory/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference)
# for more information about how to configure these tests
connector_image: airbyte/source-fullstory:dev
acceptance_tests:
spec:
tests:
- spec_path: "source_fullstory/spec.yaml"
connection:
tests:
- config_path: "secrets/config.json"
status: "succeed"
- config_path: "integration_tests/invalid_config.json"
status: "failed"
discovery:
tests:
- config_path: "secrets/config.json"
basic_read:
tests:
- config_path: "secrets/config.json"
configured_catalog_path: "integration_tests/configured_catalog.json"
empty_streams: []
expect_records:
path: "integration_tests/expected_records.jsonl"
extra_fields: no
exact_order: no
extra_records: yes
incremental:
tests:
- config_path: "secrets/config.json"
configured_catalog_path: "integration_tests/configured_catalog.json"
future_state:
future_state_path: "integration_tests/abnormal_state.json"
full_refresh:
tests:
- config_path: "secrets/config.json"
configured_catalog_path: "integration_tests/configured_catalog.json"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env sh

source "$(git rev-parse --show-toplevel)/airbyte-integrations/bases/connector-acceptance-test/acceptance-test-docker.sh"
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
plugins {
id 'airbyte-python'
id 'airbyte-docker'
id 'airbyte-connector-acceptance-test'
}

airbytePython {
moduleDirectory 'source_fullstory'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"type": "STREAM",
"stream": {
"stream_state": { "createdAt": "9999-04-12T18:13:36.000Z" },
"stream_descriptor": { "name": "operations" }
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#


import pytest

pytest_plugins = ("connector_acceptance_test.plugin",)


@pytest.fixture(scope="session", autouse=True)
def connector_setup():
"""This fixture is a placeholder for external resources that acceptance test might require."""
# TODO: setup test dependencies if needed. otherwise remove the TODO comments
yield
# TODO: clean up test dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"streams": [
{
"stream": {
"name": "segments",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"]
},
"sync_mode": "incremental",
"destination_sync_mode": "append"
},
{
"stream": {
"name": "sessions",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "operations",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"]
},
"sync_mode": "incremental",
"destination_sync_mode": "append"
},
{
"stream": {
"name": "blockrules",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "domainsettings",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "geosettings",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "recordingfeatures",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "sessionTargetingRules",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "webhooks",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "eventDefs",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{"type": "RECORD", "record": {"stream": "operations", "data": {"id": "REVMRVRFX1NFU1NJT046c2Vzc2lvbjo2NjE3MjgwMDk1NzAzMDQwOjU0MTcxMzkyMDI0MTI1NDQ=", "type": "DELETE_SESSION", "details": "", "results": "", "state": "COMPLETED", "errorDetails": "", "createdAt": "2023-04-24T01:13:24.213Z", "finishedAt": "2023-04-24T01:14:28.307Z", "estimatePctComplete": 100, "step": ""}}}
{"type": "RECORD", "record": {"stream": "segments", "data": {"id": "everyone", "name": "Everyone", "creator": "system", "created": "2023-04-24T01:13:24.213Z", "url": "https://app.fullstory.com/ui/o-1K942V-na1/segments/everyone"}}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"api_key": "Invalid_token",
"uid": "Invalid_token",
"start_date": "9999-03-01T00:00:00.000Z"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"api_key": "na1.by0xSzk0MlYtbmExL2Ftb2doc2hpdjk5QGdtYWlsLmNvbTrD51rZKTDT/ADUGEOzZdTSqH9pv2Uy0WK1iySTKXUd9C4u/34NZS5G",
"uid": "user_unique_id",
"start_date": "2022-04-20T00:00:00.000Z"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"type": "STREAM",
"stream": {
"stream_state": { "createdAt": "2023-04-20T18:13:36.000Z" },
"stream_descriptor": { "name": "operations" }
}
}
]
13 changes: 13 additions & 0 deletions airbyte-integrations/connectors/source-fullstory/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#


import sys

from airbyte_cdk.entrypoint import launch
from source_fullstory import SourceFullstory

if __name__ == "__main__":
source = SourceFullstory()
launch(source, sys.argv[1:])
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-e ../../bases/connector-acceptance-test
-e .
29 changes: 29 additions & 0 deletions airbyte-integrations/connectors/source-fullstory/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#


from setuptools import find_packages, setup

MAIN_REQUIREMENTS = [
"airbyte-cdk~=0.1",
]

TEST_REQUIREMENTS = [
"pytest~=6.2",
"pytest-mock~=3.6.1",
"connector-acceptance-test",
]

setup(
name="source_fullstory",
description="Source implementation for Fullstory.",
author="Airbyte",
author_email="contact@airbyte.io",
packages=find_packages(),
install_requires=MAIN_REQUIREMENTS,
package_data={"": ["*.json", "*.yaml", "schemas/*.json", "schemas/shared/*.json"]},
extras_require={
"tests": TEST_REQUIREMENTS,
},
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#


from .source import SourceFullstory

__all__ = ["SourceFullstory"]
Loading