Skip to content

Commit 852f0a1

Browse files
authored
Allow customisation of service name (#1056)
Signed-off-by: Assem Hafez <assem.hafez@uber.com>
1 parent 3e48e07 commit 852f0a1

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Set these environment variables if you need to change their defaults
2121
| CADENCE_WEB_HOSTNAME | Host name to serve on | 0.0.0.0 |
2222
| CADENCE_ADMIN_SECURITY_TOKEN | Admin token for accessing admin methods | '' |
2323
| CADENCE_GRPC_TLS_CA_FILE | Path to root CA certificate file for enabling one-way TLS on gRPC connections | '' |
24+
| CADENCE_WEB_SERVICE_NAME | Name of the web service used as GRPC caller and OTEL resource name | cadence-web |
2425

2526
Note: To connect `cadence-web` to multiple clusters, you will need to add comma-delimted entries for `CADENCE_GRPC_PEERS`, `CADENCE_GRPC_SERVICES_NAMES` & `CADENCE_CLUSTERS_NAMES` for each cluster (each cluster values are grouped by their index within the Comma-delimited lists).
2627

src/utils/grpc/grpc-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class GRPCService {
122122
const headers = merge(
123123
{
124124
'rpc-service': this.requestConfig.serviceName,
125-
'rpc-caller': 'cadence-web',
125+
'rpc-caller': process.env.CADENCE_WEB_SERVICE_NAME || 'cadence-web',
126126
'rpc-encoding': 'proto',
127127
},
128128
this.requestConfig.metadata,

src/utils/otel/otel-register.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import { type OtelRegisterConfig } from './otel.types';
1111
export async function otelRegister(config?: OtelRegisterConfig) {
1212
const sdk = new NodeSDK({
1313
resource: resourceFromAttributes({
14-
[ATTR_SERVICE_NAME]: 'cadence-web',
14+
[ATTR_SERVICE_NAME]:
15+
process.env.CADENCE_WEB_SERVICE_NAME || 'cadence-web',
1516
}),
1617
textMapPropagator: new JaegerPropagator(),
1718
traceExporter: new OTLPTraceExporter(),

0 commit comments

Comments
 (0)