Skip to content

Commit b3aff32

Browse files
authored
Small fixes for examples & pr template (#103)
1 parent a0725ca commit b3aff32

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

.github/pull_request_template.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
- [ ] Create test cases
1010
- [ ] Update changelog
1111
<!-- Use these for release PRs:
12-
- [ ] Update package version in `pyprojevt.toml`
12+
- [ ] Update package version in `pyproject.toml`
1313
- [ ] Update spec version in `constants.py`
1414
- [ ] Move changes to a new section in `CHANGELOG.md` -->

examples/export_metrics/otlp.py examples/export_metrics/otlp-grpc.py

+12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import time
22
from autometrics import autometrics, init
3+
from opentelemetry.sdk.metrics import Counter
4+
from opentelemetry.sdk.metrics.export import (
5+
AggregationTemporality,
6+
)
37

48
# Autometrics supports exporting metrics to OTLP collectors via gRPC and HTTP transports.
59
# This example uses the gRPC transport, available settings are similar to the OpenTelemetry
@@ -10,7 +14,15 @@
1014
init(
1115
exporter={
1216
"type": "otlp-proto-grpc",
17+
"endpoint": "http://localhost:4317", # You don't need to set this if you are using the default endpoint
18+
"insecure": True, # Enabled for http transport
1319
"push_interval": 1000,
20+
# Here are some other available settings:
21+
# "timeout": 10,
22+
# "headers": {"x-something": "value"},
23+
# "aggregation_temporality": {
24+
# Counter: AggregationTemporality.CUMULATIVE,
25+
# },
1426
},
1527
service_name="otlp-exporter",
1628
)

examples/export_metrics/otlp-http.py

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import time
22
from autometrics import autometrics, init
3+
from opentelemetry.sdk.metrics import Counter
4+
from opentelemetry.sdk.metrics.export import (
5+
AggregationTemporality,
6+
)
37

48
# Autometrics supports exporting metrics to OTLP collectors via gRPC and HTTP transports.
59
# This example uses the HTTP transport, available settings are similar to the OpenTelemetry
@@ -10,7 +14,14 @@
1014
init(
1115
exporter={
1216
"type": "otlp-proto-http",
17+
"endpoint": "http://localhost:4318/", # You don't need to set this if you are using the default endpoint
1318
"push_interval": 1000,
19+
# Here are some other available settings:
20+
# "timeout": 10,
21+
# "headers": {"x-something": "value"},
22+
# "aggregation_temporality": {
23+
# Counter: AggregationTemporality.CUMULATIVE,
24+
# },
1425
},
1526
service_name="otlp-exporter",
1627
)

0 commit comments

Comments
 (0)