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

Already on GitHub? Sign in to your account

fix: metadata tags capturing in v0 transformation #3492

Merged
merged 4 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions src/util/customTransformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,10 @@
const tags = {
identifier: 'v0',
errored: transformationError ? true : false,
...(events.length && events[0].metadata ? getMetadata(events[0].metadata) : {}),
...(events.length && events[0].metadata ? getTransformationMetadata(events[0].metadata) : {}),
...(Object.keys(eventsMetadata).length ? getMetadata(Object.values(eventsMetadata)[0]) : {}),
...(Object.keys(eventsMetadata).length
? getTransformationMetadata(Object.values(eventsMetadata)[0])
: {}),

Check warning on line 259 in src/util/customTransformer.js

View check run for this annotation

Codecov / codecov/patch

src/util/customTransformer.js#L259

Added line #L259 was not covered by tests
Comment on lines +256 to +259
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain the issue here a bit ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

v0 execute function receives only event messages. metadata is not attached to them. Earlier tag extraction getMetadata(events[0].metdata) always returns nil. So changed extraction to eventsMetadata

};

stats.counter('user_transform_function_input_events', events.length, tags);
Expand Down
4 changes: 2 additions & 2 deletions src/v0/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1447,13 +1447,13 @@ const getTrackingPlanMetadata = (metadata) => ({
workspaceId: metadata.workspaceId,
});

const getMetadata = (metadata) => ({
const getMetadata = (metadata = {}) => ({
sourceType: metadata.sourceType,
destinationType: metadata.destinationType,
k8_namespace: metadata.namespace,
});

const getTransformationMetadata = (metadata) => ({
const getTransformationMetadata = (metadata = {}) => ({
transformationId: metadata.transformationId,
workspaceId: metadata.workspaceId,
});
Expand Down
Loading