|
63 | 63 | respondWorkflowTaskCompleted = "RespondWorkflowTaskCompleted"
|
64 | 64 | pollActivityTaskQueue = "PollActivityTaskQueue"
|
65 | 65 | frontendPackagePrefix = "/temporal.api.workflowservice.v1.WorkflowService/"
|
| 66 | + operatorServicePrefix = "/temporal.api.operatorservice.v1.OperatorService/" |
| 67 | + adminServicePrefix = "/temporal.server.api.adminservice.v1.AdminService/" |
66 | 68 |
|
67 | 69 | grpcActions = map[string]struct{}{
|
68 | 70 | metrics.FrontendQueryWorkflowScope: {},
|
@@ -102,16 +104,29 @@ func NewTelemetryInterceptor(
|
102 | 104 |
|
103 | 105 | // Use this method to override scope used for reporting a metric.
|
104 | 106 | // Ideally this method should never be used.
|
105 |
| -func (ti *TelemetryInterceptor) overrideOperationTag(operation string, req interface{}) string { |
106 |
| - // GetWorkflowExecutionHistory method handles both long poll and regular calls. |
107 |
| - // Current plan is to eventually split GetWorkflowExecutionHistory into two APIs, |
108 |
| - // remove this "if" case when that is done. |
109 |
| - if operation == metrics.FrontendGetWorkflowExecutionHistoryScope { |
110 |
| - request := req.(*workflowservice.GetWorkflowExecutionHistoryRequest) |
111 |
| - if request.GetWaitNewEvent() { |
112 |
| - return metrics.FrontendPollWorkflowExecutionHistoryScope |
| 107 | +func (ti *TelemetryInterceptor) overrideOperationTag(fullName, operation string, req interface{}) string { |
| 108 | + if strings.HasPrefix(fullName, frontendPackagePrefix) { |
| 109 | + // GetWorkflowExecutionHistory method handles both long poll and regular calls. |
| 110 | + // Current plan is to eventually split GetWorkflowExecutionHistory into two APIs, |
| 111 | + // remove this "if" case when that is done. |
| 112 | + if operation == metrics.FrontendGetWorkflowExecutionHistoryScope { |
| 113 | + request := req.(*workflowservice.GetWorkflowExecutionHistoryRequest) |
| 114 | + if request.GetWaitNewEvent() { |
| 115 | + return metrics.FrontendPollWorkflowExecutionHistoryScope |
| 116 | + } |
113 | 117 | }
|
| 118 | + return operation |
| 119 | + } |
| 120 | + |
| 121 | + // prepend Operator prefix to Operator APIs |
| 122 | + if strings.HasPrefix(fullName, operatorServicePrefix) { |
| 123 | + return "Operator" + operation |
114 | 124 | }
|
| 125 | + // prepend Admin prefix to Admin APIs |
| 126 | + if strings.HasPrefix(fullName, adminServicePrefix) { |
| 127 | + return "Admin" + operation |
| 128 | + } |
| 129 | + |
115 | 130 | return operation
|
116 | 131 | }
|
117 | 132 |
|
@@ -221,7 +236,7 @@ func (ti *TelemetryInterceptor) metricsHandlerLogTags(
|
221 | 236 | methodName string,
|
222 | 237 | ) (metrics.Handler, []tag.Tag) {
|
223 | 238 |
|
224 |
| - overridedMethodName := ti.overrideOperationTag(methodName, req) |
| 239 | + overridedMethodName := ti.overrideOperationTag(fullMethod, methodName, req) |
225 | 240 |
|
226 | 241 | nsName := GetNamespace(ti.namespaceRegistry, req)
|
227 | 242 | if nsName == "" {
|
|
0 commit comments