-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Warn if service name is not set (#567)
* Add support for env vars in spec: * SPLUNK_PROFILER_LOGS_ENDPOINT * SPLUNK_PROFILER_CALL_STACK_INTERVAL * Lint * Add and use env getint for profiling interval * Lint * Warn if service name is not set. Previously only warned if profiling was enabled. * Add oteltest for missing svcname * Use constant for service name
- Loading branch information
Showing
5 changed files
with
88 additions
and
24 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,38 @@ | ||
from ott_lib import project_path, trace_loop | ||
|
||
if __name__ == "__main__": | ||
trace_loop(1) | ||
|
||
|
||
class SpecOtelTest: | ||
def requirements(self): | ||
return (project_path(),) | ||
|
||
def environment_variables(self): | ||
return { | ||
"OTEL_PYTHON_DISABLED_INSTRUMENTATIONS": "system_metrics", | ||
} | ||
|
||
def wrapper_command(self): | ||
return "opentelemetry-instrument" | ||
|
||
def on_start(self): | ||
return None | ||
|
||
def on_stop(self, telemetry, stdout: str, stderr: str, returncode: int) -> None: | ||
from oteltest.telemetry import extract_leaves, get_attribute | ||
|
||
assert "service.name attribute is not set" in stderr | ||
|
||
attributes = extract_leaves( | ||
telemetry, | ||
"trace_requests", | ||
"pbreq", | ||
"resource_spans", | ||
"resource", | ||
"attributes", | ||
) | ||
assert get_attribute(attributes, "service.name").value.string_value == "unnamed-python-service" | ||
|
||
def is_http(self): | ||
return False |
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