|
| 1 | +/* |
| 2 | + * Copyright (C) 2020 Temporal Technologies, Inc. All Rights Reserved. |
| 3 | + * |
| 4 | + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 5 | + * |
| 6 | + * Modifications copyright (C) 2017 Uber Technologies, Inc. |
| 7 | + * |
| 8 | + * Licensed under the Apache License, Version 2.0 (the "License"). You may not |
| 9 | + * use this file except in compliance with the License. A copy of the License is |
| 10 | + * located at |
| 11 | + * |
| 12 | + * http://aws.amazon.com/apache2.0 |
| 13 | + * |
| 14 | + * or in the "license" file accompanying this file. This file is distributed on |
| 15 | + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 16 | + * express or implied. See the License for the specific language governing |
| 17 | + * permissions and limitations under the License. |
| 18 | + */ |
| 19 | + |
| 20 | +package io.temporal.opentracing; |
| 21 | + |
| 22 | +public class OpenTracingConfig { |
| 23 | + private final String workflowStartOperationNamePrefix; |
| 24 | + private final String workflowStartWithSignalOperationNamePrefix; |
| 25 | + private final String workflowRunOperationNamePrefix; |
| 26 | + private final String childWorkflowStartOperationNamePrefix; |
| 27 | + private final String activityStartOperationNamePrefix; |
| 28 | + private final String activityRunOperationNamePrefix; |
| 29 | + |
| 30 | + private OpenTracingConfig( |
| 31 | + String workflowStartOperationNamePrefix, |
| 32 | + String workflowStartWithSignalOperationNamePrefix, |
| 33 | + String workflowRunOperationNamePrefix, |
| 34 | + String childWorkflowStartOperationNamePrefix, |
| 35 | + String activityStartOperationNamePrefix, |
| 36 | + String activityRunOperationNamePrefix) { |
| 37 | + this.workflowStartOperationNamePrefix = workflowStartOperationNamePrefix; |
| 38 | + this.workflowStartWithSignalOperationNamePrefix = workflowStartWithSignalOperationNamePrefix; |
| 39 | + this.workflowRunOperationNamePrefix = workflowRunOperationNamePrefix; |
| 40 | + this.childWorkflowStartOperationNamePrefix = childWorkflowStartOperationNamePrefix; |
| 41 | + this.activityStartOperationNamePrefix = activityStartOperationNamePrefix; |
| 42 | + this.activityRunOperationNamePrefix = activityRunOperationNamePrefix; |
| 43 | + } |
| 44 | + |
| 45 | + public String getWorkflowStartOperationNamePrefix() { |
| 46 | + return workflowStartOperationNamePrefix; |
| 47 | + } |
| 48 | + |
| 49 | + public String getWorkflowStartWithSignalOperationNamePrefix() { |
| 50 | + return workflowStartWithSignalOperationNamePrefix; |
| 51 | + } |
| 52 | + |
| 53 | + public String getWorkflowRunOperationNamePrefix() { |
| 54 | + return workflowRunOperationNamePrefix; |
| 55 | + } |
| 56 | + |
| 57 | + public String getChildWorkflowStartOperationNamePrefix() { |
| 58 | + return childWorkflowStartOperationNamePrefix; |
| 59 | + } |
| 60 | + |
| 61 | + public String getActivityStartOperationNamePrefix() { |
| 62 | + return activityStartOperationNamePrefix; |
| 63 | + } |
| 64 | + |
| 65 | + public String getActivityRunOperationNamePrefix() { |
| 66 | + return activityRunOperationNamePrefix; |
| 67 | + } |
| 68 | + |
| 69 | + public static Builder newBuilder() { |
| 70 | + return new Builder(); |
| 71 | + } |
| 72 | + |
| 73 | + public static final class Builder { |
| 74 | + private String workflowStartOperationNamePrefix = "StartWorkflow"; |
| 75 | + private String workflowStartWithSignalOperationNamePrefix = "SignalWithStartWorkflow"; |
| 76 | + private String workflowRunOperationNamePrefix = "RunWorkflow"; |
| 77 | + private String childWorkflowStartOperationNamePrefix = "StartChildWorkflow"; |
| 78 | + private String activityStartOperationNamePrefix = "StartActivity"; |
| 79 | + private String activityRunOperationNamePrefix = "RunActivity"; |
| 80 | + |
| 81 | + private Builder() {} |
| 82 | + |
| 83 | + public Builder setWorkflowStartOperationNamePrefix(String workflowStartOperationNamePrefix) { |
| 84 | + this.workflowStartOperationNamePrefix = workflowStartOperationNamePrefix; |
| 85 | + return this; |
| 86 | + } |
| 87 | + |
| 88 | + public Builder setWorkflowStartWithSignalOperationNamePrefix( |
| 89 | + String workflowStartWithSignalOperationNamePrefix) { |
| 90 | + this.workflowStartWithSignalOperationNamePrefix = workflowStartWithSignalOperationNamePrefix; |
| 91 | + return this; |
| 92 | + } |
| 93 | + |
| 94 | + public Builder setWorkflowRunOperationNamePrefix(String workflowRunOperationNamePrefix) { |
| 95 | + this.workflowRunOperationNamePrefix = workflowRunOperationNamePrefix; |
| 96 | + return this; |
| 97 | + } |
| 98 | + |
| 99 | + public Builder setChildWorkflowStartOperationNamePrefix( |
| 100 | + String childWorkflowStartOperationNamePrefix) { |
| 101 | + this.childWorkflowStartOperationNamePrefix = childWorkflowStartOperationNamePrefix; |
| 102 | + return this; |
| 103 | + } |
| 104 | + |
| 105 | + public Builder setActivityStartOperationNamePrefix(String activityStartOperationNamePrefix) { |
| 106 | + this.activityStartOperationNamePrefix = activityStartOperationNamePrefix; |
| 107 | + return this; |
| 108 | + } |
| 109 | + |
| 110 | + public Builder setActivityRunOperationNamePrefix(String activityRunOperationNamePrefix) { |
| 111 | + this.activityRunOperationNamePrefix = activityRunOperationNamePrefix; |
| 112 | + return this; |
| 113 | + } |
| 114 | + |
| 115 | + public OpenTracingConfig build() { |
| 116 | + return new OpenTracingConfig( |
| 117 | + workflowStartOperationNamePrefix, |
| 118 | + workflowStartWithSignalOperationNamePrefix, |
| 119 | + workflowRunOperationNamePrefix, |
| 120 | + childWorkflowStartOperationNamePrefix, |
| 121 | + activityStartOperationNamePrefix, |
| 122 | + activityRunOperationNamePrefix); |
| 123 | + } |
| 124 | + } |
| 125 | +} |
0 commit comments