Skip to content

Instantly share code, notes, and snippets.

View davidmlentz's full-sized avatar

David M. Lentz davidmlentz

  • Datadog
  • Boise, ID
View GitHub Profile
def check_bgtask_threshold(dd)
bgtask_series_threshold = 5
from = Time.now - 120
to = Time.now
CANARY_BGSERVERS.each do |server|
puts "Checking bgtasks on server #{server}"
query = "sum:lockable.run_delta.count{env:prod-web,role:web-bg,host:#{server},success:true}by{host}.as_count()"
bgtask_value = dd.get_points(query, from, to)
def check_bgtask_threshold(dd)
bgtask_series_threshold = 5
from = Time.now - 120
to = Time.now
CANARY_BGSERVERS.each do |server|
puts "Checking bgtasks on server #{server}"
query = "sum:lockable.run_delta.count{env:prod-web,role:web-bg,host:#{server},success:true}by{host}.as_count()"
bgtask_value = dd.get_points(query, from, to)
from datadog import initialize
options = {
'api_key':'',
'app_key':''
}
initialize(**options)
# EVENTS: Use Datadog REST API client to create an event:
import time
from flask import Flask
from ddtrace import tracer
app = Flask(__name__)
def function1():
time.sleep(0.1)
return True
import redis # We'll call an external Redis server just to see how that looks.
import time # Need this for sleep statements.
import blinker as _
from flask import Flask
from ddtrace import tracer
app = Flask(__name__)
@tracer.wrap(name='my_resource1')
def function1():
from flask import Flask
application = Flask(__name__)
@application.route("/")
def index():
return "hello!"
if __name__ == "__main__":
application.run(host="0.0.0.0")
from flaskapp import application
if __name__ == "__main__":
application.run()
[uwsgi]
master = true
processes = 8
threads = 4
# DogStatsD plugin configuration
enable-metrics = true
plugin = dogstatsd
stats-push = dogstatsd:127.0.0.1:8125,myapp
<!--
Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for additional
information regarding copyright ownership. The ASF licenses this file to You under
the Apache License, Version 2.0 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or
agreed to in writing, software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
instances:
- host: localhost
port: 1099
# user: username
# password: password
name: activemq_instance
# List of metrics to be collected by the integration
# Visit http://docs.datadoghq.com/integrations/java/ to customize it
init_config:
conf: