File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
opentelemetry-exporter-gcp-logging/src/opentelemetry/exporter/cloud_logging Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 5757
5858HTTP_REQUEST_ATTRIBUTE_KEY = "gcp.http_request"
5959LOG_NAME_ATTRIBUTE_KEY = "gcp.log_name"
60+ EVENT_NAME_ATTRIBUTE_KEY = "event.name"
6061SOURCE_LOCATION_ATTRIBUTE_KEY = "gcp.source_location"
6162TRACE_SAMPLED_ATTRIBUTE_KEY = "gcp.trace_sampled"
6263PROJECT_ID_ATTRIBUTE_KEY = "gcp.project_id"
@@ -197,13 +198,11 @@ def export(self, batch: Sequence[LogData]):
197198 project_id = str (
198199 attributes .get (PROJECT_ID_ATTRIBUTE_KEY , self .project_id )
199200 )
200- log_suffix = urllib .parse .quote_plus (
201- str (
202- attributes .get (
203- LOG_NAME_ATTRIBUTE_KEY , self .default_log_name
204- )
205- )
206- )
201+ log_suffix = self .default_log_name
202+ if attributes .get (LOG_NAME_ATTRIBUTE_KEY ):
203+ log_suffix = urllib .parse .quote_plus (attributes .get (LOG_NAME_ATTRIBUTE_KEY ))
204+ elif attributes .get (EVENT_NAME_ATTRIBUTE_KEY ):
205+ log_suffix = urllib .parse .quote_plus (attributes .get (EVENT_NAME_ATTRIBUTE_KEY ))
207206 log_entry .log_name = f"projects/{ project_id } /logs/{ log_suffix } "
208207 # If timestamp is unset fall back to observed_time_unix_nano as recommended,
209208 # see https://github.com/open-telemetry/opentelemetry-proto/blob/4abbb78/opentelemetry/proto/logs/v1/logs.proto#L176-L179
You can’t perform that action at this time.
0 commit comments