-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from autometrics-dev/otlp-exporter
Add otlp exporters
- Loading branch information
Showing
31 changed files
with
1,673 additions
and
631 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docker_compose('docker-compose.yaml') |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
receivers: | ||
otlp: | ||
protocols: | ||
grpc: | ||
http: | ||
|
||
exporters: | ||
logging: | ||
loglevel: debug | ||
prometheus: | ||
endpoint: "0.0.0.0:9464" # This is where Prometheus will scrape the metrics from. | ||
# namespace: <namespace> # Replace with your namespace. | ||
|
||
|
||
processors: | ||
batch: | ||
|
||
service: | ||
pipelines: | ||
metrics: | ||
receivers: [otlp] | ||
processors: [] | ||
exporters: [logging, prometheus] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
version: "3.9" | ||
|
||
volumes: | ||
app-logs: | ||
|
||
services: | ||
am: | ||
image: autometrics/am:latest | ||
extra_hosts: | ||
- host.docker.internal:host-gateway | ||
ports: | ||
- "6789:6789" | ||
- "9090:9090" | ||
container_name: am | ||
command: "start http://otel-collector:9464/metrics host.docker.internal:9464" | ||
environment: | ||
- LISTEN_ADDRESS=0.0.0.0:6789 | ||
restart: unless-stopped | ||
volumes: | ||
- app-logs:/var/log | ||
otel-collector: | ||
image: otel/opentelemetry-collector-contrib:latest | ||
container_name: otel-collector | ||
command: ["--config=/etc/otel-collector-config.yaml"] | ||
volumes: | ||
- ./configs/otel-collector-config.yaml:/etc/otel-collector-config.yaml | ||
ports: | ||
- "4317:4317" | ||
- "4318:4318" | ||
- "8888:8888" # expose container metrics in prometheus format | ||
- "55680:55680" | ||
- "55679:55679" | ||
restart: unless-stopped | ||
push-gateway: | ||
image: ghcr.io/zapier/prom-aggregation-gateway:latest |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import time | ||
from autometrics import autometrics, init | ||
|
||
# Autometrics supports exporting metrics to Prometheus via the OpenTelemetry. | ||
# This example uses the Prometheus Python client, available settings are same as the | ||
# Prometheus Python client. By default, the Prometheus exporter will expose metrics | ||
# on port 9464. If you don't have a Prometheus server running, you can run Tilt or | ||
# Docker Compose from the root of this repo to start one up. | ||
|
||
init( | ||
tracker="opentelemetry", | ||
exporter={ | ||
"type": "prometheus", | ||
"port": 9464, | ||
}, | ||
service_name="my-service", | ||
) | ||
|
||
|
||
@autometrics | ||
def my_function(): | ||
pass | ||
|
||
|
||
while True: | ||
my_function() | ||
time.sleep(1) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import time | ||
from autometrics import autometrics, init | ||
|
||
# Autometrics supports exporting metrics to OTLP collectors via gRPC and HTTP transports. | ||
# This example uses the gRPC transport, available settings are similar to the OpenTelemetry | ||
# Python SDK. By default, the OTLP exporter will send metrics to localhost:4317. | ||
# If you don't have an OTLP collector running, you can run Tilt or Docker Compose | ||
# to start one up. | ||
|
||
init( | ||
exporter={ | ||
"type": "otlp-proto-grpc", | ||
"push_interval": 1000, | ||
}, | ||
service_name="my-service", | ||
) | ||
|
||
|
||
@autometrics | ||
def my_function(): | ||
pass | ||
|
||
|
||
while True: | ||
my_function() | ||
time.sleep(1) |
Oops, something went wrong.