|
Größe: 1884
Kommentar:
|
Größe: 5686
Kommentar:
|
| Gelöschter Text ist auf diese Art markiert. | Hinzugefügter Text ist auf diese Art markiert. |
| Zeile 22: | Zeile 22: |
| opentelemetry-instrument --exporter_jaeger_endpoint http://localhost:14268/api/traces --service_name ot_demo flask run | |
| Zeile 27: | Zeile 27: |
| opentelemetry-instrument --traces_exporter jaeger_thrift --exporter_jaeger_endpoint http://localhost:14268/api/traces --metrics_exporter none flask --app app.py run | opentelemetry-instrument --traces_exporter jaeger_thrift --exporter_jaeger_endpoint http://localhost:14268/api/traces --service_name ot_demo --metrics_exporter none flask --app app.py run |
| Zeile 50: | Zeile 50: |
= Boomerang = {{{ <!doctype html> <html lang="en"> <head> <script src="/static/boomerang.js"></script> <script src="/static/plugins/rt.js"></script> <script src="/static/plugins/boomerang-opentelemetry.js"></script> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- Bootstrap CSS --> <link rel="stylesheet" href="/static/bootstrap.min.css"> <title>{% block title %} {% endblock %}</title> </head> <body> <!-- any other plugins you want to include --> <script> BOOMR.init({ beacon_url: 'http://localhost:8080/beacon/', OpenTelemetry: { samplingRate: 1.0, // an optional sampling rate corsUrls: ['http://localhost'], consoleOnly: false, // an optional flag whether spans should only be printed to the console collectorConfiguration: { url: 'http://localhost:4318/v1/traces', // an optional url for an OpenTelemetry collector headers: {}, // an optional object containing custom headers to be sent with each request concurrencyLimit: 10, // an optional limit on pending requests }, plugins_config: { instrument_fetch: { enabled: true, clearTimingResources: false, applyCustomAttributesOnSpan: null, //A method with the following structure: (span: Span, request: Request) => { } ignoreUrls: [], propagateTraceHeaderCorsUrls: [], ignoreNetworkEvents: false }, instrument_xhr: { enabled: true, applyCustomAttributesOnSpan: null, //A method with the following structure: (span: Span, xhr: XMLHttpRequest) => { } propagateTraceHeaderCorsUrls: [], ignoreUrls: [], clearTimingResources: false, }, instrument_document_load: { enabled: true, applyCustomAttributesOnSpan: { documentLoad: null, //A method with the following structure: (span) => { } documentFetch: null, //A method with the following structure: (span) => { } resourceFetch: null, //A method with the following structure: (span, resource) => { } }, recordTransaction: false, //If true, the transaction will be traced with the document load span as root span exporterDelay: 20 // Delay to allow the exporter to export the transaction span before page unload }, instrument_user_interaction: { enabled: false, eventNames: [], shouldPreventSpanCreation: null //A method with the following structure: (eventType, element, span) => { } }, }, // Use these options only for legacy configuration. Instead using plugins_config is recommended. plugins: { instrument_fetch: true, instrument_xhr: true, instrument_document_load: true, instrument_user_interaction: true, browser_detector: true }, // Additional instrumentation config, which will be applied to all plugins global_instrumentation: { // Include request parameter to spans and the corresponding beacons requestParameter: { enabled: true, excludeKeysFromBeacons: [] //Keys, which should not be included in beacons, for instance due to cardinality concerns } }, exporter: { maxQueueSize: 200, maxExportBatchSize: 100, scheduledDelayMillis: 5000, exportTimeoutMillis: 30000, }, prototypeExporterPatch: true, // patches the OpenTelemetry collector-span-exporter in case the Prototype framework is used commonAttributes: { "application": "demo-app", "stage": "prod" }, serviceName: () => BOOMR.getVar("page_name") || "Shorty", // an optional service name for the spans propagationHeader: "TRACE_CONTEXT", } }); </script> }}} |
Jaeger/OpenTelemetry
docker run -d --name jaeger \ -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \ -e COLLECTOR_OTLP_ENABLED=true \ -p 6831:6831/udp \ -p 6832:6832/udp \ -p 5778:5778 \ -p 16686:16686 \ -p 4317:4317 \ -p 4318:4318 \ -p 14250:14250 \ -p 14268:14268 \ -p 14269:14269 \ -p 9411:9411 \ jaegertracing/all-in-one:latest
pip install opentelemetry-exporter-jaeger opentelemetry-instrumentation-flask opentelemetry-instrumentation-requests opentelemetry-instrumentation
opentelemetry-instrument --traces_exporter jaeger_thrift --exporter_jaeger_endpoint http://localhost:14268/api/traces --service_name ot_demo --metrics_exporter none flask --app app.py run
docker run --rm --name jaeger -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 -e COLLECTOR_OTLP_ENABLED=true -p 6831:6831/udp -p 6832:6832/udp -p 5778:5778 -p 16686:16686 -p 4317:4317 -p 4318:4318 -p 14250:14250 -p 14268:14268 -p 14269:14269 -p 9411:9411 jaegertracing/all-in-one:latest
from opentelemetry.instrumentation.flask import FlaskInstrumentor
from flask import Flask
# Create a Flask app
app = Flask(__name__)
# Instrument the Flask application
FlaskInstrumentor().instrument_app(app)
@app.route("/")
def hello_world():
return "Hello, OpenTelemetry!"
Boomerang
<!doctype html>
<html lang="en">
<head>
<script src="/static/boomerang.js"></script>
<script src="/static/plugins/rt.js"></script>
<script src="/static/plugins/boomerang-opentelemetry.js"></script>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="/static/bootstrap.min.css">
<title>{% block title %} {% endblock %}</title>
</head>
<body>
<!-- any other plugins you want to include -->
<script>
BOOMR.init({
beacon_url: 'http://localhost:8080/beacon/',
OpenTelemetry: {
samplingRate: 1.0, // an optional sampling rate
corsUrls: ['http://localhost'],
consoleOnly: false, // an optional flag whether spans should only be printed to the console
collectorConfiguration: {
url: 'http://localhost:4318/v1/traces', // an optional url for an OpenTelemetry collector
headers: {}, // an optional object containing custom headers to be sent with each request
concurrencyLimit: 10, // an optional limit on pending requests
},
plugins_config: {
instrument_fetch: {
enabled: true,
clearTimingResources: false,
applyCustomAttributesOnSpan: null, //A method with the following structure: (span: Span, request: Request) => { }
ignoreUrls: [],
propagateTraceHeaderCorsUrls: [],
ignoreNetworkEvents: false
},
instrument_xhr: {
enabled: true,
applyCustomAttributesOnSpan: null, //A method with the following structure: (span: Span, xhr: XMLHttpRequest) => { }
propagateTraceHeaderCorsUrls: [],
ignoreUrls: [],
clearTimingResources: false,
},
instrument_document_load: {
enabled: true,
applyCustomAttributesOnSpan: {
documentLoad: null, //A method with the following structure: (span) => { }
documentFetch: null, //A method with the following structure: (span) => { }
resourceFetch: null, //A method with the following structure: (span, resource) => { }
},
recordTransaction: false, //If true, the transaction will be traced with the document load span as root span
exporterDelay: 20 // Delay to allow the exporter to export the transaction span before page unload
},
instrument_user_interaction: {
enabled: false,
eventNames: [],
shouldPreventSpanCreation: null //A method with the following structure: (eventType, element, span) => { }
},
},
// Use these options only for legacy configuration. Instead using plugins_config is recommended.
plugins: {
instrument_fetch: true,
instrument_xhr: true,
instrument_document_load: true,
instrument_user_interaction: true,
browser_detector: true
},
// Additional instrumentation config, which will be applied to all plugins
global_instrumentation: {
// Include request parameter to spans and the corresponding beacons
requestParameter: {
enabled: true,
excludeKeysFromBeacons: [] //Keys, which should not be included in beacons, for instance due to cardinality concerns
}
},
exporter: {
maxQueueSize: 200,
maxExportBatchSize: 100,
scheduledDelayMillis: 5000,
exportTimeoutMillis: 30000,
},
prototypeExporterPatch: true, // patches the OpenTelemetry collector-span-exporter in case the Prototype framework is used
commonAttributes: {
"application": "demo-app",
"stage": "prod"
},
serviceName: () => BOOMR.getVar("page_name") || "Shorty", // an optional service name for the spans
propagationHeader: "TRACE_CONTEXT",
}
});
</script>