Adobe Observability
Overview
Set up comprehensive observability for Adobe API integrations covering four pillars: metrics (Prometheus), traces (OpenTelemetry), logs (structured JSON), and alerts. Each Adobe API has different latency profiles requiring specific monitoring.
Prerequisites
- Prometheus or compatible metrics backend
- OpenTelemetry SDK (
@opentelemetry/api)
- Grafana or similar dashboarding tool
- AlertManager or PagerDuty for alerts
Instructions
Step 1: Define Key Metrics by API
| Metric |
Type |
Labels |
Description |
adobe_ims_token_requests_total |
Counter |
status |
Token generation attempts |
adobe_api_requests_total |
Counter |
api,operation,status |
API calls by type |
adobe_api_duration_seconds |
Histogram |
api,operation |
Latency per operation |
adobe_api_errors_total |
Counter |
api,error_code |
Errors by code (401,403,429,500) |
adobe_job_poll_count |
Histogram |
api |
Polls before async job completes |
adobe_rate_limit_retries_total |
Counter |
api |
429 retries |
adobe_pdf_transactions_used |
Gauge |
— |
Monthly PDF Services usage |
Step 2: Instrumented Adobe Client
import { Counter, Histogram, Gauge, Registry } from 'prom-client';
const registry = new Registry();
const apiRequests = new Counter({
name: 'adobe_api_requests_total',
help: 'Total Adobe API requests',
labelNames: ['api', 'operation', 'status'] as const,
registers: [registry],
});
const apiDuration = new Histogram({
name: 'adobe_api_duration_seconds',
help: 'Adobe API request duration in seconds',
labelNames: ['api', 'operation'] as const,
buckets: [0.5, 1, 2, 5, 10, 20, 30, 60], // Adobe APIs are slow
registers: [registry],
});
const apiErrors = new Counter({
name: 'adobe_api_errors_total',
help: 'Adobe API errors by code',
labelNames: ['api', 'error_code'] as const,
registers: [registry],
});
export async function instrumentedAdobeCall<T>(
api: string,
operation: string,
fn: () => Promise<T>
): Promise<T> {
const timer = apiDuration.startTimer({ api, operation });
try {
const result = await fn();
apiRequests.inc({ api, operation, status: 'success' });
return result;
} catch (error: any) {
const errorCode = error.status || error.httpStatus || 'unknown';
apiRequests.inc({ api, operation, status: 'error' });
apiErrors.inc({ api, error_code: String(errorCode) });
throw error;
} finally {
timer();
}
}
// Usage
const image = await instrumentedAdobeCall('firefly', 'generate', () =>
generateImage({ prompt: 'sunset landscape' })
);
Step 3: OpenTelemetry Distributed Tracing
import { trace, SpanStatusCode } from '@opentelemetry/api';
const tracer = trace.getTracer('adobe-integration');
export async function tracedAdobeCall<T>(
api: string,
operation: string,
fn: () => Promise<T>
): Promise<T> {
return tracer.startActiveSpan(`adobe.${api}.${operation}`, async (span) => {
span.setAttribute('adobe.api', api);
span.setAttribute('adobe.operation', operation);
span.setAttribute('adobe.client_id', process.env.ADOBE_CLIENT_ID!);
try {
const result = await fn();
span.setStatus({ code: SpanStatusCode.OK });
return result;
} catch (error: any) {
span.setStatus({ code: SpanStatusCode.ERROR, message: error.message });
span.setAttribute('adobe.error_code', error.status || 'unknown');
span.recordException(error);
throw error;
} finally {
span.end();
}
});
}
Step 4: Structured Logging
import pino from 'pino';
const logger = pino({
name: 'adobe',
level: process.env.LOG_LEVEL || 'info',
redact: ['clientSecret', 'accessToken', 'req.headers.authorization'],
});
export function logAdobeOperation(entry: {
api: string;
operation: string;
durationMs: number;
status: 'success' | 'error';
httpStatus?: number;
jobId?: string;
error?: string;
}) {
if (entry.status === 'error') {
logger.error(entry, `Adobe ${entry.api}.${entry.operation} failed`);
} else {
logger.info(entry, `Adobe ${entry.api}.${entry.operation} completed`);
}
}
Step 5: Alert Rules
# prometheus/adobe-alerts.yml
groups:
- name: adobe_alerts
rules:
- alert: AdobeAuthFailure
expr: increase(adobe_api_errors_total{error_code="401"}[5m]) > 0
for: 2m
labels:
severity: critical
annotations:
summary: "Adobe authentication failure — credentials may be expired or revoked"
- alert: AdobeRateLimited
expr: rate(adobe_api_errors_total{error_code="429"}[5m]) > 0.1
for: 5m
labels:
severity: warning
annotations:
summary: "Adobe API rate limited — reduce throughput or upgrade tier"
- alert: AdobeHighLatency
expr: |
histogram_quantile(0.95,
rate(adobe_api_duration_seconds_bucket{api="firefly"}[5m])
) > 30
for: 10m
labels:
severity: warning
annotations:
summary: "Adobe Firefly P95 latency > 30s"
- alert: AdobeApiDown
expr: |
rate(adobe_api_errors_total{error_code=~"5.."}[5m]) /
rate(adobe_api_requests_total[5m]) > 0.1
for: 5m
labels:
severity: critical
annotations:
summary: "Adobe API server error rate > 10%"
- alert: AdobePdfQuotaLow
expr: adobe_pdf_transactions_used > 450
labels:
severity: warning
annotations:
summary: "PDF Services: < 50 free tier transactions remaining"
Metrics Endpoint
app.get('/metrics', async (req, res) => {
res.set('Content-Type', registry.contentType);
res.send(await registry.metrics());
});
Output
- Prometheus metrics for all Adobe API calls (latency, errors, rate limits)
- OpenTelemetry traces with Adobe-specific span attributes
- Structured JSON logging with credential redaction
- Alert rules for auth failures, rate limiting, latency, and quota
Error Handling
| Issue |
Cause |
Solution |
| High cardinality metrics |
Too many label values |
Use fixed set of operation names |
| Alert storms |
Thresholds too sensitive |
Increase for duration |
| Missing traces |
No OTel propagation |
Verify context propagation setup |
| Redacted data in logs |
Over-aggressive redaction |
Whitelist safe fields |
Resources
Next Steps
For incident response, see adobe-incident-runbook.
1---2name: adobe-observability3description: |4 Set up comprehensive observability for Adobe API integrations with5 Prometheus metrics, OpenTelemetry traces, structured logging, and6 alert rules covering Firefly, PDF Services, and Photoshop APIs.7 Trigger with phrases like "adobe monitoring", "adobe metrics",8 "adobe observability", "monitor adobe", "adobe alerts", "adobe tracing".9allowed-tools: Read, Write, Edit10version: 1.0.011license: MIT12author: Jeremy Longshore <jeremy@intentsolutions.io>13tags: [saas, design, adobe]14compatible-with: claude-code15---1617# Adobe Observability1819## Overview2021Set up comprehensive observability for Adobe API integrations covering four pillars: metrics (Prometheus), traces (OpenTelemetry), logs (structured JSON), and alerts. Each Adobe API has different latency profiles requiring specific monitoring.2223## Prerequisites2425- Prometheus or compatible metrics backend26- OpenTelemetry SDK (`@opentelemetry/api`)27- Grafana or similar dashboarding tool28- AlertManager or PagerDuty for alerts2930## Instructions3132### Step 1: Define Key Metrics by API3334| Metric | Type | Labels | Description |35|--------|------|--------|-------------|36| `adobe_ims_token_requests_total` | Counter | `status` | Token generation attempts |37| `adobe_api_requests_total` | Counter | `api,operation,status` | API calls by type |38| `adobe_api_duration_seconds` | Histogram | `api,operation` | Latency per operation |39| `adobe_api_errors_total` | Counter | `api,error_code` | Errors by code (401,403,429,500) |40| `adobe_job_poll_count` | Histogram | `api` | Polls before async job completes |41| `adobe_rate_limit_retries_total` | Counter | `api` | 429 retries |42| `adobe_pdf_transactions_used` | Gauge | — | Monthly PDF Services usage |4344### Step 2: Instrumented Adobe Client4546```typescript47import { Counter, Histogram, Gauge, Registry } from 'prom-client';4849const registry = new Registry();5051const apiRequests = new Counter({52 name: 'adobe_api_requests_total',53 help: 'Total Adobe API requests',54 labelNames: ['api', 'operation', 'status'] as const,55 registers: [registry],56});5758const apiDuration = new Histogram({59 name: 'adobe_api_duration_seconds',60 help: 'Adobe API request duration in seconds',61 labelNames: ['api', 'operation'] as const,62 buckets: [0.5, 1, 2, 5, 10, 20, 30, 60], // Adobe APIs are slow63 registers: [registry],64});6566const apiErrors = new Counter({67 name: 'adobe_api_errors_total',68 help: 'Adobe API errors by code',69 labelNames: ['api', 'error_code'] as const,70 registers: [registry],71});7273export async function instrumentedAdobeCall<T>(74 api: string,75 operation: string,76 fn: () => Promise<T>77): Promise<T> {78 const timer = apiDuration.startTimer({ api, operation });79 try {80 const result = await fn();81 apiRequests.inc({ api, operation, status: 'success' });82 return result;83 } catch (error: any) {84 const errorCode = error.status || error.httpStatus || 'unknown';85 apiRequests.inc({ api, operation, status: 'error' });86 apiErrors.inc({ api, error_code: String(errorCode) });87 throw error;88 } finally {89 timer();90 }91}9293// Usage94const image = await instrumentedAdobeCall('firefly', 'generate', () =>95 generateImage({ prompt: 'sunset landscape' })96);97```9899### Step 3: OpenTelemetry Distributed Tracing100101```typescript102import { trace, SpanStatusCode } from '@opentelemetry/api';103104const tracer = trace.getTracer('adobe-integration');105106export async function tracedAdobeCall<T>(107 api: string,108 operation: string,109 fn: () => Promise<T>110): Promise<T> {111 return tracer.startActiveSpan(`adobe.${api}.${operation}`, async (span) => {112 span.setAttribute('adobe.api', api);113 span.setAttribute('adobe.operation', operation);114 span.setAttribute('adobe.client_id', process.env.ADOBE_CLIENT_ID!);115116 try {117 const result = await fn();118 span.setStatus({ code: SpanStatusCode.OK });119 return result;120 } catch (error: any) {121 span.setStatus({ code: SpanStatusCode.ERROR, message: error.message });122 span.setAttribute('adobe.error_code', error.status || 'unknown');123 span.recordException(error);124 throw error;125 } finally {126 span.end();127 }128 });129}130```131132### Step 4: Structured Logging133134```typescript135import pino from 'pino';136137const logger = pino({138 name: 'adobe',139 level: process.env.LOG_LEVEL || 'info',140 redact: ['clientSecret', 'accessToken', 'req.headers.authorization'],141});142143export function logAdobeOperation(entry: {144 api: string;145 operation: string;146 durationMs: number;147 status: 'success' | 'error';148 httpStatus?: number;149 jobId?: string;150 error?: string;151}) {152 if (entry.status === 'error') {153 logger.error(entry, `Adobe ${entry.api}.${entry.operation} failed`);154 } else {155 logger.info(entry, `Adobe ${entry.api}.${entry.operation} completed`);156 }157}158```159160### Step 5: Alert Rules161162```yaml163# prometheus/adobe-alerts.yml164groups:165 - name: adobe_alerts166 rules:167 - alert: AdobeAuthFailure168 expr: increase(adobe_api_errors_total{error_code="401"}[5m]) > 0169 for: 2m170 labels:171 severity: critical172 annotations:173 summary: "Adobe authentication failure — credentials may be expired or revoked"174175 - alert: AdobeRateLimited176 expr: rate(adobe_api_errors_total{error_code="429"}[5m]) > 0.1177 for: 5m178 labels:179 severity: warning180 annotations:181 summary: "Adobe API rate limited — reduce throughput or upgrade tier"182183 - alert: AdobeHighLatency184 expr: |185 histogram_quantile(0.95,186 rate(adobe_api_duration_seconds_bucket{api="firefly"}[5m])187 ) > 30188 for: 10m189 labels:190 severity: warning191 annotations:192 summary: "Adobe Firefly P95 latency > 30s"193194 - alert: AdobeApiDown195 expr: |196 rate(adobe_api_errors_total{error_code=~"5.."}[5m]) /197 rate(adobe_api_requests_total[5m]) > 0.1198 for: 5m199 labels:200 severity: critical201 annotations:202 summary: "Adobe API server error rate > 10%"203204 - alert: AdobePdfQuotaLow205 expr: adobe_pdf_transactions_used > 450206 labels:207 severity: warning208 annotations:209 summary: "PDF Services: < 50 free tier transactions remaining"210```211212### Metrics Endpoint213214```typescript215app.get('/metrics', async (req, res) => {216 res.set('Content-Type', registry.contentType);217 res.send(await registry.metrics());218});219```220221## Output222223- Prometheus metrics for all Adobe API calls (latency, errors, rate limits)224- OpenTelemetry traces with Adobe-specific span attributes225- Structured JSON logging with credential redaction226- Alert rules for auth failures, rate limiting, latency, and quota227228## Error Handling229230| Issue | Cause | Solution |231|-------|-------|----------|232| High cardinality metrics | Too many label values | Use fixed set of operation names |233| Alert storms | Thresholds too sensitive | Increase `for` duration |234| Missing traces | No OTel propagation | Verify context propagation setup |235| Redacted data in logs | Over-aggressive redaction | Whitelist safe fields |236237## Resources238239- [Prometheus Best Practices](https://prometheus.io/docs/practices/naming/)240- [OpenTelemetry Node.js](https://opentelemetry.io/docs/languages/js/)241- [Adobe Status Page](https://status.adobe.com)242243## Next Steps244245For incident response, see `adobe-incident-runbook`.246