Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/ffsshhttiikk/opencode-agents-skills --skill tracing명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
SOC 직업 분류 기준
| name | tracing |
| description | Distributed tracing implementation |
| license | MIT |
| compatibility | opencode |
| metadata | {"audience":"developer, devops-engineer, sre","category":"devops"} |
Trace
├── Span (Root)
│ ├── Span (Database)
│ │ └── Span (Connection Pool)
│ ├── Span (HTTP Call 1)
│ ├── Span (HTTP Call 2)
│ │ └── Span (Retry 1)
│ └── Span (Cache)
│
└── Context
├── Trace ID: abc123
└── Span ID: xyz789
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.jaeger.thrift import JaegerExporter
from opentelemetry.instrumentation.flask import FlaskInstrumentor
from opentelemetry.instrumentation.requests import RequestsInstrumentor
# Initialize tracing
provider = TracerProvider()
processor = BatchSpanProcessor(
JaegerExporter(
agent_host_name="jaeger",
agent_port=6831,
)
)
provider.add_span_processor(processor)
trace.set_tracer_provider(provider)
# Instrument Flask
FlaskInstrumentor().instrument_app(app)
RequestsInstrumentor().instrument()
# Create custom spans
tracer = trace.get_tracer(__name__)
def process_order(order_id):
with tracer.start_as_current_span("process_order") as span:
span.set_attribute("order.id", order_id)
# Database call
with tracer.start_as_current_span("db.save") as span:
span.set_attribute("db.system", "postgresql")
save_order(order_id)
# External API call
with tracer.start_as_current_span("http.payment") as span:
span.set_attribute("http.method", "POST")
span.set_attribute("http.url", "https://api.payment.com/charge")
call_payment_api(order_id)
apiVersion: jaegertracing.io/v1
kind: Jaeger
metadata:
name: jaeger
spec:
strategy: all-in-one
collector:
maxTraces: 100000
resources:
limits:
cpu: 500m
memory: 512Mi
query:
options:
basePath: /jaeger
storage:
type: elasticsearch
elasticsearch:
nodeCount: 3
redundancyPolicy: SingleRedundancy
// Spring Boot with Zipkin
@SpringBootApplication
@EnableZipkinTracer
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
// Service discovery with Eureka
@Bean
public Brave brave() {
return Brave.Builder("my-service")
.spanReporter(zipkin)
.build();
}
@Bean
public Tracer tracer(Brave brave) {
return brave;
}
# Jaeger query
service = user-api
operation = /api/users
limit = 20
# Filter by tags
http.method = GET
http.status_code = 200
error = true
# Time range
start = 2024-01-15T10:00:00Z
end = 2024-01-15T10:30:00Z
# Manual context propagation
from opentelemetry import trace
def call_downstream_service(url, headers):
# Extract context from incoming request
ctx = trace.get_current_span().get_context()
# Inject context into headers
tracer = trace.get_tracer(__name__)
with tracer.start_as_current_span("call_downstream") as span:
# Add downstream span to trace
carrier = {}
trace.propagation.inject(span.get_context(), carrier)
# Make HTTP call with propagated context
response = requests.get(
url,
headers={**headers, **carrier}
)
return response
# Analyze traces for performance
class TraceAnalyzer:
def __init__(self, jaeger_client):
self.client = jaeger_client
def find_slow_traces(self, threshold_ms=1000):
return self.client.query(
service='api',
lookback='1h',
min_duration=threshold_ms * 1000 # microseconds
)
def analyze_bottlenecks(self, service):
spans = self.client.get_service_spans(service)
# Group by operation
by_operation = defaultdict(list)
for span in spans:
by_operation[span.operation_name].append(span)
# Calculate average duration per operation
results = {}
for op, spans in by_operation.items():
avg_duration = sum(s.duration for s in spans) / len(spans)
results[op] = avg_duration
return sorted(results.items(), key=lambda x: x[1], reverse=True)
def find_error_patterns(self):
return self.client.query(
service='api',
tag={: }
)