Emerging AI regulations such as the European Union Artificial Intelligence Act provide the means to deploy a comprehensive strategy combining organizational and AI model oversight, covering everything from model training to AI/user interactions.
When running your AI models through Amazon Bedrock, Dynatrace helps you to comply with regulatory record-keeping requirements.
In this tutorial, we first configure your model training and deployment observability. Afterward, we configure your application to observe user inference requests.
The general steps are as follows:
In this step, we create a Dynatrace token and we configure OpenPipeline to retain the data for 5+ years.
To authenticate, create one of the following:
Access Tokens.Required scopes:
openpipeline:bizevents:ingest, openpipeline:traces:ingestbizevents.ingest, openTelemetryTrace.ingestThe default retention period for BizEvents is 35 days. Depending on the regulations, this might not be enough.
To change the retention period, you can create a custom Grail bucket.
gen_ai_events)1,825, which is about 5 years)bizevents
When the bucket is available, we can configure OpenPipeline to redirect AI-relevant events to storage there.
AI Data Governance).matchesValue(event.type, "gen_ai.auditing")
Finally, we route the ingestion of AI events to the pipeline.
Configure the dynamic routes in
Settings, even if you use dtctl for the bucket and pipelines. All routes of a configuration scope are stored in one settings object, so applying a routing file with dtctl would replace your existing routes.
AI Event Routing)matchesValue(event.type,"gen_ai.auditing")Finally, to mark it as the first pipeline to trigger, drag it up to be the first row in the table.

Your application sends traces, not business events. To keep a record of each user/AI interaction, configure OpenPipeline to create a gen_ai.auditing business event from every LLM span. The dynamic route from the previous procedure then sends these events to your bucket.
AI Data Governance - Spans).gen_ai.auditing extraction).isNotNull(gen_ai.input.messages) OR isNotNull(gen_ai.output.messages).gen_ai.auditing.service.name.gen_ai.input.messagesgen_ai.output.messagesgen_ai.request.modelgen_ai.response.modelgen_ai.provider.namegen_ai.operation.namegen_ai.usage.input_tokensgen_ai.usage.output_tokensservice.nametrace.idspan.idThen route the spans of your AI application to this pipeline.
AI Span Routing).service.name == "<your-service>".The extracted events go through the business events pipeline, so the bucket must exist before you send data. If the bucket doesn't exist, the events are dropped without an error.
Instead of using
Settings, you can create the bucket and both pipelines with dtctl. Configure the two dynamic routes as described in Configure OpenPipeline.
Create the bucket. This requires the storage:buckets:write permission.
dtctl create bucket --name gen_ai_events --table bizevents --retention 1825 --display-name "GenAI auditing events"
Save the business events pipeline as bizevents-pipeline.yaml. Set bucketName to your bucket.
schemaid: builtin:openpipeline.bizevents.pipelinesscope: environmentvalue:customId: ai-data-governancedisplayName: AI Data Governancestorage:processors:- id: gen-ai-events-buckettype: bucketAssignmentenabled: truedescription: Store gen_ai.auditing events in gen_ai_eventsmatcher: matchesValue(event.type, "gen_ai.auditing")bucketAssignment:bucketName: gen_ai_events
Save the spans pipeline as spans-pipeline.yaml. Adjust the list of extracted fields to what you need to retain.
schemaid: builtin:openpipeline.spans.pipelinesscope: environmentvalue:customId: ai-data-governance-spansdisplayName: AI Data Governance - SpansdataExtraction:processors:- id: gen-ai-auditing-bizeventtype: bizeventenabled: truedescription: Extract gen_ai.auditing business event from LLM spansmatcher: isNotNull(gen_ai.input.messages) OR isNotNull(gen_ai.output.messages)bizevent:eventType:type: constantconstant: gen_ai.auditingeventProvider:type: fieldfield:sourceFieldName: service.namefieldExtraction:type: includeinclude:- { extractionType: field, sourceFieldName: gen_ai.input.messages }- { extractionType: field, sourceFieldName: gen_ai.output.messages }- { extractionType: field, sourceFieldName: gen_ai.request.model }- { extractionType: field, sourceFieldName: gen_ai.response.model }- { extractionType: field, sourceFieldName: gen_ai.provider.name }- { extractionType: field, sourceFieldName: gen_ai.operation.name }- { extractionType: field, sourceFieldName: gen_ai.usage.input_tokens }- { extractionType: field, sourceFieldName: gen_ai.usage.output_tokens }- { extractionType: field, sourceFieldName: service.name }- { extractionType: field, sourceFieldName: trace.id }- { extractionType: field, sourceFieldName: span.id }
Apply both files. This requires the settings:objects:write permission.
dtctl apply -f bizevents-pipeline.yamldtctl apply -f spans-pipeline.yaml
Amazon Bedrock emits events for every configuration action executed, such as when you deploy a new model or when the fine-tuning of your model finishes.
We can set up a rule to forward these events to Dynatrace. Please refer to our integration with Amazon EventBridge using BizEvent to configure the rule.
The only change is in the InputTemplate field, where the property "type" should be set to gen_ai.auditing. This change is required to match the values that OpenPipeline uses to redirect the events to our Grail bucket.
The following screenshots show the connection, transformer, and target configuration in AWS.



Instrument your application with OpenInference. The BedrockInstrumentor traces your Amazon Bedrock calls, including the prompts and responses.
The business event extraction reads gen_ai.* attributes. To emit them alongside the OpenInference attributes, set the following environment variable:
OPENINFERENCE_ENABLE_GENAI_SEMCONV=true
For details, see Use OpenTelemetry GenAI semantic conventions when available.
To install, use the following command:
pip install openinference-instrumentation-bedrock opentelemetry-sdk opentelemetry-exporter-otlp-proto-http
Afterward, add the following code at the beginning of your main file:
from opentelemetry import tracefrom opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporterfrom opentelemetry.sdk.resources import Resource, SERVICE_NAMEfrom opentelemetry.sdk.trace import TracerProviderfrom opentelemetry.sdk.trace.export import BatchSpanProcessorfrom openinference.instrumentation.bedrock import BedrockInstrumentorexporter = OTLPSpanExporter(endpoint="https://<YOUR_ENV>.live.dynatrace.com/api/v2/otlp/v1/traces",headers={"Authorization": "Bearer <your-platform-token>"},)provider = TracerProvider(resource=Resource.create({SERVICE_NAME: "<your-service>"}))provider.add_span_processor(BatchSpanProcessor(exporter))trace.set_tracer_provider(provider)BedrockInstrumentor().instrument(tracer_provider=provider)
With a Classic access token, set the header to Api-Token <YOUR_DT_API_TOKEN> instead. The required scope is openpipeline:traces:ingest for a platform token, or openTelemetryTrace.ingest for a Classic access token.
Use the same <your-service> value as in the span routing condition.
For a complete runnable example, see the Amazon Bedrock OpenInference sample.
And that's it!
Now you can:
or Dashboards
to create data-driven documents for custom analytics on it.