Skip to content

Commit a24cf37

Browse files
authored
Align LoggingKeys with TracingKeys (#138)
### Motivation `LoggingKeys` and `TracingKeys` appear to have diverged in naming. We want them aligned long-term. ### Modifications Define most keys inside of `TracingKeys` and refer to them from `LoggingKeys`.
1 parent 442454d commit a24cf37

5 files changed

Lines changed: 29 additions & 26 deletions

File tree

Sources/Temporal/Instrumentation/SpanAttributes/SpanAttributes+ClientOutboundAttributes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ extension Span {
598598
case .id(let workflowId, let runId, let activityId):
599599
self.attributes[TemporalTracingKeys.workflowId] = workflowId
600600
self.attributes[TemporalTracingKeys.workflowRunId] = runId
601-
self.attributes[TemporalTracingKeys.activityID] = activityId
601+
self.attributes[TemporalTracingKeys.activityId] = activityId
602602
case .taskToken(let taskToken):
603603
self.attributes[TemporalTracingKeys.activityTaskToken] = String(bytes: taskToken.bytes, encoding: .utf8)
604604
}

Sources/Temporal/Instrumentation/SpanAttributes/SpanAttributes+TracingKeys.swift

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ package enum TemporalTracingKeys: Hashable, Sendable {
1717
package static let workflowName = "temporal.workflow.name"
1818
package static let workflowId = "temporal.workflow.id"
1919
package static let workflowType = "temporal.workflow.type"
20-
package static let workflowTaskQueue = "temporal.workflow.taskqueue"
20+
package static let workflowTaskQueue = "temporal.workflow.task-queue"
2121
package static let workflowExecutionTimeout = "temporal.workflow.execution-timeout"
2222
package static let workflowRetryPolicyInitialInterval = "temporal.workflow.retry-policy.initial-interval"
2323
package static let workflowRetryPolicyMaximumAttempts = "temporal.workflow.retry-policy.maximum-attempts"
@@ -34,7 +34,7 @@ package enum TemporalTracingKeys: Hashable, Sendable {
3434
package static let workflowParentId = "temporal.workflow.parent.id"
3535
package static let workflowParentRunId = "temporal.workflow.parent.run-id"
3636
package static let workflowStartTime = "temporal.workflow.start-time"
37-
package static let workflowTerminationReason = "temporal.workflow.termination.reason"
37+
package static let workflowTerminationReason = "temporal.workflow.termination-reason"
3838

3939
package static let workflowSearchAttributesPrefix = "temporal.workflow.search-attributes."
4040
package static let workflowMemoPrefix = "temporal.workflow.memo."
@@ -54,14 +54,14 @@ package enum TemporalTracingKeys: Hashable, Sendable {
5454
package static let workflowIdReusePolicy = "temporal.workflow.id-reuse-policy"
5555
package static let workflowCancellationType = "temporal.workflow.cancellation-type"
5656
package static let workflowVersioningIntent = "temporal.workflow.versioning-intent"
57-
package static let workflowSleepDuration = "temporal.workflow.sleep.duration"
58-
package static let workflowSleepSummary = "temporal.workflow.sleep.summary"
57+
package static let workflowSleepDuration = "temporal.workflow.sleep-duration"
58+
package static let workflowSleepSummary = "temporal.workflow.sleep-summary"
5959

60-
package static let workflowCountQuery = "temporal.workflow.count.query"
60+
package static let workflowCountQuery = "temporal.workflow.count-query"
6161
package static let workflowCountNumber = "temporal.workflow.count"
6262

63-
package static let workflowListQuery = "temporal.workflow.list.query"
64-
package static let workflowListLimit = "temporal.workflow.list.limit"
63+
package static let workflowListQuery = "temporal.workflow.list-query"
64+
package static let workflowListLimit = "temporal.workflow.list-limit"
6565

6666
package static let workflowEventHistoryCount = "temporal.workflow.event-history.count"
6767
package static let workflowEventHistorySkipArchival = "temporal.workflow.event-history.skip-archival"
@@ -73,9 +73,12 @@ package enum TemporalTracingKeys: Hashable, Sendable {
7373
package static let workflowContinueAsNewExceptionStackTrace = "temporal.workflow.continue-as-new.exception.stacktrace"
7474

7575
package static let activityName = "temporal.activity.name"
76-
package static let activityID = "temporal.activity.id"
7776
package static let activityDisableEagerExecution = "temporal.activity.disable-eager-execution"
7877
package static let activityCancellationType = "temporal.activity.cancellation-type"
78+
package static let activityCancellationReason = "temporal.activity.cancellation-reason"
79+
package static let activityAttempt = "temporal.activity.attempt"
80+
package static let unfinishedSignalHandlers = "temporal.workflow.unfinished-signals"
81+
package static let unfinishedUpdateHandlers = "temporal.workflow.unfinished-updates"
7982
package static let activityHeartbeatTimeout = "temporal.activity.heartbeat-timeout"
8083
package static let activityScheduleToCloseTimeout = "temporal.activity.schedule-to-close-timeout"
8184
package static let activityScheduleToStartTimeout = "temporal.activity.schedule-to-start-timeout"
@@ -122,5 +125,5 @@ package enum TemporalTracingKeys: Hashable, Sendable {
122125
package static let activityId = "temporal.activity.id"
123126
package static let activityHeartbeatDetails = "temporal.activity.heartbeat.details"
124127
package static let activityHeartbeatLastDetails = "temporal.activity.heartbeat.last-details"
125-
package static let activityFailCause = "temporal.activity.fail.cause"
128+
package static let activityFailCause = "temporal.activity.fail-cause"
126129
}

Sources/Temporal/Instrumentation/SpanAttributes/SpanAttributes+WorkerWorkflowOutboundAttributes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ extension Span {
119119

120120
// Activity ID, if provided
121121
if let actId = activityOptions.activityID {
122-
self.attributes[TemporalTracingKeys.activityID] = actId
122+
self.attributes[TemporalTracingKeys.activityId] = actId
123123
}
124124

125125
// Disable eager execution flag

Sources/Temporal/Statics/LoggingKeys.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
struct LoggingKeys {
16-
static let taskToken = "temporal.task.token"
17-
static let activityCancellationReason = "temporal.activity.cancellation.reason"
16+
static let taskToken = TemporalTracingKeys.activityTaskToken
17+
static let activityCancellationReason = TemporalTracingKeys.activityCancellationReason
1818
static let errorType = "error.type"
1919
static let errorMessage = "error.message"
20-
static let taskQueue = "temporal.taskQueue"
20+
static let taskQueue = TemporalTracingKeys.workflowTaskQueue
2121
static let workflowID = TemporalTracingKeys.workflowId
2222
static let workflowRunID = TemporalTracingKeys.workflowRunId
2323
static let workflowType = TemporalTracingKeys.workflowType
2424
static let workflowNamespace = TemporalTracingKeys.workflowNamespace
25-
static let workflowSignalName = "temporal.workflow.signal.name"
26-
static let workflowQueryID = "temporal.workflow.query.id"
27-
static let workflowQueryName = "temporal.workflow.query.name"
28-
static let workflowUpdateID = "temporal.workflow.update.id"
29-
static let workflowUpdateName = "temporal.workflow.update.name"
30-
static let activityID = TemporalTracingKeys.activityID
31-
static let activityName = "temporal.activity.name"
32-
static let activityAttempt = "temporal.activity.attempt"
33-
static let unfinishedSignalHandlers = "temporal.workflow.unfinished.signals"
34-
static let unfinishedUpdateHandlers = "temporal.workflow.unfinished.updates"
25+
static let workflowSignalName = TemporalTracingKeys.workflowSignalName
26+
static let workflowQueryID = TemporalTracingKeys.workflowQueryId
27+
static let workflowQueryName = TemporalTracingKeys.workflowQueryName
28+
static let workflowUpdateID = TemporalTracingKeys.workflowUpdateId
29+
static let workflowUpdateName = TemporalTracingKeys.workflowUpdateName
30+
static let activityID = TemporalTracingKeys.activityId
31+
static let activityName = TemporalTracingKeys.activityName
32+
static let activityAttempt = TemporalTracingKeys.activityAttempt
33+
static let unfinishedSignalHandlers = TemporalTracingKeys.unfinishedSignalHandlers
34+
static let unfinishedUpdateHandlers = TemporalTracingKeys.unfinishedUpdateHandlers
3535
}

Tests/TemporalTests/Worker/Workflow/HandlerUnfinishedPolicyTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ extension TestServerDependentTests {
9292

9393
#expect(warningEntry != nil, "Expected an unfinished handler warning at info level")
9494
if let entry = warningEntry, let metadata = entry.metadata {
95-
let signalMeta = metadata["temporal.workflow.unfinished.signals"]
95+
let signalMeta = metadata["temporal.workflow.unfinished-signals"]
9696
#expect(signalMeta != nil, "Expected signal metadata key")
9797
if let signalMeta {
9898
#expect("\(signalMeta)".contains("WarnSignal"), "Expected metadata to mention WarnSignal")
@@ -162,7 +162,7 @@ extension TestServerDependentTests {
162162

163163
#expect(warningEntry != nil, "Expected an unfinished handler warning at info level")
164164
if let entry = warningEntry, let metadata = entry.metadata {
165-
let updateMeta = metadata["temporal.workflow.unfinished.updates"]
165+
let updateMeta = metadata["temporal.workflow.unfinished-updates"]
166166
#expect(updateMeta != nil, "Expected update metadata key")
167167
if let updateMeta {
168168
#expect("\(updateMeta)".contains("WarnUpdate"), "Expected metadata to mention WarnUpdate")

0 commit comments

Comments
 (0)