-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
244 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
yarn-project/telemetry-client/src/aztec_resource_detector.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { type DetectorSync, type IResource, Resource } from '@opentelemetry/resources'; | ||
|
||
import { NETWORK_NAME } from './attributes.js'; | ||
import { getConfigEnvVars } from './config.js'; | ||
|
||
/** | ||
* Detector for custom Aztec attributes | ||
*/ | ||
class AztecDetector implements DetectorSync { | ||
detect(): IResource { | ||
const config = getConfigEnvVars(); | ||
|
||
return new Resource({ | ||
[NETWORK_NAME]: config.networkName, | ||
}); | ||
} | ||
} | ||
|
||
export const aztecDetector = new AztecDetector(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { type ConfigMappingsType, getConfigFromMappings } from '@aztec/foundation/config'; | ||
|
||
export interface TelemetryClientConfig { | ||
collectorBaseUrl?: URL; | ||
serviceName: string; | ||
networkName: string; | ||
} | ||
|
||
export const telemetryClientConfigMappings: ConfigMappingsType<TelemetryClientConfig> = { | ||
collectorBaseUrl: { | ||
env: 'OTEL_EXPORTER_OTLP_ENDPOINT', | ||
description: 'The URL of the telemetry collector', | ||
parseEnv: (val: string) => new URL(val), | ||
}, | ||
serviceName: { | ||
env: 'OTEL_SERVICE_NAME', | ||
description: 'The URL of the telemetry collector', | ||
default: 'aztec', | ||
}, | ||
networkName: { | ||
env: 'NETWORK_NAME', | ||
description: 'The network ID of the telemetry service', | ||
default: 'local', | ||
}, | ||
}; | ||
|
||
export function getConfigEnvVars(): TelemetryClientConfig { | ||
return getConfigFromMappings<TelemetryClientConfig>(telemetryClientConfigMappings); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.