"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OBS_TAG_SUPERBLOCKS_ENV = exports.OBS_TAG_HTTP_HOST = exports.OBS_TAG_NET_PEER_IP = exports.OBS_TAG_HTTP_STATUS_CODE = exports.OBS_TAG_HTTP_ROUTE = exports.OBS_TAG_HTTP_URL = exports.OBS_TAG_HTTP_FLAVOR = exports.OBS_TAG_HTTP_METHOD = exports.OBS_TAG_HTTP_REQUEST_CONTENT_LENGTH = exports.OBS_TAG_HTTP_USER_AGENT = exports.OBS_TAG_HTTP_SCHEME = exports.OBS_TAG_DURATION = exports.OBS_TAG_RESPONSE_SIZE = exports.OBS_TAG_CACHE_REGION = exports.OBS_TAG_VIEW_MODE = exports.OBS_TAG_ERROR_PRIORITY = exports.OBS_TAG_ERROR_STACK = exports.OBS_TAG_ERROR_TYPE = exports.OBS_TAG_ERROR = exports.OBS_TAG_AGENT_URL = exports.OBS_TAG_AGENT_VERSION_EXTERNAL = exports.OBS_TAG_AGENT_VERSION = exports.OBS_TAG_AGENT_ID = exports.OBS_TAG_WORKER_ID = exports.OBS_TAG_CONTROLLER_ID = exports.OBS_TAG_CORRELATION_ID = exports.OBS_TAG_ENV = exports.OBS_TAG_PROFILE = exports.OBS_TAG_PROFILE_ID = exports.OBS_TAG_WIDGET_TYPE = exports.OBS_TAG_API_ID = exports.OBS_TAG_ENTITY_NAME = exports.OBS_TAG_ENTITY_ID = exports.OBS_TAG_ENTITY_TYPE = exports.OBS_TAG_INTEGRATION_ID = exports.OBS_TAG_PLUGIN_NAME = exports.OBS_TAG_PARENT_TYPE = exports.OBS_TAG_PARENT_NAME = exports.OBS_TAG_PARENT_ID = exports.OBS_TAG_RESOURCE_ACTION = exports.OBS_TAG_RESOURCE_NAME = exports.OBS_TAG_RESOURCE_ID = exports.OBS_TAG_RESOURCE_TYPE = exports.OBS_TAG_BILLING_PLAN = exports.OBS_TAG_USER_TYPE = exports.OBS_TAG_USER_EMAIL = exports.OBS_TAG_ORG_NAME = exports.OBS_TAG_ORG_ID = exports.OBS_TAG_FEATURE_GROUP = exports.OBS_TAG_REMOTE = void 0;
exports.toMetricLabels = exports.OBS_TAG_DD_ERROR_STACK = exports.OBS_TAG_DD_ERROR_TYPE = exports.OBS_TAG_DD_ERROR_MESSAGE = exports.OBS_SOCKET_STATUS_CODE = exports.OBS_TAG_COMMIT_ID = exports.OBS_TAG_BRANCH = exports.OBS_TAG_APPLICATION_ID = exports.OBS_TAG_SUPERBLOCKS_REGION = void 0;
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
// SUPERBLOCKS METADATA
exports.OBS_TAG_REMOTE = 'remote';
exports.OBS_TAG_FEATURE_GROUP = 'feature-group';
// SUPERBLOCKS ORGANZIATION
exports.OBS_TAG_ORG_ID = 'organization-id';
exports.OBS_TAG_ORG_NAME = 'organization-name';
exports.OBS_TAG_USER_EMAIL = 'user-email';
exports.OBS_TAG_USER_TYPE = 'user-type';
exports.OBS_TAG_BILLING_PLAN = 'billing-plan';
// SUPERBLOCKS RESOURCE
exports.OBS_TAG_RESOURCE_TYPE = 'resource-type';
exports.OBS_TAG_RESOURCE_ID = 'resource-id';
exports.OBS_TAG_RESOURCE_NAME = 'resource-name';
exports.OBS_TAG_RESOURCE_ACTION = 'resource-action';
exports.OBS_TAG_PARENT_ID = 'parent-id';
exports.OBS_TAG_PARENT_NAME = 'parent-name';
exports.OBS_TAG_PARENT_TYPE = 'parent-type';
exports.OBS_TAG_PLUGIN_NAME = 'plugin-name';
exports.OBS_TAG_INTEGRATION_ID = 'integration-id';
exports.OBS_TAG_ENTITY_TYPE = 'entity-type';
exports.OBS_TAG_ENTITY_ID = 'entity-id';
exports.OBS_TAG_ENTITY_NAME = 'entity-name';
exports.OBS_TAG_API_ID = 'api-id';
exports.OBS_TAG_WIDGET_TYPE = 'widget-type';
exports.OBS_TAG_PROFILE_ID = 'profile-id';
exports.OBS_TAG_PROFILE = 'profile';
// SUPERBLOCKS INFRA
exports.OBS_TAG_ENV = 'environment';
exports.OBS_TAG_CORRELATION_ID = 'correlation-id';
exports.OBS_TAG_CONTROLLER_ID = 'controller-id';
exports.OBS_TAG_WORKER_ID = 'worker-id';
exports.OBS_TAG_AGENT_ID = 'agent-id';
exports.OBS_TAG_AGENT_VERSION = 'agent-version';
exports.OBS_TAG_AGENT_VERSION_EXTERNAL = 'agent-version-external';
exports.OBS_TAG_AGENT_URL = 'agent-url';
// SUPERBLOCKS EXECUTION
exports.OBS_TAG_ERROR = 'error';
exports.OBS_TAG_ERROR_TYPE = 'error-type';
exports.OBS_TAG_ERROR_STACK = 'error-stack';
exports.OBS_TAG_ERROR_PRIORITY = 'error-priority';
exports.OBS_TAG_VIEW_MODE = 'view-mode';
exports.OBS_TAG_CACHE_REGION = 'cache-region';
// For the sole purposes of aggregating user api responses
exports.OBS_TAG_RESPONSE_SIZE = 'response-size';
exports.OBS_TAG_DURATION = 'duration';
// HTTP
exports.OBS_TAG_HTTP_SCHEME = semantic_conventions_1.SEMATTRS_HTTP_SCHEME;
exports.OBS_TAG_HTTP_USER_AGENT = semantic_conventions_1.SEMATTRS_HTTP_USER_AGENT;
exports.OBS_TAG_HTTP_REQUEST_CONTENT_LENGTH = semantic_conventions_1.SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH;
exports.OBS_TAG_HTTP_METHOD = semantic_conventions_1.SEMATTRS_HTTP_METHOD;
exports.OBS_TAG_HTTP_FLAVOR = semantic_conventions_1.SEMATTRS_HTTP_FLAVOR;
exports.OBS_TAG_HTTP_URL = semantic_conventions_1.SEMATTRS_HTTP_URL;
exports.OBS_TAG_HTTP_ROUTE = semantic_conventions_1.SEMATTRS_HTTP_ROUTE;
exports.OBS_TAG_HTTP_STATUS_CODE = semantic_conventions_1.SEMATTRS_HTTP_STATUS_CODE;
exports.OBS_TAG_NET_PEER_IP = semantic_conventions_1.SEMATTRS_NET_PEER_IP;
exports.OBS_TAG_HTTP_HOST = semantic_conventions_1.SEMATTRS_HTTP_HOST;
exports.OBS_TAG_SUPERBLOCKS_ENV = 'superblocks.environment';
exports.OBS_TAG_SUPERBLOCKS_REGION = 'superblocks.region';
// WS specific tags
exports.OBS_TAG_APPLICATION_ID = 'application-id';
exports.OBS_TAG_BRANCH = 'branch';
exports.OBS_TAG_COMMIT_ID = 'commit-id';
exports.OBS_SOCKET_STATUS_CODE = 'socket.status-code';
// Datadog specific tags
exports.OBS_TAG_DD_ERROR_MESSAGE = 'error.message';
exports.OBS_TAG_DD_ERROR_TYPE = 'error.type';
exports.OBS_TAG_DD_ERROR_STACK = 'error.stack';
// It is not valid to have a dash character in Prometheus label tames.
// However, we're already committed to the dash character in our observability
// product. Hence, we're just going to use this when adding metrics.
const toMetricLabels = (tags) => {
    const replace = /(\.|-)/g;
    if (Array.isArray(tags)) {
        return tags.map((tag) => tag.replace(replace, '_'));
    }
    Object.keys(tags).forEach((tag) => {
        if (tag.match(replace)) {
            tags[tag.replace(replace, '_')] = tags[tag];
            delete tags[tag];
        }
    });
    return tags;
};
exports.toMetricLabels = toMetricLabels;
//# sourceMappingURL=index.js.map