Skip to content

Env-aware CHASM serialization#10360

Merged
stephanos merged 1 commit into
mainfrom
stephanos/otel-chasm-datablog
May 26, 2026
Merged

Env-aware CHASM serialization#10360
stephanos merged 1 commit into
mainfrom
stephanos/otel-chasm-datablog

Conversation

@stephanos
Copy link
Copy Markdown
Contributor

@stephanos stephanos commented May 22, 2026

What changed?

Replaced hard-coded proto encode calls with env-aware encoding.

Why?

Consistency. Only one path to encode.

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)

// encodingTypeFromEnv returns an EncodingType based on the environment variable `TEMPORAL_TEST_DATA_ENCODING`.
// It defaults to "ENCODING_TYPE_PROTO3" codec if the environment variable is not set.
func EncodingTypeFromEnv() enumspb.EncodingType {
func encodingTypeFromEnv() enumspb.EncodingType {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

drive-by change: this didn't need to be exported

@stephanos stephanos force-pushed the stephanos/otel-chasm-datablog branch 13 times, most recently from 3caafd2 to 80c8f5b Compare May 26, 2026 15:15
@stephanos stephanos force-pushed the stephanos/otel-chasm-datablog branch from 80c8f5b to f57ec46 Compare May 26, 2026 15:16
@stephanos stephanos marked this pull request as ready for review May 26, 2026 15:17
@stephanos stephanos requested review from a team as code owners May 26, 2026 15:17
Comment thread chasm/tree.go
data, err := marshalDeterministic(field.val.Interface().(proto.Message))
if err != nil {
return serialization.NewSerializationError(enumspb.ENCODING_TYPE_PROTO3, err)
var err error
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: what is preferred, declaring var err, or using :=?

Copy link
Copy Markdown
Contributor Author

@stephanos stephanos May 26, 2026

Choose a reason for hiding this comment

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

We can't use := as var blob *commonpb.DataBlob is declared before and in Go we can't mix existing/non-existing vars in :=. To make it work, we'd have to invent another temp var.

@stephanos stephanos enabled auto-merge (squash) May 26, 2026 15:45
@stephanos stephanos merged commit 651fed8 into main May 26, 2026
72 checks passed
@stephanos stephanos deleted the stephanos/otel-chasm-datablog branch May 26, 2026 15:58
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.

2 participants