|
60 | 60 | */ |
61 | 61 | @AutoValue |
62 | 62 | public abstract class SubscriberSettings { |
63 | | - |
64 | | - private static final Framework FRAMEWORK = Framework.of("CLOUD_PUBSUB_SHIM"); |
65 | | - |
66 | 63 | // Required parameters. |
67 | 64 | /** |
68 | 65 | * The receiver which handles new messages sent by the Pub/Sub Lite system. Only one downcall from |
@@ -97,6 +94,11 @@ public abstract class SubscriberSettings { |
97 | 94 | /** A provider for credentials. */ |
98 | 95 | abstract CredentialsProvider credentialsProvider(); |
99 | 96 |
|
| 97 | + /** |
| 98 | + * A Framework tag for internal metrics. Please set this if integrating with a public framework! |
| 99 | + */ |
| 100 | + abstract Framework framework(); |
| 101 | + |
100 | 102 | /** |
101 | 103 | * A supplier for new SubscriberServiceClients. Should return a new client each time. If present, |
102 | 104 | * ignores CredentialsProvider. |
@@ -124,16 +126,15 @@ public abstract class SubscriberSettings { |
124 | 126 |
|
125 | 127 | public static Builder newBuilder() { |
126 | 128 | return new AutoValue_SubscriberSettings.Builder() |
| 129 | + .setFramework(Framework.of("CLOUD_PUBSUB_SHIM")) |
127 | 130 | .setPartitions(ImmutableList.of()) |
128 | 131 | .setCredentialsProvider( |
129 | 132 | SubscriberServiceSettings.defaultCredentialsProviderBuilder().build()); |
130 | 133 | } |
131 | 134 |
|
132 | 135 | @AutoValue.Builder |
133 | 136 | public abstract static class Builder { |
134 | | - |
135 | 137 | // Required parameters. |
136 | | - |
137 | 138 | /** |
138 | 139 | * The receiver which handles new messages sent by the Pub/Sub Lite system. Only one downcall |
139 | 140 | * from any connected partition will be outstanding at a time, and blocking in this receiver |
@@ -168,6 +169,11 @@ public abstract Builder setTransformer( |
168 | 169 | /** A provider for credentials. */ |
169 | 170 | public abstract Builder setCredentialsProvider(CredentialsProvider provider); |
170 | 171 |
|
| 172 | + /** |
| 173 | + * A Framework tag for internal metrics. Please set this if integrating with a public framework! |
| 174 | + */ |
| 175 | + public abstract Builder setFramework(Framework framework); |
| 176 | + |
171 | 177 | /** |
172 | 178 | * A supplier for new SubscriberServiceClients. Should return a new client each time. If |
173 | 179 | * present, ignores CredentialsProvider. |
@@ -206,10 +212,11 @@ private SubscriberServiceClient newSubscriberServiceClient(Partition partition) |
206 | 212 | try { |
207 | 213 | SubscriberServiceSettings.Builder settingsBuilder = |
208 | 214 | SubscriberServiceSettings.newBuilder().setCredentialsProvider(credentialsProvider()); |
209 | | - addDefaultMetadata( |
210 | | - PubsubContext.of(FRAMEWORK), |
211 | | - RoutingMetadata.of(subscriptionPath(), partition), |
212 | | - settingsBuilder); |
| 215 | + settingsBuilder = |
| 216 | + addDefaultMetadata( |
| 217 | + PubsubContext.of(framework()), |
| 218 | + RoutingMetadata.of(subscriptionPath(), partition), |
| 219 | + settingsBuilder); |
213 | 220 | return SubscriberServiceClient.create( |
214 | 221 | addDefaultSettings(subscriptionPath().location().region(), settingsBuilder)); |
215 | 222 | } catch (Throwable t) { |
|
0 commit comments