@@ -59,8 +59,8 @@ public final class AdService {
59
59
private HealthStatusManager healthMgr ;
60
60
61
61
private static final AdService service = new AdService ();
62
- private static final Tracer tracer = GlobalOpenTelemetry .getTracer ("adservice " );
63
- private static final Meter meter = GlobalOpenTelemetry .getMeter ("adservice " );
62
+ private static final Tracer tracer = GlobalOpenTelemetry .getTracer ("ad " );
63
+ private static final Meter meter = GlobalOpenTelemetry .getMeter ("ad " );
64
64
65
65
private static final LongCounter adRequestsCounter =
66
66
meter
@@ -80,7 +80,7 @@ private void start() throws IOException {
80
80
.orElseThrow (
81
81
() ->
82
82
new IllegalStateException (
83
- "environment vars: AD_SERVICE_PORT must not be null" )));
83
+ "environment vars: AD_PORT must not be null" )));
84
84
healthMgr = new HealthStatusManager ();
85
85
86
86
// Create a flagd instance with OpenTelemetry
@@ -132,9 +132,9 @@ private enum AdResponseType {
132
132
133
133
private static class AdServiceImpl extends oteldemo .AdServiceGrpc .AdServiceImplBase {
134
134
135
- private static final String ADSERVICE_FAILURE = "adServiceFailure " ;
136
- private static final String ADSERVICE_MANUAL_GC_FEATURE_FLAG = "adServiceManualGc " ;
137
- private static final String ADSERVICE_HIGH_CPU_FEATURE_FLAG = "adServiceHighCpu " ;
135
+ private static final String AD_FAILURE = "adFailure " ;
136
+ private static final String AD_MANUAL_GC_FEATURE_FLAG = "adManualGc " ;
137
+ private static final String AD_HIGH_CPU_FEATURE_FLAG = "adHighCpu " ;
138
138
private static final Client ffClient = OpenFeatureAPI .getInstance ().getClient ();
139
139
140
140
private AdServiceImpl () {}
@@ -169,7 +169,7 @@ public void getAds(AdRequest req, StreamObserver<AdResponse> responseObserver) {
169
169
}
170
170
171
171
CPULoad cpuload = CPULoad .getInstance ();
172
- cpuload .execute (ffClient .getBooleanValue (ADSERVICE_HIGH_CPU_FEATURE_FLAG , false , evaluationContext ));
172
+ cpuload .execute (ffClient .getBooleanValue (AD_HIGH_CPU_FEATURE_FLAG , false , evaluationContext ));
173
173
174
174
span .setAttribute ("app.ads.contextKeys" , req .getContextKeysList ().toString ());
175
175
span .setAttribute ("app.ads.contextKeys.count" , req .getContextKeysCount ());
@@ -202,12 +202,12 @@ public void getAds(AdRequest req, StreamObserver<AdResponse> responseObserver) {
202
202
adRequestTypeKey , adRequestType .name (), adResponseTypeKey , adResponseType .name ()));
203
203
204
204
// Throw 1/10 of the time to simulate a failure when the feature flag is enabled
205
- if (ffClient .getBooleanValue (ADSERVICE_FAILURE , false , evaluationContext ) && random .nextInt (10 ) == 0 ) {
205
+ if (ffClient .getBooleanValue (AD_FAILURE , false , evaluationContext ) && random .nextInt (10 ) == 0 ) {
206
206
throw new StatusRuntimeException (Status .UNAVAILABLE );
207
207
}
208
208
209
- if (ffClient .getBooleanValue (ADSERVICE_MANUAL_GC_FEATURE_FLAG , false , evaluationContext )) {
210
- logger .warn ("Feature Flag " + ADSERVICE_MANUAL_GC_FEATURE_FLAG + " enabled, performing a manual gc now" );
209
+ if (ffClient .getBooleanValue (AD_MANUAL_GC_FEATURE_FLAG , false , evaluationContext )) {
210
+ logger .warn ("Feature Flag " + AD_MANUAL_GC_FEATURE_FLAG + " enabled, performing a manual gc now" );
211
211
GarbageCollectionTrigger gct = new GarbageCollectionTrigger ();
212
212
gct .doExecute ();
213
213
}
0 commit comments