---
source: apollo-router/src/plugins/telemetry/config_new/instruments.rs
description: Custom counter using cache selector
expression: "&metrics.all()"
info:
telemetry:
instrumentation:
instruments:
default_requirement_level: none
cache:
apollo.router.operations.entity.cache:
attributes:
entity.type:
alias: entity_type
subgraph.name:
subgraph_name: true
supergraph.operation.name:
supergraph_operation_name: string
subgraph:
only_cache_hit_on_subgraph_products:
type: counter
value:
cache: hit
unit: hit
description: counter of subgraph request cache hit on subgraph products
condition:
all:
- eq:
- subgraph_name: true
- products
- gt:
- cache: hit
entity_type: all
- 0
attributes:
subgraph.name: true
supergraph.operation.name:
supergraph_operation_name: string
only_cache_hit_on_subgraph_products_on_product_entity:
type: counter
value:
cache: hit
entity_type: Product
unit: hit
description: counter of subgraph request cache hit on subgraph products on product entity
condition:
all:
- eq:
- subgraph_name: true
- products
- gt:
- cache: hit
- 0
attributes:
subgraph.name: true
supergraph.operation.name:
supergraph_operation_name: string
---
- name: apollo.router.operations.entity.cache
description: Entity cache hit/miss operations at the subgraph level
unit: ops
data:
datapoints:
- value: 0
attributes:
cache.hit: false
entity_type: Product
subgraph.name: products
supergraph.operation.name: Test
- value: 0
attributes:
cache.hit: false
entity_type: Review
subgraph.name: products
supergraph.operation.name: Test
- value: 3
attributes:
cache.hit: true
entity_type: Product
subgraph.name: products
supergraph.operation.name: Test
- value: 5
attributes:
cache.hit: true
entity_type: Review
subgraph.name: products
supergraph.operation.name: Test
- name: only_cache_hit_on_subgraph_products
description: counter of subgraph request cache hit on subgraph products
unit: hit
data:
datapoints:
- value: 8
attributes:
subgraph.name: products
supergraph.operation.name: Test
- name: only_cache_hit_on_subgraph_products_on_product_entity
description: counter of subgraph request cache hit on subgraph products on product entity
unit: hit
data:
datapoints:
- value: 3
attributes:
subgraph.name: products
supergraph.operation.name: Test