• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

grpc / grpc-java / #19563

26 Nov 2024 12:47AM UTC coverage: 88.559% (-0.02%) from 88.582%
#19563

push

github

web-flow
xds: Add counter and gauge metrics  (#11661)

Adds the following xDS client metrics defined in [A78](https://github.com/grpc/proposal/blob/master/A78-grpc-metrics-wrr-pf-xds.md#xdsclient).

Counters
- grpc.xds_client.server_failure
- grpc.xds_client.resource_updates_valid
- grpc.xds_client.resource_updates_invalid

Gauges
- grpc.xds_client.connected
- grpc.xds_client.resources

33368 of 37679 relevant lines covered (88.56%)

0.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/../xds/src/main/java/io/grpc/xds/InternalSharedXdsClientPoolProvider.java
1
/*
2
 * Copyright 2022 The gRPC Authors
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package io.grpc.xds;
18

19
import io.grpc.Internal;
20
import io.grpc.MetricRecorder;
21
import io.grpc.internal.ObjectPool;
22
import io.grpc.xds.client.XdsClient;
23
import io.grpc.xds.client.XdsInitializationException;
24
import java.util.Map;
25

26
/**
27
 * Accessor for global factory for managing XdsClient instance.
28
 */
29
@Internal
30
public final class InternalSharedXdsClientPoolProvider {
31
  // Prevent instantiation
32
  private InternalSharedXdsClientPoolProvider() {}
33

34
  public static void setDefaultProviderBootstrapOverride(Map<String, ?> bootstrap) {
35
    SharedXdsClientPoolProvider.getDefaultProvider().setBootstrapOverride(bootstrap);
×
36
  }
×
37

38
  public static ObjectPool<XdsClient> getOrCreate(String target)
39
      throws XdsInitializationException {
40
    return getOrCreate(target, new MetricRecorder() {});
×
41
  }
42

43
  public static ObjectPool<XdsClient> getOrCreate(String target, MetricRecorder metricRecorder)
44
      throws XdsInitializationException {
45
    return SharedXdsClientPoolProvider.getDefaultProvider().getOrCreate(target, metricRecorder);
×
46
  }
47
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc