Skip to content

Commit 9c93a1d

Browse files
committed
feat: instrument all S3 API handlers with OTEL spans
Wrap all 70+ S3 API handler methods with instrumentApiMethod() from the Proxy-based instrumentation module. Each handler gets a dedicated span with low-cardinality name and operation type attributes when ENABLE_OTEL=true; zero overhead when disabled. Issue: CLDSRV-884
1 parent 4b6296a commit 9c93a1d

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

lib/api/api.js

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ const parseCopySource = require('./apiUtils/object/parseCopySource');
8080
const { tagConditionKeyAuth } = require('./apiUtils/authorization/tagConditionKeys');
8181
const { isRequesterASessionUser } = require('./apiUtils/authorization/permissionChecks');
8282
const checkHttpHeadersSize = require('./apiUtils/object/checkHttpHeadersSize');
83+
const { instrumentApiMethod } = require('../instrumentation/simple');
8384
const constants = require('../../constants');
8485
const { config } = require('../Config.js');
8586
const { validateMethodChecksumNoChunking } = require('./apiUtils/integrity/validateChecksums');
@@ -493,4 +494,77 @@ const api = {
493494
handleAuthorizationResults,
494495
};
495496

497+
// Wrap all S3 API handlers with OTEL instrumentation spans
498+
api.bucketDelete = instrumentApiMethod(bucketDelete, 'bucketDelete');
499+
api.bucketDeleteCors = instrumentApiMethod(bucketDeleteCors, 'bucketDeleteCors');
500+
api.bucketDeleteEncryption = instrumentApiMethod(bucketDeleteEncryption, 'bucketDeleteEncryption');
501+
api.bucketDeleteWebsite = instrumentApiMethod(bucketDeleteWebsite, 'bucketDeleteWebsite');
502+
api.bucketDeleteLifecycle = instrumentApiMethod(bucketDeleteLifecycle, 'bucketDeleteLifecycle');
503+
api.bucketDeletePolicy = instrumentApiMethod(bucketDeletePolicy, 'bucketDeletePolicy');
504+
api.bucketDeleteQuota = instrumentApiMethod(bucketDeleteQuota, 'bucketDeleteQuota');
505+
api.bucketDeleteRateLimit = instrumentApiMethod(bucketDeleteRateLimit, 'bucketDeleteRateLimit');
506+
api.bucketGet = instrumentApiMethod(bucketGet, 'bucketGet');
507+
api.bucketGetACL = instrumentApiMethod(bucketGetACL, 'bucketGetACL');
508+
api.bucketGetCors = instrumentApiMethod(bucketGetCors, 'bucketGetCors');
509+
api.bucketGetVersioning = instrumentApiMethod(bucketGetVersioning, 'bucketGetVersioning');
510+
api.bucketGetWebsite = instrumentApiMethod(bucketGetWebsite, 'bucketGetWebsite');
511+
api.bucketGetLocation = instrumentApiMethod(bucketGetLocation, 'bucketGetLocation');
512+
api.bucketGetLifecycle = instrumentApiMethod(bucketGetLifecycle, 'bucketGetLifecycle');
513+
api.bucketGetNotification = instrumentApiMethod(bucketGetNotification, 'bucketGetNotification');
514+
api.bucketGetObjectLock = instrumentApiMethod(bucketGetObjectLock, 'bucketGetObjectLock');
515+
api.bucketGetPolicy = instrumentApiMethod(bucketGetPolicy, 'bucketGetPolicy');
516+
api.bucketGetQuota = instrumentApiMethod(bucketGetQuota, 'bucketGetQuota');
517+
api.bucketGetEncryption = instrumentApiMethod(bucketGetEncryption, 'bucketGetEncryption');
518+
api.bucketGetRateLimit = instrumentApiMethod(bucketGetRateLimit, 'bucketGetRateLimit');
519+
api.bucketHead = instrumentApiMethod(bucketHead, 'bucketHead');
520+
api.bucketPut = instrumentApiMethod(bucketPut, 'bucketPut');
521+
api.bucketPutACL = instrumentApiMethod(bucketPutACL, 'bucketPutACL');
522+
api.bucketPutCors = instrumentApiMethod(bucketPutCors, 'bucketPutCors');
523+
api.bucketPutVersioning = instrumentApiMethod(bucketPutVersioning, 'bucketPutVersioning');
524+
api.bucketPutTagging = instrumentApiMethod(bucketPutTagging, 'bucketPutTagging');
525+
api.bucketDeleteTagging = instrumentApiMethod(bucketDeleteTagging, 'bucketDeleteTagging');
526+
api.bucketGetTagging = instrumentApiMethod(bucketGetTagging, 'bucketGetTagging');
527+
api.bucketPutWebsite = instrumentApiMethod(bucketPutWebsite, 'bucketPutWebsite');
528+
api.bucketPutReplication = instrumentApiMethod(bucketPutReplication, 'bucketPutReplication');
529+
api.bucketPutLifecycle = instrumentApiMethod(bucketPutLifecycle, 'bucketPutLifecycle');
530+
api.bucketPutNotification = instrumentApiMethod(bucketPutNotification, 'bucketPutNotification');
531+
api.bucketPutEncryption = instrumentApiMethod(bucketPutEncryption, 'bucketPutEncryption');
532+
api.bucketPutPolicy = instrumentApiMethod(bucketPutPolicy, 'bucketPutPolicy');
533+
api.bucketPutObjectLock = instrumentApiMethod(bucketPutObjectLock, 'bucketPutObjectLock');
534+
api.bucketUpdateQuota = instrumentApiMethod(bucketUpdateQuota, 'bucketUpdateQuota');
535+
api.bucketPutRateLimit = instrumentApiMethod(bucketPutRateLimit, 'bucketPutRateLimit');
536+
api.bucketGetReplication = instrumentApiMethod(bucketGetReplication, 'bucketGetReplication');
537+
api.bucketDeleteReplication = instrumentApiMethod(bucketDeleteReplication, 'bucketDeleteReplication');
538+
api.bucketGetLogging = instrumentApiMethod(bucketGetLogging, 'bucketGetLogging');
539+
api.bucketPutLogging = instrumentApiMethod(bucketPutLogging, 'bucketPutLogging');
540+
api.corsPreflight = instrumentApiMethod(corsPreflight, 'corsPreflight');
541+
api.completeMultipartUpload = instrumentApiMethod(completeMultipartUpload, 'completeMultipartUpload');
542+
api.initiateMultipartUpload = instrumentApiMethod(initiateMultipartUpload, 'initiateMultipartUpload');
543+
api.listMultipartUploads = instrumentApiMethod(listMultipartUploads, 'listMultipartUploads');
544+
api.listParts = instrumentApiMethod(listParts, 'listParts');
545+
api.metadataSearch = instrumentApiMethod(metadataSearch, 'metadataSearch');
546+
api.multiObjectDelete = instrumentApiMethod(multiObjectDelete, 'multiObjectDelete');
547+
api.multipartDelete = instrumentApiMethod(multipartDelete, 'multipartDelete');
548+
api.objectCopy = instrumentApiMethod(objectCopy, 'objectCopy');
549+
api.objectDelete = instrumentApiMethod(objectDelete, 'objectDelete');
550+
api.objectDeleteTagging = instrumentApiMethod(objectDeleteTagging, 'objectDeleteTagging');
551+
api.objectGet = instrumentApiMethod(objectGet, 'objectGet');
552+
api.objectGetACL = instrumentApiMethod(objectGetACL, 'objectGetACL');
553+
api.objectGetAttributes = instrumentApiMethod(objectGetAttributes, 'objectGetAttributes');
554+
api.objectGetLegalHold = instrumentApiMethod(objectGetLegalHold, 'objectGetLegalHold');
555+
api.objectGetRetention = instrumentApiMethod(objectGetRetention, 'objectGetRetention');
556+
api.objectGetTagging = instrumentApiMethod(objectGetTagging, 'objectGetTagging');
557+
api.objectHead = instrumentApiMethod(objectHead, 'objectHead');
558+
api.objectPut = instrumentApiMethod(objectPut, 'objectPut');
559+
api.objectPutACL = instrumentApiMethod(objectPutACL, 'objectPutACL');
560+
api.objectPutLegalHold = instrumentApiMethod(objectPutLegalHold, 'objectPutLegalHold');
561+
api.objectPutTagging = instrumentApiMethod(objectPutTagging, 'objectPutTagging');
562+
api.objectPutPart = instrumentApiMethod(objectPutPart, 'objectPutPart');
563+
api.objectPutCopyPart = instrumentApiMethod(objectPutCopyPart, 'objectPutCopyPart');
564+
api.objectPutRetention = instrumentApiMethod(objectPutRetention, 'objectPutRetention');
565+
api.objectRestore = instrumentApiMethod(objectRestore, 'objectRestore');
566+
api.serviceGet = instrumentApiMethod(serviceGet, 'serviceGet');
567+
api.websiteGet = instrumentApiMethod(website, 'websiteGet');
568+
api.websiteHead = instrumentApiMethod(website, 'websiteHead');
569+
496570
module.exports = api;

0 commit comments

Comments
 (0)