Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
e021891
WIP: otlp/htpp logging exporter
srikanthccv Feb 11, 2022
3a012d5
Add tests and fix bug
srikanthccv Feb 12, 2022
ebe6f66
Add CHANGELOG entry
srikanthccv Feb 13, 2022
3ac474c
Merge branch 'main' into issue-2446
srikanthccv Feb 13, 2022
e96d536
Fix lint
srikanthccv Feb 13, 2022
a97c18a
Merge branch 'issue-2446' of github.com:lonewolf3739/opentelemetry-py…
srikanthccv Feb 13, 2022
503acc4
Merge branch 'main' into issue-2446
srikanthccv Feb 17, 2022
912ae2f
Merge branch 'main' into issue-2446
srikanthccv Feb 18, 2022
c9f42ef
Merge branch 'main' into issue-2446
srikanthccv Feb 19, 2022
7fa922c
Resolve merge conflicts
srikanthccv Feb 24, 2022
26b26f2
Fix lint
srikanthccv Feb 24, 2022
b7af733
Merge branch 'issue-2446' of github.com:srikanthccv/opentelemetry-pyt…
srikanthccv Feb 24, 2022
8253b4f
Merge branch 'main' into issue-2446
srikanthccv Feb 25, 2022
1f1f324
Merge branch 'main' into issue-2446
srikanthccv Feb 26, 2022
b3fcb88
Merge branch 'main' into issue-2446
srikanthccv Mar 1, 2022
e033784
Merge branch 'main' into issue-2446
srikanthccv Apr 2, 2022
83953be
Update CHANGELOG
srikanthccv Apr 2, 2022
9ee2808
resolve merge conflicts
srikanthccv May 8, 2022
47f3a0a
Update with latest proto
srikanthccv May 8, 2022
428971b
Merge branch 'main' into issue-2446
srikanthccv May 18, 2022
7aec8c7
rearrange the changelog
srikanthccv May 18, 2022
8328f44
Merge branch 'main' into issue-2446
srikanthccv May 26, 2022
250e2db
Merge branch 'main' into issue-2446
srikanthccv May 26, 2022
3037c8a
Merge branch 'main' into issue-2446
srikanthccv May 31, 2022
5da5ad6
Merge branch 'main' into issue-2446
srikanthccv May 31, 2022
f18792c
Merge branch 'main' into issue-2446
srikanthccv Jun 2, 2022
66f155b
Merge branch 'main' into issue-2446
srikanthccv Jun 2, 2022
a8ae93e
Merge branch 'main' into issue-2446
srikanthccv Jun 8, 2022
fa81455
Append v1/logs for OTLP endpoint
srikanthccv Jun 10, 2022
5231c43
Merge branch 'issue-2446' of github.com:srikanthccv/opentelemetry-pyt…
srikanthccv Jun 10, 2022
bbc8324
Merge branch 'main' into issue-2446
srikanthccv Jun 10, 2022
85de539
Merge branch 'main' into issue-2446
srikanthccv Jun 11, 2022
624f17f
Merge branch 'main' into issue-2446
srikanthccv Jun 12, 2022
9078264
Fix lint
srikanthccv Jun 12, 2022
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
Prev Previous commit
Next Next commit
Append v1/logs for OTLP endpoint
  • Loading branch information
srikanthccv committed Jun 10, 2022
commit fa8145599013a4640d9d0d3d997979e0ea44b369
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@


DEFAULT_COMPRESSION = Compression.NoCompression
DEFAULT_ENDPOINT = "http://localhost:4318/v1/logs"
DEFAULT_ENDPOINT = "http://localhost:4318/"
DEFAULT_LOGS_EXPORT_PATH = "v1/logs"
DEFAULT_TIMEOUT = 10 # in seconds


Expand All @@ -62,8 +63,8 @@ def __init__(
timeout: Optional[int] = None,
compression: Optional[Compression] = None,
):
self._endpoint = endpoint or environ.get(
OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_ENDPOINT
self._endpoint = endpoint or _append_logs_path(
environ.get(OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_ENDPOINT)
)
self._certificate_file = certificate_file or environ.get(
OTEL_EXPORTER_OTLP_CERTIFICATE, True
Expand Down Expand Up @@ -158,3 +159,9 @@ def _compression_from_env() -> Compression:
environ.get(OTEL_EXPORTER_OTLP_COMPRESSION, "none").lower().strip()
)
return Compression(compression)


def _append_logs_path(endpoint: str) -> str:
if endpoint.endswith("/"):
return endpoint + DEFAULT_LOGS_EXPORT_PATH
return endpoint + f"/{DEFAULT_LOGS_EXPORT_PATH}"
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
DEFAULT_COMPRESSION,
DEFAULT_ENDPOINT,
DEFAULT_TIMEOUT,
DEFAULT_LOGS_EXPORT_PATH,
OTLPLogExporter,
)
from opentelemetry.exporter.otlp.proto.http._log_exporter.encoder import (
Expand Down Expand Up @@ -62,7 +63,7 @@
from opentelemetry.sdk.util.instrumentation import InstrumentationScope
from opentelemetry.trace import TraceFlags

ENV_ENDPOINT = "http://localhost.env:8080/logs"
ENV_ENDPOINT = "http://localhost.env:8080/"
ENV_CERTIFICATE = "/etc/base.crt"
ENV_HEADERS = "envHeader1=val1,envHeader2=val2"
ENV_TIMEOUT = "30"
Expand All @@ -73,7 +74,9 @@ def test_constructor_default(self):

exporter = OTLPLogExporter()

self.assertEqual(exporter._endpoint, DEFAULT_ENDPOINT)
self.assertEqual(
exporter._endpoint, DEFAULT_ENDPOINT + DEFAULT_LOGS_EXPORT_PATH
)
self.assertEqual(exporter._certificate_file, True)
self.assertEqual(exporter._timeout, DEFAULT_TIMEOUT)
self.assertIs(exporter._compression, DEFAULT_COMPRESSION)
Expand Down Expand Up @@ -121,7 +124,9 @@ def test_exporter_env(self):

exporter = OTLPLogExporter()

self.assertEqual(exporter._endpoint, ENV_ENDPOINT)
self.assertEqual(
exporter._endpoint, ENV_ENDPOINT + DEFAULT_LOGS_EXPORT_PATH
)
self.assertEqual(exporter._certificate_file, ENV_CERTIFICATE)
self.assertEqual(exporter._timeout, int(ENV_TIMEOUT))
self.assertIs(exporter._compression, Compression.Gzip)
Expand Down