Skip to content

Commit 45476a9

Browse files
committed
fix(internal): add serviceName as providerName fallback
1 parent acb4918 commit 45476a9

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

internal/custom-kafka-to-flexprice.yaml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pipeline:
3737
this.orgId != null && this.orgId != "" &&
3838
this.targetItemType != null && this.targetItemType != "" &&
3939
this.methodName != null && this.methodName != "" &&
40-
this.providerName != null && this.providerName != "" &&
40+
((this.providerName != null && this.providerName != "") || (this.serviceName != null && this.serviceName != "")) &&
4141
this.id != null && this.id != "" &&
4242
this.startedAt != null && this.startedAt != ""
4343
)
@@ -47,12 +47,6 @@ pipeline:
4747
- mapping: |
4848
root = {}
4949
50-
root.external_customer_id = this.orgId.string()
51-
root.event_name = this.targetItemType.string() + "-" + this.methodName.string() + "-" + this.providerName.string()
52-
root.event_id = this.id.string()
53-
root.timestamp = this.startedAt.string()
54-
if this.targetItemId != null { root.source = this.targetItemId.string() }
55-
5650
# Start with `data` fields (extract values from key-value objects, otherwise stringify)
5751
root.properties = if this.data != null && this.data.type() == "object" {
5852
this.data.map_each(v -> if v.type() == "object" && v.key != null && v.value != null {
@@ -64,6 +58,20 @@ pipeline:
6458
{}
6559
}
6660
61+
root.properties.resolvedProviderName = ""
62+
if this.providerName != null && this.providerName != "" {
63+
root.properties.resolvedProviderName = this.providerName.string().trim()
64+
} else if this.serviceName != null && this.serviceName != "" {
65+
root.properties.resolvedProviderName = this.serviceName.string().trim()
66+
}
67+
68+
root.external_customer_id = this.orgId.string()
69+
root.event_name = (this.targetItemType.string() + "-" + this.methodName.string() + "-" + root.properties.resolvedProviderName).lowercase()
70+
root.event_id = this.id.string()
71+
root.timestamp = this.startedAt.string()
72+
if this.targetItemId != null { root.source = this.targetItemId.string() }
73+
74+
6775
# Add selected top-level fields into properties
6876
if this.byok != null {
6977
root.properties.byok = this.byok.string()

0 commit comments

Comments
 (0)