mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-22 02:37:44 +00:00
ffc2fadc20
## Description: ## Please complete the following: - [ ] I have added screenshots for all UI updates - [ ] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [ ] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors ## Please put your Discord username so you can be contacted if a bug or regression is found: <DISCORD USERNAME> Co-authored-by: evan <openfrontio@gmail.com>
28 lines
1.0 KiB
TypeScript
28 lines
1.0 KiB
TypeScript
import { resourceFromAttributes } from "@opentelemetry/resources";
|
|
import {
|
|
ATTR_SERVICE_NAME,
|
|
ATTR_SERVICE_VERSION,
|
|
} from "@opentelemetry/semantic-conventions";
|
|
import { getServerConfigFromServer } from "../core/configuration/ConfigLoader";
|
|
|
|
const config = getServerConfigFromServer();
|
|
|
|
export function getOtelResource() {
|
|
return resourceFromAttributes({
|
|
[ATTR_SERVICE_NAME]: "openfront",
|
|
[ATTR_SERVICE_VERSION]: "1.0.0",
|
|
"service.instance.id": process.env.HOSTNAME,
|
|
"openfront.environment": config.env(),
|
|
"openfront.host": process.env.HOST,
|
|
"openfront.domain": process.env.DOMAIN,
|
|
"openfront.subdomain": process.env.SUBDOMAIN,
|
|
"openfront.component": process.env.WORKER_ID
|
|
? "Worker " + process.env.WORKER_ID
|
|
: "Master",
|
|
// The comma-separated list tells OpenTelemetry which resource attributes
|
|
// should be converted to Loki labels
|
|
"loki.resource.labels":
|
|
"service.name,service.instance.id,openfront.environment,openfront.host,openfront.domain,openfront.subdomain,openfront.component",
|
|
});
|
|
}
|