Skip to technology filters Skip to main content
Dynatrace Hub

Extend the platform,
empower your team.

Popular searches:
Home hero bg
TensorFlow KerasTensorFlow Keras
TensorFlow Keras

TensorFlow Keras

Observe the training progress of TensorFlow Keras AI models

Technology
Free trialDocumentation
  • Product information

Overview

TensorFlow and its user-friendly Keras sequential interface represent state-of-the-art technology for training and running deep learning models.

TensorFlow represents a general-purpose machine learning framework that allows data scientists to build, train and run all kinds of AI models on top.

TensorFlow also ships together with a convenient debugging server called TensorBoard that allows data scientists to collect and visualize all relevant training information such as logs, events, and metrics within a Web dashboard.

While TensorBoard is a great tool for local debugging of your AI model, it is not applicable for long-term observability of your running AI model in production.

As TensorBoard data collection is built on top of a flexible TensorFlow callback receiver interface, it is easy to directly send observability information about your running AI model to Dynatrace. All that is necessary is a dedicated TensorFlow callback implementation that collects the data and forwards to a Dynatrace monitoring environment.

Get started

A TensorFlow callback receiver implementation does receive important information updates during training and evaluation phase of a model. See below the implementation of a Dynatrace TensorFlow callback receiver that forwards metric data during training and evaluation of a model.

  • Create a Dynatrace environment API token with the permission scopes (metric.ingest)
  • Use the following Dynatrace TensorFlow callback receiver within your AI model and initialize it with your own Dynatrace API token and environment URL:
import tensorflow as tf
from tensorflow import keras

import requests
# Custom TensorFlow Keras callback receiver that sends the logged metrics
# to a Dynatrace monitoring environment.
# Read more about writing your own callback receiver here:
# https://www.tensorflow.org/guide/keras/custom_callback
class DynatraceKerasCallback(keras.callbacks.Callback):
    metricprefix = ''
    modelname = ''
    url = ''
    apitoken = ''
    batch = ''

    # Constructor that takes a metric prefix, the name of the current model that is used,
    # the Dynatrace metric ingest API endpoint (e.g.: https://your.live.dynatrace.com/api/v2/metrics/ingest)
    # and the Dynatrace API token (with metric ingest scope enabled)
    def __init__(self, metricprefix='tensorflow.', modelname='', url='', apitoken=''):
        self.metricprefix = metricprefix
        self.modelname = modelname
        self.url = url
        self.apitoken = apitoken

    def send_metric(self, name, value, tags):
      tags_str = ''
      for tag_key in tags:
        tags_str = tags_str + ',{key}={value}'.format(key=tag_key, value=tags[tag_key])
      line = '{prefix}.{name}{tags} {value}\n'.format(prefix=self.metricprefix, tags=tags_str, model=self.modelname, name=name, value=value)
      self.batch = self.batch + line

    def flush(self):
      print(self.batch)
      r = requests.post(self.url, headers={'Content-Type': 'text/plain', 'Authorization' : 'Api-Token ' + self.apitoken}, data=self.batch)
      self.batch = ''

    def on_train_end(self, logs=None):
        keys = list(logs.keys())
        for m in keys:
          self.send_metric(m, logs[m], { 'model' : self.modelname, 'stage' : 'train' })
        self.flush()

    def on_epoch_end(self, epoch, logs=None):
        keys = list(logs.keys())
        for m in keys:
          self.send_metric(m, logs[m], { 'model' : self.modelname, 'stage' : 'train' })
        self.flush()

    def on_test_end(self, logs=None):
        keys = list(logs.keys())
        for m in keys:
          self.send_metric(m, logs[m], { 'model' : self.modelname, 'stage' : 'test' })
        self.flush()

    def on_predict_end(self, logs=None):
        keys = list(logs.keys())
        for m in keys:
          self.send_metric(m, logs[m], { 'model' : self.modelname, 'stage' : 'predict' })
        self.flush()
  • The Dynatrace TensorFlow callback hook will prefix and forward all your TensorFlow metrics to Dynatrace. By default you will receive two metrics representing the training accuracy (tensorflow.accuracy) and the loss (tensorflow.loss) split by model and stage.
Dynatrace
Documentation
By Dynatrace
Dynatrace support center
Copy to clipboard
Dynatrace Hub
Get data into DynatraceBuild your own app
All (768)Log Management and AnalyticsKubernetesAI and LLM ObservabilityInfrastructure ObservabilitySoftware DeliveryApplication ObservabilityApplication SecurityDigital ExperienceBusiness Analytics
Filter
Type
Built and maintained by
Deployment model
SaaS
  • SaaS
  • Managed
Partner FinderBecome a partnerDynatrace Developer

Discover recent additions to Dynatrace

Problems logo

Problems

Analyze abnormal system behavior and performance problems detected by Davis AI.

Logs logo

Logs

Explore all your logs without writing a single query.

Security Investigator logo

Security Investigator

Fast and precise forensics for security and logs on Grail data with DQL queries.

Business Flow logo

Business Flow

Track, analyze, and optimize your critical business processes.

Cost & Carbon Optimization logo

Cost & Carbon Optimization

Track, analyze, and optimize your IT carbon footprint and public cloud costs.

Davis Anomaly Detection logo

Davis Anomaly Detection

Detect anomalies in timeseries using the Davis AI

Analyze your data

Understand your data better with deep insights and clear visualizations.

Notebooks logo

Notebooks

Create powerful, data-driven documents for custom analytics and collaboration.

Dashboards logo

Dashboards

Transform complex data into clear visualizations with custom dashboards.

Automate your processes

Turn data and answers into actions, securely, and at scale.

Workflows logo

Workflows

Automate tasks in your IT landscape, remediate problems, and visualize processes

Jira logo

Jira

Create, query, comment, transition, and resolve Jira tickets within workflows.

Slack logo

Slack

Automate Slack messaging for security incidents, attacks, remediation, and more.

Secure your cloud application

See vulnerabilities and attacks in your environment.

Security Overview logo

Security Overview

Get a comprehensive overview of the security of your applications.

Code-Level Vulnerabilities logo

Code-Level Vulnerabilities

Detect vulnerabilities in your code in real time.

Threats & Exploits logo

Threats & Exploits

Understand, triage, and investigate application security findings and alerts.

Are you looking for something different?

We have hundreds of apps, extensions, and other technologies to customize your environment

Leverage our newest innovations of Dynatrace Saas

Kick-start your app creation

Kick-start your app creation

Whether you’re a beginner or a pro, Dynatrace Developer has the tools and support you need to create incredible apps with minimal effort.
Go to Dynatrace Developer
Upgrading from Dynatrace Managed to SaaS

Upgrading from Dynatrace Managed to SaaS

Drive innovation, speed, and agility in your organization by seamlessly and securely upgrading.
Learn More
Log Management and Analytics

Log Management and Analytics

Innovate faster and more efficiently with unified log management and log analytics for actionable insights and automation.
Learn more