This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.sun.net.httpserver.HttpServer; | |
| import io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics; | |
| import io.micrometer.core.instrument.binder.jvm.JvmGcMetrics; | |
| import io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics; | |
| import io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics; | |
| import io.micrometer.core.instrument.binder.system.ProcessorMetrics; | |
| import io.micrometer.prometheus.PrometheusMeterRegistry; | |
| import java.io.IOException; | |
| import java.io.OutputStream; | |
| import java.net.HttpURLConnection; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Just a service class which will provide the instance of PrometheusMeterRegistry | |
| public class MetricService { | |
| private static PrometheusMeterRegistry prometheusMeterRegistry = null; | |
| public static PrometheusMeterRegistry getRegistry() { | |
| if (prometheusMeterRegistry == null) { | |
| prometheusMeterRegistry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT); | |
| } | |
| return prometheusMeterRegistry; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| global: | |
| scrape_interval: 10s | |
| evaluation_interval: 10s | |
| scrape_configs: | |
| - job_name: "prometheus" | |
| static_configs: | |
| - targets: ["127.0.0.1:9090"] | |
| - job_name: "prome-java" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: "3.8" | |
| services: | |
| prometheus: | |
| image: prom/prometheus | |
| container_name: prometheus | |
| volumes: | |
| - ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml | |
| - ./data/prometheus:/data | |
| command: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.sun.net.httpserver.HttpServer; | |
| import io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics; | |
| import io.micrometer.core.instrument.binder.jvm.JvmGcMetrics; | |
| import io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics; | |
| import io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics; | |
| import io.micrometer.core.instrument.binder.system.ProcessorMetrics; | |
| import io.micrometer.prometheus.PrometheusMeterRegistry; | |
| import java.io.IOException; | |
| import java.io.OutputStream; | |
| import java.net.HttpURLConnection; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # using SendGrid's Python Library | |
| # https://github.com/sendgrid/sendgrid-python | |
| import os | |
| from sendgrid import SendGridAPIClient | |
| from sendgrid.helpers.mail import Mail | |
| SENDGRID_API_KEY = "===" | |
| message = Mail( | |
| from_email='[email protected]', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Use this for your user data (script from top to bottom) | |
| # install httpd (Linux 2 version) | |
| yum update -y | |
| yum install -y httpd | |
| systemctl start httpd | |
| systemctl enable httpd | |
| echo "<h1>Hello World from $(hostname -f)</h1>" > /var/www/html/index.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ==> mysql | |
| We've installed your MySQL database without a root password. To secure it run: | |
| mysql_secure_installation | |
| MySQL is configured to only allow connections from localhost by default | |
| To connect run: | |
| mysql -uroot | |
| To have launchd start mysql now and restart at login: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: 2.1 | |
| executors: | |
| default: | |
| working_directory: ~/workspace | |
| docker: | |
| - image: circleci/python:3.5 | |
| jobs: | |
| lint: | |
| executor: | |
| name: default |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # aproducer.py | |
| # | |
| # Async Producer-consumer problem. | |
| # Challenge: How to implement the same functionality, but no threads. | |
| import time | |
| from collections import deque | |
| import heapq | |
| class Scheduler: |