Skip to content

promotedai/schema

Repository files navigation

Schema

Protobuf schemas that define Promoted APIs. About Proto Schema

Important

Generated

The generated directory is automatically generated by Github Actions on PRs and pushes. Do not modify it directly.

Common usage patterns

Setting Primary keys

Promoted's SDKs usually automatically setting the primary keys.

When logging records to Event API, the clients should set the primary key to a UUID if (1) the client wants to use the ID immediately or (2) the client wants Metrics to de-duplicate the log records in case the client sent the same log record multiple times. The SDK will usually set a value to avoid sending duplicate records. If the value is not set, Event API will create a value.

When calling Delivery API, do not set the primary key. Let the SDK and Delivery API handle it.

For protobufs that are shared as request and log messages (Request), we split the client and server key fields ( client_request_id and request_id) so we can track when RPCs failed and what was actually done. For this, client_request_id is set by the client SDK and request_id is set by Delivery API.

Local IDE Editing and Testing

Path resolution in IDE

If using an IntelliJ-based IDE, add /path/to/schema/ as a source. reference

Older versions of IntelliJ have a Bazel plugin.

Local build

Github actions will execute the actions in workflows/actions.yml on PRs and pushes. For local testing, the bazel binary in bin is compiled for linux, not OSX. For OSX, install Bazel, then you can run Bazel to confirm that schemas build as expected.

One-time step to install bazel for building protobuf locally.

$ brew install bazel

Build all protobufs using bazel.

$ cd /path/to/schema
$ bazel build ...

If you hit weird Bazel build issues involving bad c++ versions, trying bazel expunge and bazel sync --configure.

This builds all targets to schema/bazel-bin/proto, which can be copied or inspected locally.

Manual build for python types

This is now done by Github actions automatically. To run manually for testing, see the example below.

./scripts/generate-python.sh

Commit changes as normal.

About

Promoted's schemas and protobufs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published