telemetry.go ×10

Frontier kind: Code frontier

unlabeled · c_fa38c52e1de8

15 tests · 4120 LOC · 182 files · introduces 0 tests · 46 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
12 ranges46 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
646 ranges4120 lines · 182 files · Browse complete extent
All tests (intent)
15 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 46 introduced LOC across 12 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/common/rpc/interceptor/telemetry.go 40 introduced LOC · 10 ranges

Open complete file

168 info *grpc.UnaryServerInfo,
169 handler grpc.UnaryHandler,
170 > ) (any, error) { telemetry.go
171 > methodName := api.MethodName(info.FullMethod)
172 > nsName := MustGetNamespaceName(ti.namespaceRegistry, req)
173 >
174 > metricsHandler, logTags := ti.unaryMetricsHandlerLogTags(req, info.FullMethod, methodName, nsName)
175 >
176 > ctx = AddTelemetryContext(ctx, metricsHandler)
177 > metrics.ServiceRequests.With(metricsHandler).Record(1)
178 >
179 > startTime := time.Now().UTC()
180 > defer func() {
181 > ti.RecordLatencyMetrics(ctx, startTime, metricsHandler)
182 > }()
183
184 > resp, err := handler(ctx, req) telemetry.go
185 >
186 > if configs.IsAPIOperation(info.FullMethod) {
187 metrics.OperationCounter.With(metricsHandler).Record(
188 1,
191 }
192
193 > if err != nil { telemetry.go
194 ti.requestErrorHandler.HandleError(req, info.FullMethod, metricsHandler, logTags, err, nsName)
195 > } else { telemetry.go
196 > // emit action metrics only after successful calls
197 > ti.emitActionMetric(methodName, info.FullMethod, req, metricsHandler, resp)
198 > }
199
200 > return resp, err telemetry.go
201 }
202
205 }
206
207 > func (ti *TelemetryInterceptor) RecordLatencyMetrics(ctx context.Context, startTime time.Time, metricsHandler metrics.Handler) { telemetry.go
208 > userLatencyDuration := time.Duration(0)
209 > if val, ok := metrics.ContextCounterGet(ctx, metrics.HistoryWorkflowExecutionCacheLatency.Name()); ok {
210 userLatencyDuration = time.Duration(val)
211 metrics.ServiceLatencyUserLatency.With(metricsHandler).Record(userLatencyDuration)
212 }
213
214 > latency := time.Since(startTime) telemetry.go
215 > metrics.ServiceLatency.With(metricsHandler).Record(latency)
216 > noUserLatency := max(0, latency-userLatencyDuration)
217 > metrics.ServiceLatencyNoUserLatency.With(metricsHandler).Record(noUserLatency)
218 }
219
371 methodName string,
372 nsName namespace.Name,
373 > ) (metrics.Handler, []tag.Tag) { telemetry.go
374 > overridedMethodName := telemetryUnaryOverrideOperationTag(fullMethod, methodName, req)
375 >
376 > if nsName == "" {
377 > return baseMetricsHandler.WithTags(metrics.OperationTag(overridedMethodName), metrics.NamespaceUnknownTag()),
378 > []tag.Tag{tag.Operation(overridedMethodName)}
379 > }
380 return baseMetricsHandler.WithTags(metrics.OperationTag(overridedMethodName), metrics.NamespaceTag(nsName.String())),
381 []tag.Tag{tag.Operation(overridedMethodName), tag.WorkflowNamespace(nsName.String())}
385 fullMethod string,
386 methodName string,
387 > nsName namespace.Name) (metrics.Handler, []tag.Tag) { telemetry.go
388 > return CreateUnaryMetricsHandlerLogTags(ti.metricsHandler, req, fullMethod, methodName, nsName)
389 > }
390
391 func (ti *TelemetryInterceptor) streamMetricsHandlerLogTags(
409 return metrics.NoopMetricsHandler
410 }
411 > return handler telemetry.go
412 }
go.temporal.io/server/service/frontend/configs/quotas.go 6 introduced LOC · 2 ranges

Open complete file

386 }
387
388 > func IsAPIOperation(apiFullName string) bool { quotas.go
389 > if _, ok := operationExcludedAPIs[apiFullName]; ok {
390 return false
391 }
392
393 > _, inAPI := APIToPriority[apiFullName] quotas.go
394 > _, inNamespaceReplicationInducingAPI := NamespaceReplicationInducingAPIToPriority[apiFullName]
395 >
396 > return inAPI || inNamespaceReplicationInducingAPI
397 }