ExtractNoGenerateMetrics checks for presence of context keys that indicate no span-derived metrics should be generated for the request. If any such context key is present, this will return true, otherwise it will return false.
(ctx context.Context)
| 292 | // span-derived metrics should be generated for the request. If any such context |
| 293 | // key is present, this will return true, otherwise it will return false. |
| 294 | func ExtractNoGenerateMetrics(ctx context.Context) bool { |
| 295 | // check gRPC context |
| 296 | if len(metadata.ValueFromIncomingContext(ctx, NoGenerateMetricsContextKey)) > 0 { |
| 297 | return true |
| 298 | } |
| 299 | |
| 300 | // check http context |
| 301 | if len(client.FromContext(ctx).Metadata.Get(NoGenerateMetricsContextKey)) > 0 { |
| 302 | return true |
| 303 | } |
| 304 | |
| 305 | return false |
| 306 | } |