chore: add semantic conventions pgk to redix (#119)
This commit is contained in:
parent
a72305f574
commit
01fc804ab2
|
@ -15,9 +15,11 @@ defmodule OpentelemetryRedix do
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
alias OpenTelemetry.SemanticConventions.Trace
|
||||||
alias OpentelemetryRedix.Command
|
alias OpentelemetryRedix.Command
|
||||||
alias OpentelemetryRedix.ConnectionTracker
|
alias OpentelemetryRedix.ConnectionTracker
|
||||||
|
|
||||||
|
require Trace
|
||||||
require OpenTelemetry.Tracer
|
require OpenTelemetry.Tracer
|
||||||
|
|
||||||
@typedoc "Setup options"
|
@typedoc "Setup options"
|
||||||
|
@ -54,9 +56,9 @@ defmodule OpentelemetryRedix do
|
||||||
|
|
||||||
attributes =
|
attributes =
|
||||||
%{
|
%{
|
||||||
"db.system": "redis",
|
Trace.db_system() => "redis",
|
||||||
"db.operation": operation,
|
Trace.db_operation() => operation,
|
||||||
"db.statement": statement
|
Trace.db_statement() => statement
|
||||||
}
|
}
|
||||||
|> Map.merge(net_attributes(connection))
|
|> Map.merge(net_attributes(connection))
|
||||||
|> Map.merge(redix_attributes(meta))
|
|> Map.merge(redix_attributes(meta))
|
||||||
|
@ -77,7 +79,7 @@ defmodule OpentelemetryRedix do
|
||||||
|
|
||||||
defp net_attributes(%{address: address}) when is_binary(address) do
|
defp net_attributes(%{address: address}) when is_binary(address) do
|
||||||
[host, port] = address |> String.split(":")
|
[host, port] = address |> String.split(":")
|
||||||
%{"net.peer.name": host, "net.peer.port": port}
|
%{Trace.net_peer_name() => host, Trace.net_peer_port() => port}
|
||||||
end
|
end
|
||||||
|
|
||||||
defp net_attributes(_), do: %{}
|
defp net_attributes(_), do: %{}
|
||||||
|
|
Loading…
Reference in New Issue