Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update prometheus exporter package (fixes issues with build info gauge when using OTEL) #92

Merged
merged 6 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 17 additions & 80 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ classifiers = [
packages = [{ include = "autometrics", from = "src" }]

[tool.poetry.dependencies]
opentelemetry-exporter-prometheus = "^1.12.0rc1"
# The prometheus exporter is pinned to a beta version because of how opentelemetry-python has been releasing it.
# Technically, the version 1.12.0rc1 is the "latest" on pypi, but it's not the latest release.
# 0.41b0 includes the fix for exporting gauge values (previously they were always turned into counters).
opentelemetry-exporter-prometheus = "0.41b0"
opentelemetry-exporter-otlp-proto-http = { version = "^1.20.0", optional = true }
opentelemetry-exporter-otlp-proto-grpc = { version = "^1.20.0", optional = true }
opentelemetry-sdk = "^1.17.0"
Expand Down
5 changes: 1 addition & 4 deletions src/autometrics/exposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ class PrometheusExporterOptions(PrometheusExporterBase, total=False):

address: str
port: int
prefix: str


PrometheusValidator = TypeAdapter(PrometheusExporterOptions)
Expand Down Expand Up @@ -108,9 +107,7 @@ def create_exporter(config: ExporterOptions) -> Optional[MetricReader]:
config.get("port", 9464),
config.get("address", "0.0.0.0"),
)
return PrometheusMetricReader(
config.get("prefix", ""),
)
return PrometheusMetricReader()
if config["type"] == "otlp-proto-http":
config = OtlpHttpExporterValidator.validate_python(config)
try:
Expand Down
2 changes: 1 addition & 1 deletion src/autometrics/tracker/opentelemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def __init__(self, reader: Optional[MetricReader] = None):
),
)
resource = Resource.create(get_resource_attrs())
readers = [reader or PrometheusMetricReader("")]
readers = [reader or PrometheusMetricReader()]
meter_provider = MeterProvider(
views=[view],
resource=resource,
Expand Down