Skip to content

Commit

Permalink
[chore][exporter/loadbalancing] Migrate to OTel from OC metrics (#33550)
Browse files Browse the repository at this point in the history
This PR migrates from OpenCensus to OTel for metrics, via mdatagen.

Before:
```
# HELP otelcol_loadbalancer_backend_latency Response latency in ms for the backends
# TYPE otelcol_loadbalancer_backend_latency histogram
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:5317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="5"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:5317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="10"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:5317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="20"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:5317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="50"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:5317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="100"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:5317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="200"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:5317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="500"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:5317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="1000"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:5317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="2000"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:5317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="5000"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:5317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="+Inf"} 1
otelcol_loadbalancer_backend_latency_sum{endpoint="127.0.0.1:5317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev"} 0
otelcol_loadbalancer_backend_latency_count{endpoint="127.0.0.1:5317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:6317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="5"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:6317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="10"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:6317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="20"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:6317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="50"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:6317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="100"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:6317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="200"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:6317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="500"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:6317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="1000"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:6317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="2000"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:6317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="5000"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:6317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="+Inf"} 1
otelcol_loadbalancer_backend_latency_sum{endpoint="127.0.0.1:6317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev"} 0
otelcol_loadbalancer_backend_latency_count{endpoint="127.0.0.1:6317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:7317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="5"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:7317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="10"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:7317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="20"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:7317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="50"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:7317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="100"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:7317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="200"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:7317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="500"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:7317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="1000"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:7317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="2000"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:7317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="5000"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:7317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",le="+Inf"} 1
otelcol_loadbalancer_backend_latency_sum{endpoint="127.0.0.1:7317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev"} 0
otelcol_loadbalancer_backend_latency_count{endpoint="127.0.0.1:7317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev"} 1
# HELP otelcol_loadbalancer_backend_outcome Number of success/failures for each endpoint
# TYPE otelcol_loadbalancer_backend_outcome counter
otelcol_loadbalancer_backend_outcome{endpoint="127.0.0.1:5317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",success="true"} 1
otelcol_loadbalancer_backend_outcome{endpoint="127.0.0.1:6317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",success="true"} 1
otelcol_loadbalancer_backend_outcome{endpoint="127.0.0.1:7317",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",success="true"} 1
# HELP otelcol_loadbalancer_num_backend_updates Number of times the list of backends was updated
# TYPE otelcol_loadbalancer_num_backend_updates counter
otelcol_loadbalancer_num_backend_updates{resolver="static",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev"} 2
# HELP otelcol_loadbalancer_num_backends Current number of backends in use
# TYPE otelcol_loadbalancer_num_backends gauge
otelcol_loadbalancer_num_backends{resolver="static",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev"} 3
# HELP otelcol_loadbalancer_num_resolutions Number of times the resolver triggered a new resolutions
# TYPE otelcol_loadbalancer_num_resolutions counter
otelcol_loadbalancer_num_resolutions{resolver="static",service_instance_id="6960afd1-4bb6-4c52-bdc7-d8b236ad8eba",service_name="otelcontribcol",service_version="0.102.0-dev",success="true"} 2
```

After:
```
# HELP otelcol_loadbalancer_backend_latency Response latency in ms for the backends.
# TYPE otelcol_loadbalancer_backend_latency histogram
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:5317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="5"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:5317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="10"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:5317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="20"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:5317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="50"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:5317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="100"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:5317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="200"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:5317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="500"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:5317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="1000"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:5317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="2000"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:5317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="5000"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:5317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="+Inf"} 1
otelcol_loadbalancer_backend_latency_sum{endpoint="127.0.0.1:5317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev"} 0
otelcol_loadbalancer_backend_latency_count{endpoint="127.0.0.1:5317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:6317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="5"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:6317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="10"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:6317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="20"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:6317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="50"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:6317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="100"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:6317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="200"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:6317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="500"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:6317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="1000"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:6317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="2000"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:6317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="5000"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:6317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="+Inf"} 1
otelcol_loadbalancer_backend_latency_sum{endpoint="127.0.0.1:6317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev"} 0
otelcol_loadbalancer_backend_latency_count{endpoint="127.0.0.1:6317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:7317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="5"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:7317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="10"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:7317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="20"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:7317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="50"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:7317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="100"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:7317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="200"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:7317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="500"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:7317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="1000"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:7317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="2000"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:7317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="5000"} 1
otelcol_loadbalancer_backend_latency_bucket{endpoint="127.0.0.1:7317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",le="+Inf"} 1
otelcol_loadbalancer_backend_latency_sum{endpoint="127.0.0.1:7317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev"} 0
otelcol_loadbalancer_backend_latency_count{endpoint="127.0.0.1:7317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev"} 1
# HELP otelcol_loadbalancer_backend_outcome Number of success/failures for each endpoint.
# TYPE otelcol_loadbalancer_backend_outcome counter
otelcol_loadbalancer_backend_outcome{endpoint="127.0.0.1:5317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",success="true"} 1
otelcol_loadbalancer_backend_outcome{endpoint="127.0.0.1:6317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",success="true"} 1
otelcol_loadbalancer_backend_outcome{endpoint="127.0.0.1:7317",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",success="true"} 1
# HELP otelcol_loadbalancer_num_backend_updates Number of times the list of backends was updated.
# TYPE otelcol_loadbalancer_num_backend_updates counter
otelcol_loadbalancer_num_backend_updates{resolver="static",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev"} 2
# HELP otelcol_loadbalancer_num_backends Current number of backends in use.
# TYPE otelcol_loadbalancer_num_backends gauge
otelcol_loadbalancer_num_backends{resolver="static",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev"} 3
# HELP otelcol_loadbalancer_num_resolutions Number of times the resolver triggered a new resolutions.
# TYPE otelcol_loadbalancer_num_resolutions counter
otelcol_loadbalancer_num_resolutions{resolver="static",service_instance_id="660642c9-c94c-48ae-abf3-3808f8562941",service_name="otelcontribcol",service_version="0.102.0-dev",success="true"} 2
```

Tested with this configuration file:
```yaml
receivers:
  otlp/loadbalancer:
    protocols:
      grpc:
        endpoint: 127.0.0.1:4317
  otlp/backend-1:
    protocols:
      grpc:
        endpoint: 127.0.0.1:5317
  otlp/backend-2:
    protocols:
      grpc:
        endpoint: 127.0.0.1:6317
  otlp/backend-3:
    protocols:
      grpc:
        endpoint: 127.0.0.1:7317

processors:

exporters:
  nop:
  loadbalancing:
    protocol:
      otlp:
        tls:
          insecure: true
    resolver:
      static:
        hostnames:
        - 127.0.0.1:5317
        - 127.0.0.1:6317
        - 127.0.0.1:7317

service:
  pipelines:
    traces/loadbalancer:
      receivers: [ otlp/loadbalancer ]
      processors: []
      exporters: [ loadbalancing ]
    traces/backends:
      receivers: [ otlp/backend-1, otlp/backend-2, otlp/backend-3 ]
      processors: []
      exporters: [ nop ]
    logs/loadbalancer:
      receivers: [ otlp/loadbalancer ]
      processors: []
      exporters: [ loadbalancing ]
    logs/backends:
      receivers: [ otlp/backend-1, otlp/backend-2, otlp/backend-3 ]
      processors: []
      exporters: [ nop ]
```

And this was the test command:
```terminal
telemetrygen traces --traces 100 --otlp-insecure --otlp-attributes='vip="false"'
```

Closes #33472

Signed-off-by: Juraci Paixão Kröhling <[email protected]>

---------

Signed-off-by: Juraci Paixão Kröhling <[email protected]>
  • Loading branch information
jpkrohling authored Jun 20, 2024
1 parent e362c5d commit 40b334a
Show file tree
Hide file tree
Showing 29 changed files with 642 additions and 310 deletions.
47 changes: 47 additions & 0 deletions exporter/loadbalancingexporter/documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[comment]: <> (Code generated by mdatagen. DO NOT EDIT.)

# loadbalancing

## Internal Telemetry

The following telemetry is emitted by this component.

### loadbalancer_backend_latency

Response latency in ms for the backends.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| ms | Histogram | Int |

### loadbalancer_backend_outcome

Number of successes and failures for each endpoint.

| Unit | Metric Type | Value Type | Monotonic |
| ---- | ----------- | ---------- | --------- |
| {outcomes} | Sum | Int | true |

### loadbalancer_num_backend_updates

Number of times the list of backends was updated.

| Unit | Metric Type | Value Type | Monotonic |
| ---- | ----------- | ---------- | --------- |
| {updates} | Sum | Int | true |

### loadbalancer_num_backends

Current number of backends in use.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| {backends} | Gauge | Int |

### loadbalancer_num_resolutions

Number of times the resolver has triggered new resolutions.

| Unit | Metric Type | Value Type | Monotonic |
| ---- | ----------- | ---------- | --------- |
| {resolutions} | Sum | Int | true |
3 changes: 0 additions & 3 deletions exporter/loadbalancingexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ package loadbalancingexporter // import "github.com/open-telemetry/opentelemetry
import (
"context"

"go.opencensus.io/stats/view"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/exporter"
"go.opentelemetry.io/collector/exporter/otlpexporter"
Expand All @@ -18,8 +17,6 @@ import (

// NewFactory creates a factory for the exporter.
func NewFactory() exporter.Factory {
_ = view.Register(metricViews()...)

return exporter.NewFactory(
metadata.Type,
createDefaultConfig,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion exporter/loadbalancingexporter/generated_package_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions exporter/loadbalancingexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden v0.103.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.103.0
github.com/stretchr/testify v1.9.0
go.opencensus.io v0.24.0
go.opentelemetry.io/collector/component v0.103.0
go.opentelemetry.io/collector/config/configtelemetry v0.103.0
go.opentelemetry.io/collector/confmap v0.103.0
go.opentelemetry.io/collector/consumer v0.103.0
go.opentelemetry.io/collector/exporter v0.103.0
go.opentelemetry.io/collector/exporter/otlpexporter v0.103.0
go.opentelemetry.io/collector/otelcol v0.103.0
go.opentelemetry.io/collector/pdata v1.10.0
go.opentelemetry.io/collector/semconv v0.103.0
go.opentelemetry.io/otel v1.27.0
go.opentelemetry.io/otel/metric v1.27.0
go.opentelemetry.io/otel/sdk/metric v1.27.0
go.opentelemetry.io/otel/trace v1.27.0
go.uber.org/goleak v1.3.0
go.uber.org/multierr v1.11.0
Expand Down Expand Up @@ -101,14 +103,14 @@ require (
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/collector v0.103.0 // indirect
go.opentelemetry.io/collector/config/configauth v0.103.0 // indirect
go.opentelemetry.io/collector/config/configcompression v1.10.0 // indirect
go.opentelemetry.io/collector/config/configgrpc v0.103.0 // indirect
go.opentelemetry.io/collector/config/confignet v0.103.0 // indirect
go.opentelemetry.io/collector/config/configopaque v1.10.0 // indirect
go.opentelemetry.io/collector/config/configretry v0.103.0 // indirect
go.opentelemetry.io/collector/config/configtelemetry v0.103.0 // indirect
go.opentelemetry.io/collector/config/configtls v0.103.0 // indirect
go.opentelemetry.io/collector/config/internal v0.103.0 // indirect
go.opentelemetry.io/collector/confmap/converter/expandconverter v0.103.0 // indirect
Expand All @@ -128,7 +130,6 @@ require (
go.opentelemetry.io/contrib/config v0.7.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0 // indirect
go.opentelemetry.io/contrib/propagators/b3 v1.27.0 // indirect
go.opentelemetry.io/otel v1.27.0 // indirect
go.opentelemetry.io/otel/bridge/opencensus v1.27.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.27.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.27.0 // indirect
Expand All @@ -139,7 +140,6 @@ require (
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.27.0 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.27.0 // indirect
go.opentelemetry.io/otel/sdk v1.27.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.27.0 // indirect
go.opentelemetry.io/proto/otlp v1.2.0 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
golang.org/x/net v0.26.0 // indirect
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 40b334a

Please sign in to comment.