Skip to content

Create new Message Envelope page with new 25.2 features #19542

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

katmayb
Copy link
Contributor

@katmayb katmayb commented Apr 23, 2025

Fixes DOC-11555, DOC-12241, DOC-12307

This PR adds the new enriched envelope format for changefeed messages to docs and restructures our content on changefeed message envelopes.

Includes:

New Changefeed Message Envelope page

  • Use case example for new and existing options
  • Field reference
  • Envelope option reference
  • Preview label for enriched envelope content
  • Content on envelopes moved from the Changefeed Messages page
  • A general overview on envelopes and intro

Other

  • Removed the envelope content from here to the new page.
  • Adjustments to option descriptions on the CREATE CHANGEFEED page.

Preview

New Changefeed Message Envelope page

Copy link

netlify bot commented Apr 23, 2025

Deploy Preview for cockroachdb-interactivetutorials-docs canceled.

Name Link
🔨 Latest commit df2feb0
🔍 Latest deploy log https://app.netlify.com/sites/cockroachdb-interactivetutorials-docs/deploys/681e2a1d2e20e0000831ee79

Copy link

netlify bot commented Apr 23, 2025

Deploy Preview for cockroachdb-api-docs canceled.

Name Link
🔨 Latest commit df2feb0
🔍 Latest deploy log https://app.netlify.com/sites/cockroachdb-api-docs/deploys/681e2a1ddc4bc200089ba0d1

Copy link

netlify bot commented Apr 23, 2025

Netlify Preview

Name Link
🔨 Latest commit df2feb0
🔍 Latest deploy log https://app.netlify.com/sites/cockroachdb-docs/deploys/681e2a1d605bf0000830276c
😎 Deploy Preview https://deploy-preview-19542--cockroachdb-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@katmayb katmayb force-pushed the message-envelope-25.2 branch 2 times, most recently from 4ffb586 to 2acfa53 Compare April 25, 2025 20:58
@katmayb katmayb force-pushed the message-envelope-25.2 branch from 0f9cb68 to 6804b9d Compare May 1, 2025 15:30
@katmayb katmayb force-pushed the message-envelope-25.2 branch from 6804b9d to d33b480 Compare May 1, 2025 15:48
<a id="resolved-option"></a>`resolved` | Emit `resolved` timestamps in a format depending on the connected sink. **Note:** The `resolved` timestamp is emitted as a separate message, and has its own envelope containing a `resolved` key and a timestamp value as a string. For more details on the `resolved` options, refer to [Resolved messages]({% link {{ page.version.version }}/changefeed-messages.md %}#resolved-messages). | All
<a id="updated-option"></a>`updated` | Add an [`"updated"`](#updated) timestamp field to each message, showing the commit time of the change. When the changefeed runs an initial scan or a [schema change backfill]({% link {{ page.version.version }}/changefeed-messages.md %}#schema-changes-with-column-backfill), the `"updated"` field will reflect the time of the scan or backfill, not the MVCC timestamp. If you use `updated` with [`enriched_properties=source`](#enriched-properties-option), the `"updated"` field will be replaced with `"ts_ns"` and `"ts_hlc"` in the [`"source"`](#source) fields. **Note:** `envelope=enriched` with the `updated` option will not produce a change event commit timestamp in the message—to include the timestamp, use `updated` with `envelope=enriched, enriched_properties=source, updated`. | All

### `envelope` option examples
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All this content except the enriched part was existing.

New content begins again in the Field Reference section.

@katmayb katmayb changed the title WIP Create new Message Envelope page with new 25.2 features Create new Message Envelope page with new 25.2 features May 1, 2025
@katmayb katmayb marked this pull request as ready for review May 1, 2025 15:50
@katmayb katmayb requested review from rohan-joshi, asg0451 and aerfrei May 1, 2025 15:58
Copy link

@aerfrei aerfrei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read through the new page. Everything was clear and accurate! Thanks so much for this

Copy link

@asg0451 asg0451 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also add a note either to the ordering guarantees or to the ts_ns enriched section like we discussed?

CREATE CHANGEFEED FOR TABLE products INTO 'kafka://localhost:9092' WITH envelope=enriched, enriched_properties=source, updated;
~~~
~~~
{"after": {"category": "Home & Kitchen", "created_at": "2025-04-30T20:02:35.40316", "description": "Adjustable LED desk lamp with touch controls", "id": "4b36388a-f7e6-4b95-9f78-3aee9e2060d6", "in_stock": true, "name": "LED Desk Lamp", "price": 22.30}, "op": "c", "source": {"changefeed_sink": "kafka", "cluster_id": "585e6512-ea54-490a-8f1d-50c8d182a2e6", "cluster_name": "", "database_name": "test", "db_version": "v25.2.0-beta.2", "job_id": "1068153948173991937", "node_id": "1", "node_name": "localhost", "origin": "cockroachdb", "primary_keys": ["id"], "schema_name": "public", "source_node_locality": "", "table_name": "products", "ts_hlc": "1746045115619002000.0000000000", "ts_ns": 1746045115619002000}, "ts_ns": 1746045115679811000}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is annoying to read. maybe we should split it across multiple lines?


### `"payload"`

The change event data. `"payload"` is a wrapper only with [webhook]({% link {{ page.version.version }}/changefeed-sinks.md %}#webhook-sink) sinks and when the [`enriched_properties`](#enriched-properties-option) options is used.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess there are two different payloads in question here, which is a little confusing. can you try to disambiguate them?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this organization/format doesnt make that much sense given that we're mixing fields from various envelopes together. this makes it seem like you can get all these fields but actually you only get a subset depending on envelope

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added bullet points to the payload section to call out the difference between the two types of payload wrappers mentioned here. Lmk if you wanted something else.

As a reference, I think this works fine, and each description comes with the option/configuration that enables that field. The alternative would involve every combination as an example that imo would be harder to reference. Given the large number of examples already on this page, I'd like to give this format a shot, but be ready to adapt if we get signal this isn't working.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think the fields and options are kind of ripe for automation something like what docs do for the cluster settings page; however, that is a much bigger project for another day involving more stakeholders.

- `"changefeed_sink"`: The [sink]({% link {{ page.version.version }}/changefeed-sinks.md %}) type receiving the changefeed (e.g., `"kafka"`, `"sinkless buffer"`).
- `"cluster_id"`: The [unique ID]({% link {{ page.version.version }}/cockroach-start.md %}#standard-output).
- `"cluster_name"`: The name, [if configured]({% link {{ page.version.version }}/cockroach-start.md %}#flags-cluster-name).
- `"db_version"`: The CockroachDB version.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing database_name. are any others missing too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added database_name... I don't think so, I just cross-referenced with the full-fidelity message.

@katmayb
Copy link
Contributor Author

katmayb commented May 9, 2025

can you also add a note either to the ordering guarantees or to the ts_ns enriched section like we discussed?

Added similar language to what was already in the PR, in the ts_ns field ref spot and within the Ordering Guarantees section on the other Message page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants