def update_config(m2ee, app_name): if not is_enabled() or not _is_installed(): return tags = buildpackutil.get_tags() if buildpackutil.is_appmetrics_enabled(): statsd_port = 8126 else: statsd_port = 8125 m2ee.config._conf["m2ee"]["javaopts"].extend( [ "-Dcom.sun.management.jmxremote", "-Dcom.sun.management.jmxremote.port=7845", "-Dcom.sun.management.jmxremote.local.only=true", "-Dcom.sun.management.jmxremote.authenticate=false", "-Dcom.sun.management.jmxremote.ssl=false", "-Djava.rmi.server.hostname=127.0.0.1", ] ) if m2ee.config.get_runtime_version() >= 7.15: m2ee.config._conf["logging"].append( { "type": "tcpjsonlines", "name": "DataDogSubscriber", "autosubscribe": "INFO", "host": "localhost", # For MX8 integer is supported again, this change needs to be # made when MX8 is GA "port": "9032", } ) enable_runtime_agent(m2ee) subprocess.check_call(("mkdir", "-p", ".local/datadog")) with open(".local/datadog/datadog.yaml", "w") as fh: config = { "dd_url": "https://app.datadoghq.com", "api_key": None, # set via DD_API_KEY instead "confd_path": ".local/datadog/conf.d", "logs_enabled": True, "log_file": "/dev/null", # will be printed via stdout/stderr "hostname": buildpackutil.get_hostname(), "tags": tags, "process_config": { "enabled": "true", # has to be string "log_file": "/dev/null", }, "apm_config": {"enabled": True, "max_traces_per_second": 10}, "logs_config": {"run_path": ".local/datadog/run"}, "use_dogstatsd": True, "dogstatsd_port": statsd_port, } fh.write(yaml.safe_dump(config)) subprocess.check_call(("mkdir", "-p", ".local/datadog/conf.d/mendix.d")) subprocess.check_call(("mkdir", "-p", ".local/datadog/run")) with open(".local/datadog/conf.d/mendix.d/conf.yaml", "w") as fh: config = { "logs": [ { "type": "tcp", "port": "9032", "service": _get_service(), "source": "mendix", "tags": tags, } ] } fh.write(yaml.safe_dump(config)) subprocess.check_call(("mkdir", "-p", ".local/datadog/conf.d/jmx.d")) with open(".local/datadog/conf.d/jmx.d/conf.yaml", "w") as fh: # jmx beans and values can be inspected with jmxterm # download the jmxterm jar into the container # and run app/.local/bin/java -jar ~/jmxterm.jar # # the extra attributes are only available from Mendix 7.15.0+ config = { "init_config": {"collect_default_metrics": True, "is_jmx": True}, "instances": [ { "host": "localhost", "port": 7845, "java_bin_path": ".local/bin/java", "java_options": "-Xmx50m -Xms5m", "reporter": "statsd:localhost:{}".format(statsd_port), # 'refresh_beans': 10, # runtime takes time to initialize the beans "conf": [ { "include": { "bean": "com.mendix:type=SessionInformation", # NamedUsers = 1; # NamedUserSessions = 0; # AnonymousSessions = 0; "attribute": { "NamedUsers": {"metrics_type": "gauge"}, "NamedUserSessions": { "metrics_type": "gauge" }, "AnonymousSessions": { "metrics_type": "gauge" }, }, } }, { "include": { "bean": "com.mendix:type=Statistics,name=DataStorage", # Selects = 1153; # Inserts = 1; # Updates = 24; # Deletes = 0; # Transactions = 25; "attribute": { "Selects": {"metrics_type": "counter"}, "Updates": {"metrics_type": "counter"}, "Inserts": {"metrics_type": "counter"}, "Deletes": {"metrics_type": "counter"}, "Transactions": { "metrics_type": "counter" }, }, } }, { "include": { "bean": "com.mendix:type=General", # Languages = en_US; # Entities = 24; "attribute": { "Entities": {"metrics_type": "gauge"} }, } }, { "include": { "bean": "com.mendix:type=JettyThreadPool", # Threads = 8 # IdleThreads = 3; # IdleTimeout = 60000; # MaxThreads = 254; # StopTimeout = 30000; # MinThreads = 8; # ThreadsPriority = 5; # QueueSize = 0; "attribute": { "Threads": {"metrics_type": "gauge"}, "MaxThreads": {"metrics_type": "gauge"}, "IdleThreads": {"metrics_type": "gauge"}, "QueueSize": {"metrics_type": "gauge"}, }, } }, ], # }, { # 'include': { # 'bean': 'com.mendix:type=Jetty', # # ConnectedEndPoints = 0; # # IdleTimeout = 30000; # # RequestsActiveMax = 0; # 'attribute': { # } # }, } ], } fh.write(yaml.safe_dump(config)) _set_up_postgres()
def update_config(m2ee, app_name): if not is_enabled() or not _is_installed(): return tags = buildpackutil.get_tags() m2ee.config._conf['m2ee']['javaopts'].extend([ '-Dcom.sun.management.jmxremote', '-Dcom.sun.management.jmxremote.port=7845', '-Dcom.sun.management.jmxremote.local.only=true', '-Dcom.sun.management.jmxremote.authenticate=false', '-Dcom.sun.management.jmxremote.ssl=false', '-Djava.rmi.server.hostname=127.0.0.1', ]) if m2ee.config.get_runtime_version() >= 7.15: m2ee.config._conf['logging'].append({ 'type': 'tcpjsonlines', 'name': 'DataDogSubscriber', 'autosubscribe': 'INFO', 'host': 'localhost', 'port': 9032, }) enable_runtime_agent(m2ee) subprocess.check_call(('mkdir', '-p', '.local/datadog')) with open('.local/datadog/datadog.yaml', 'w') as fh: config = { 'dd_url': 'https://app.datadoghq.com', 'api_key': None, # set via DD_API_KEY instead 'confd_path': '.local/datadog/conf.d', 'logs_enabled': True, 'log_file': '/dev/null', # will be printed via stdout/stderr 'hostname': buildpackutil.get_hostname(), 'tags': tags, 'process_config': { 'enabled': 'true', # has to be string 'log_file': '/dev/null', }, 'apm_config': { 'enabled': True, 'max_traces_per_second': 10, }, 'logs_config': { 'run_path': '.local/datadog/run', }, 'use_dogstatsd': not buildpackutil.is_appmetrics_enabled() } fh.write(yaml.safe_dump(config)) subprocess.check_call(('mkdir', '-p', '.local/datadog/conf.d/mendix.d')) subprocess.check_call(('mkdir', '-p', '.local/datadog/run')) with open('.local/datadog/conf.d/mendix.d/conf.yaml', 'w') as fh: config = { 'logs': [{ 'type': 'tcp', 'port': '9032', 'service': _get_service(), 'source': 'mendix', 'tags': tags, }], } fh.write(yaml.safe_dump(config)) subprocess.check_call(('mkdir', '-p', '.local/datadog/conf.d/jmx.d')) with open('.local/datadog/conf.d/jmx.d/conf.yaml', 'w') as fh: # jmx beans and values can be inspected with jmxterm # download the jmxterm jar into the container # and run app/.local/bin/java -jar ~/jmxterm.jar # # the extra attributes are only available from Mendix 7.15.0+ config = { 'init_config': { 'collect_default_metrics': True, 'is_jmx': True, }, 'instances': [{ 'host': 'localhost', 'port': 7845, 'java_bin_path': '.local/bin/java', 'java_options': '-Xmx50m -Xms5m', # 'refresh_beans': 10, # runtime takes time to initialize the beans 'conf': [{ 'include': { 'bean': 'com.mendix:type=SessionInformation', # NamedUsers = 1; # NamedUserSessions = 0; # AnonymousSessions = 0; 'attribute': { 'NamedUsers': {'metrics_type': 'gauge'}, 'NamedUserSessions': {'metrics_type': 'gauge'}, 'AnonymousSessions': {'metrics_type': 'gauge'}, }, }, }, { 'include': { 'bean': 'com.mendix:type=Statistics,name=DataStorage', # Selects = 1153; # Inserts = 1; # Updates = 24; # Deletes = 0; # Transactions = 25; 'attribute': { 'Selects': {'metrics_type': 'counter'}, 'Updates': {'metrics_type': 'counter'}, 'Inserts': {'metrics_type': 'counter'}, 'Deletes': {'metrics_type': 'counter'}, 'Transactions': {'metrics_type': 'counter'}, }, }, }, { 'include': { 'bean': 'com.mendix:type=General', # Languages = en_US; # Entities = 24; 'attribute': { 'Entities': {'metrics_type': 'gauge'}, }, }, }, { 'include': { 'bean': 'com.mendix:type=JettyThreadPool', # Threads = 8 # IdleThreads = 3; # IdleTimeout = 60000; # MaxThreads = 254; # StopTimeout = 30000; # MinThreads = 8; # ThreadsPriority = 5; # QueueSize = 0; 'attribute': { 'Threads': {'metrics_type': 'gauge'}, 'MaxThreads': {'metrics_type': 'gauge'}, 'IdleThreads': {'metrics_type': 'gauge'}, 'QueueSize': {'metrics_type': 'gauge'}, }, }, }], # }, { # 'include': { # 'bean': 'com.mendix:type=Jetty', # # ConnectedEndPoints = 0; # # IdleTimeout = 30000; # # RequestsActiveMax = 0; # 'attribute': { # } # }, }], } fh.write(yaml.safe_dump(config)) _set_up_postgres()