Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ require('werelogs').stderrUtils.catchAndTimestampStderr(
require('cluster').isPrimary ? 1 : null,
);

// Initialize OpenTelemetry SDK before everything else
require('./lib/otel.js');

require('./lib/server.js')();
74 changes: 74 additions & 0 deletions lib/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const parseCopySource = require('./apiUtils/object/parseCopySource');
const { tagConditionKeyAuth } = require('./apiUtils/authorization/tagConditionKeys');
const { isRequesterASessionUser } = require('./apiUtils/authorization/permissionChecks');
const checkHttpHeadersSize = require('./apiUtils/object/checkHttpHeadersSize');
const { instrumentApiMethod } = require('../instrumentation/simple');
const constants = require('../../constants');
const { config } = require('../Config.js');
const { validateMethodChecksumNoChunking } = require('./apiUtils/integrity/validateChecksums');
Expand Down Expand Up @@ -493,4 +494,77 @@ const api = {
handleAuthorizationResults,
};

// Wrap all S3 API handlers with OTEL instrumentation spans
api.bucketDelete = instrumentApiMethod(bucketDelete, 'bucketDelete');
api.bucketDeleteCors = instrumentApiMethod(bucketDeleteCors, 'bucketDeleteCors');
api.bucketDeleteEncryption = instrumentApiMethod(bucketDeleteEncryption, 'bucketDeleteEncryption');
api.bucketDeleteWebsite = instrumentApiMethod(bucketDeleteWebsite, 'bucketDeleteWebsite');
api.bucketDeleteLifecycle = instrumentApiMethod(bucketDeleteLifecycle, 'bucketDeleteLifecycle');
api.bucketDeletePolicy = instrumentApiMethod(bucketDeletePolicy, 'bucketDeletePolicy');
api.bucketDeleteQuota = instrumentApiMethod(bucketDeleteQuota, 'bucketDeleteQuota');
api.bucketDeleteRateLimit = instrumentApiMethod(bucketDeleteRateLimit, 'bucketDeleteRateLimit');
api.bucketGet = instrumentApiMethod(bucketGet, 'bucketGet');
api.bucketGetACL = instrumentApiMethod(bucketGetACL, 'bucketGetACL');
api.bucketGetCors = instrumentApiMethod(bucketGetCors, 'bucketGetCors');
api.bucketGetVersioning = instrumentApiMethod(bucketGetVersioning, 'bucketGetVersioning');
api.bucketGetWebsite = instrumentApiMethod(bucketGetWebsite, 'bucketGetWebsite');
api.bucketGetLocation = instrumentApiMethod(bucketGetLocation, 'bucketGetLocation');
api.bucketGetLifecycle = instrumentApiMethod(bucketGetLifecycle, 'bucketGetLifecycle');
api.bucketGetNotification = instrumentApiMethod(bucketGetNotification, 'bucketGetNotification');
api.bucketGetObjectLock = instrumentApiMethod(bucketGetObjectLock, 'bucketGetObjectLock');
api.bucketGetPolicy = instrumentApiMethod(bucketGetPolicy, 'bucketGetPolicy');
api.bucketGetQuota = instrumentApiMethod(bucketGetQuota, 'bucketGetQuota');
api.bucketGetEncryption = instrumentApiMethod(bucketGetEncryption, 'bucketGetEncryption');
api.bucketGetRateLimit = instrumentApiMethod(bucketGetRateLimit, 'bucketGetRateLimit');
api.bucketHead = instrumentApiMethod(bucketHead, 'bucketHead');
api.bucketPut = instrumentApiMethod(bucketPut, 'bucketPut');
api.bucketPutACL = instrumentApiMethod(bucketPutACL, 'bucketPutACL');
api.bucketPutCors = instrumentApiMethod(bucketPutCors, 'bucketPutCors');
api.bucketPutVersioning = instrumentApiMethod(bucketPutVersioning, 'bucketPutVersioning');
api.bucketPutTagging = instrumentApiMethod(bucketPutTagging, 'bucketPutTagging');
api.bucketDeleteTagging = instrumentApiMethod(bucketDeleteTagging, 'bucketDeleteTagging');
api.bucketGetTagging = instrumentApiMethod(bucketGetTagging, 'bucketGetTagging');
api.bucketPutWebsite = instrumentApiMethod(bucketPutWebsite, 'bucketPutWebsite');
api.bucketPutReplication = instrumentApiMethod(bucketPutReplication, 'bucketPutReplication');
api.bucketPutLifecycle = instrumentApiMethod(bucketPutLifecycle, 'bucketPutLifecycle');
api.bucketPutNotification = instrumentApiMethod(bucketPutNotification, 'bucketPutNotification');
api.bucketPutEncryption = instrumentApiMethod(bucketPutEncryption, 'bucketPutEncryption');
api.bucketPutPolicy = instrumentApiMethod(bucketPutPolicy, 'bucketPutPolicy');
api.bucketPutObjectLock = instrumentApiMethod(bucketPutObjectLock, 'bucketPutObjectLock');
api.bucketUpdateQuota = instrumentApiMethod(bucketUpdateQuota, 'bucketUpdateQuota');
api.bucketPutRateLimit = instrumentApiMethod(bucketPutRateLimit, 'bucketPutRateLimit');
api.bucketGetReplication = instrumentApiMethod(bucketGetReplication, 'bucketGetReplication');
api.bucketDeleteReplication = instrumentApiMethod(bucketDeleteReplication, 'bucketDeleteReplication');
api.bucketGetLogging = instrumentApiMethod(bucketGetLogging, 'bucketGetLogging');
api.bucketPutLogging = instrumentApiMethod(bucketPutLogging, 'bucketPutLogging');
api.corsPreflight = instrumentApiMethod(corsPreflight, 'corsPreflight');
api.completeMultipartUpload = instrumentApiMethod(completeMultipartUpload, 'completeMultipartUpload');
api.initiateMultipartUpload = instrumentApiMethod(initiateMultipartUpload, 'initiateMultipartUpload');
api.listMultipartUploads = instrumentApiMethod(listMultipartUploads, 'listMultipartUploads');
api.listParts = instrumentApiMethod(listParts, 'listParts');
api.metadataSearch = instrumentApiMethod(metadataSearch, 'metadataSearch');
api.multiObjectDelete = instrumentApiMethod(multiObjectDelete, 'multiObjectDelete');
api.multipartDelete = instrumentApiMethod(multipartDelete, 'multipartDelete');
api.objectCopy = instrumentApiMethod(objectCopy, 'objectCopy');
api.objectDelete = instrumentApiMethod(objectDelete, 'objectDelete');
api.objectDeleteTagging = instrumentApiMethod(objectDeleteTagging, 'objectDeleteTagging');
api.objectGet = instrumentApiMethod(objectGet, 'objectGet');
api.objectGetACL = instrumentApiMethod(objectGetACL, 'objectGetACL');
api.objectGetAttributes = instrumentApiMethod(objectGetAttributes, 'objectGetAttributes');
api.objectGetLegalHold = instrumentApiMethod(objectGetLegalHold, 'objectGetLegalHold');
api.objectGetRetention = instrumentApiMethod(objectGetRetention, 'objectGetRetention');
api.objectGetTagging = instrumentApiMethod(objectGetTagging, 'objectGetTagging');
api.objectHead = instrumentApiMethod(objectHead, 'objectHead');
api.objectPut = instrumentApiMethod(objectPut, 'objectPut');
api.objectPutACL = instrumentApiMethod(objectPutACL, 'objectPutACL');
api.objectPutLegalHold = instrumentApiMethod(objectPutLegalHold, 'objectPutLegalHold');
api.objectPutTagging = instrumentApiMethod(objectPutTagging, 'objectPutTagging');
api.objectPutPart = instrumentApiMethod(objectPutPart, 'objectPutPart');
api.objectPutCopyPart = instrumentApiMethod(objectPutCopyPart, 'objectPutCopyPart');
api.objectPutRetention = instrumentApiMethod(objectPutRetention, 'objectPutRetention');
api.objectRestore = instrumentApiMethod(objectRestore, 'objectRestore');
api.serviceGet = instrumentApiMethod(serviceGet, 'serviceGet');
api.websiteGet = instrumentApiMethod(website, 'websiteGet');
api.websiteHead = instrumentApiMethod(website, 'websiteHead');

module.exports = api;
Loading
Loading