@@ -44,6 +44,7 @@ import {
4444import { setLogFunction , Firestore } from '../src' ;
4545import { verifyInstance } from '../test/util/helpers' ;
4646import {
47+ ATTRIBUTE_GCP_RESOURCE_NAME ,
4748 ATTRIBUTE_KEY_DOC_COUNT ,
4849 ATTRIBUTE_SETTINGS_PREFIX ,
4950 SPAN_NAME_AGGREGATION_QUERY_GET ,
@@ -778,6 +779,10 @@ describe('Tracing Tests', () => {
778779 'Firestore.batchGetDocuments: First response received' ,
779780 'Firestore.batchGetDocuments: Completed' ,
780781 ] ) ;
782+
783+ expectSpanHasAttributes ( SPAN_NAME_BATCH_GET_DOCUMENTS , {
784+ [ ATTRIBUTE_GCP_RESOURCE_NAME ] : `//firestore.googleapis.com/projects/${ firestore . projectId } /databases/${ firestore . databaseId } ` ,
785+ } ) ;
781786 } ) ;
782787
783788 it ( 'document reference create()' , async ( ) => {
@@ -790,6 +795,10 @@ describe('Tracing Tests', () => {
790795 SPAN_NAME_DOC_REF_CREATE ,
791796 SPAN_NAME_BATCH_COMMIT ,
792797 ) ;
798+
799+ expectSpanHasAttributes ( SPAN_NAME_BATCH_COMMIT , {
800+ [ ATTRIBUTE_GCP_RESOURCE_NAME ] : `//firestore.googleapis.com/projects/${ firestore . projectId } /databases/${ firestore . databaseId } ` ,
801+ } ) ;
793802 } ) ;
794803
795804 it ( 'document reference delete()' , async ( ) => {
@@ -802,6 +811,10 @@ describe('Tracing Tests', () => {
802811 SPAN_NAME_DOC_REF_DELETE ,
803812 SPAN_NAME_BATCH_COMMIT ,
804813 ) ;
814+
815+ expectSpanHasAttributes ( SPAN_NAME_BATCH_COMMIT , {
816+ [ ATTRIBUTE_GCP_RESOURCE_NAME ] : `//firestore.googleapis.com/projects/${ firestore . projectId } /databases/${ firestore . databaseId } ` ,
817+ } ) ;
805818 } ) ;
806819
807820 it ( 'document reference set()' , async ( ) => {
@@ -814,6 +827,10 @@ describe('Tracing Tests', () => {
814827 SPAN_NAME_DOC_REF_SET ,
815828 SPAN_NAME_BATCH_COMMIT ,
816829 ) ;
830+
831+ expectSpanHasAttributes ( SPAN_NAME_BATCH_COMMIT , {
832+ [ ATTRIBUTE_GCP_RESOURCE_NAME ] : `//firestore.googleapis.com/projects/${ firestore . projectId } /databases/${ firestore . databaseId } ` ,
833+ } ) ;
817834 } ) ;
818835
819836 it ( 'document reference update()' , async ( ) => {
@@ -830,6 +847,10 @@ describe('Tracing Tests', () => {
830847 SPAN_NAME_DOC_REF_UPDATE ,
831848 SPAN_NAME_BATCH_COMMIT ,
832849 ) ;
850+
851+ expectSpanHasAttributes ( SPAN_NAME_BATCH_COMMIT , {
852+ [ ATTRIBUTE_GCP_RESOURCE_NAME ] : `//firestore.googleapis.com/projects/${ firestore . projectId } /databases/${ firestore . databaseId } ` ,
853+ } ) ;
833854 } ) ;
834855
835856 it ( 'document reference list collections' , async ( ) => {
@@ -841,6 +862,10 @@ describe('Tracing Tests', () => {
841862 SPAN_NAME_TEST_ROOT ,
842863 SPAN_NAME_DOC_REF_LIST_COLLECTIONS ,
843864 ) ;
865+
866+ expectSpanHasAttributes ( SPAN_NAME_DOC_REF_LIST_COLLECTIONS , {
867+ [ ATTRIBUTE_GCP_RESOURCE_NAME ] : `//firestore.googleapis.com/projects/${ firestore . projectId } /databases/${ firestore . databaseId } ` ,
868+ } ) ;
844869 } ) ;
845870
846871 it ( 'aggregate query get()' , async ( ) => {
@@ -867,6 +892,10 @@ describe('Tracing Tests', () => {
867892 SPAN_NAME_DOC_REF_CREATE ,
868893 SPAN_NAME_BATCH_COMMIT ,
869894 ) ;
895+
896+ expectSpanHasAttributes ( SPAN_NAME_BATCH_COMMIT , {
897+ [ ATTRIBUTE_GCP_RESOURCE_NAME ] : `//firestore.googleapis.com/projects/${ firestore . projectId } /databases/${ firestore . databaseId } ` ,
898+ } ) ;
870899 } ) ;
871900
872901 it ( 'collection reference list documents' , async ( ) => {
@@ -878,6 +907,10 @@ describe('Tracing Tests', () => {
878907 SPAN_NAME_TEST_ROOT ,
879908 SPAN_NAME_COL_REF_LIST_DOCUMENTS ,
880909 ) ;
910+
911+ expectSpanHasAttributes ( SPAN_NAME_COL_REF_LIST_DOCUMENTS , {
912+ [ ATTRIBUTE_GCP_RESOURCE_NAME ] : `//firestore.googleapis.com/projects/${ firestore . projectId } /databases/${ firestore . databaseId } ` ,
913+ } ) ;
881914 } ) ;
882915
883916 it ( 'query get()' , async ( ) => {
@@ -892,6 +925,10 @@ describe('Tracing Tests', () => {
892925 'Firestore.runQuery: First response received' ,
893926 'Firestore.runQuery: Completed' ,
894927 ] ) ;
928+
929+ expectSpanHasAttributes ( SPAN_NAME_QUERY_GET , {
930+ [ ATTRIBUTE_GCP_RESOURCE_NAME ] : `//firestore.googleapis.com/projects/${ firestore . projectId } /databases/${ firestore . databaseId } ` ,
931+ } ) ;
895932 } ) ;
896933
897934 it ( 'firestore getAll()' , async ( ) => {
@@ -907,6 +944,10 @@ describe('Tracing Tests', () => {
907944 'Firestore.batchGetDocuments: First response received' ,
908945 'Firestore.batchGetDocuments: Completed' ,
909946 ] ) ;
947+
948+ expectSpanHasAttributes ( SPAN_NAME_BATCH_GET_DOCUMENTS , {
949+ [ ATTRIBUTE_GCP_RESOURCE_NAME ] : `//firestore.googleapis.com/projects/${ firestore . projectId } /databases/${ firestore . databaseId } ` ,
950+ } ) ;
910951 } ) ;
911952
912953 it ( 'transaction' , async ( ) => {
@@ -929,26 +970,50 @@ describe('Tracing Tests', () => {
929970 SPAN_NAME_TRANSACTION_RUN ,
930971 SPAN_NAME_TRANSACTION_GET_DOCUMENT ,
931972 ) ;
973+
974+ expectSpanHasAttributes ( SPAN_NAME_TRANSACTION_GET_DOCUMENT , {
975+ [ ATTRIBUTE_GCP_RESOURCE_NAME ] : `//firestore.googleapis.com/projects/${ firestore . projectId } /databases/${ firestore . databaseId } ` ,
976+ } ) ;
977+
932978 expectSpanHierarchy (
933979 SPAN_NAME_TEST_ROOT ,
934980 SPAN_NAME_TRANSACTION_RUN ,
935981 SPAN_NAME_TRANSACTION_GET_DOCUMENTS ,
936982 ) ;
983+
984+ expectSpanHasAttributes ( SPAN_NAME_TRANSACTION_GET_DOCUMENTS , {
985+ [ ATTRIBUTE_GCP_RESOURCE_NAME ] : `//firestore.googleapis.com/projects/${ firestore . projectId } /databases/${ firestore . databaseId } ` ,
986+ } ) ;
987+
937988 expectSpanHierarchy (
938989 SPAN_NAME_TEST_ROOT ,
939990 SPAN_NAME_TRANSACTION_RUN ,
940991 SPAN_NAME_TRANSACTION_GET_QUERY ,
941992 ) ;
993+
994+ expectSpanHasAttributes ( SPAN_NAME_TRANSACTION_GET_QUERY , {
995+ [ ATTRIBUTE_GCP_RESOURCE_NAME ] : `//firestore.googleapis.com/projects/${ firestore . projectId } /databases/${ firestore . databaseId } ` ,
996+ } ) ;
997+
942998 expectSpanHierarchy (
943999 SPAN_NAME_TEST_ROOT ,
9441000 SPAN_NAME_TRANSACTION_RUN ,
9451001 SPAN_NAME_TRANSACTION_GET_AGGREGATION_QUERY ,
9461002 ) ;
1003+
1004+ expectSpanHasAttributes ( SPAN_NAME_TRANSACTION_GET_AGGREGATION_QUERY , {
1005+ [ ATTRIBUTE_GCP_RESOURCE_NAME ] : `//firestore.googleapis.com/projects/${ firestore . projectId } /databases/${ firestore . databaseId } ` ,
1006+ } ) ;
1007+
9471008 expectSpanHierarchy (
9481009 SPAN_NAME_TEST_ROOT ,
9491010 SPAN_NAME_TRANSACTION_RUN ,
9501011 SPAN_NAME_TRANSACTION_COMMIT ,
9511012 ) ;
1013+
1014+ expectSpanHasAttributes ( SPAN_NAME_TRANSACTION_COMMIT , {
1015+ [ ATTRIBUTE_GCP_RESOURCE_NAME ] : `//firestore.googleapis.com/projects/${ firestore . projectId } /databases/${ firestore . databaseId } ` ,
1016+ } ) ;
9521017 } ) ;
9531018
9541019 it ( 'batch' , async ( ) => {
@@ -974,6 +1039,9 @@ describe('Tracing Tests', () => {
9741039
9751040 await waitForCompletedSpans ( 2 ) ;
9761041 expectSpanHierarchy ( SPAN_NAME_TEST_ROOT , SPAN_NAME_PARTITION_QUERY ) ;
1042+ expectSpanHasAttributes ( SPAN_NAME_PARTITION_QUERY , {
1043+ [ ATTRIBUTE_GCP_RESOURCE_NAME ] : `//firestore.googleapis.com/projects/${ firestore . projectId } /databases/${ firestore . databaseId } ` ,
1044+ } ) ;
9771045 } ) ;
9781046
9791047 it ( 'bulk writer' , async ( ) => {
@@ -992,6 +1060,7 @@ describe('Tracing Tests', () => {
9921060 expectSpanHierarchy ( SPAN_NAME_TEST_ROOT , SPAN_NAME_BULK_WRITER_COMMIT ) ;
9931061 expectSpanHasAttributes ( SPAN_NAME_BULK_WRITER_COMMIT , {
9941062 [ ATTRIBUTE_KEY_DOC_COUNT ] : 5 ,
1063+ [ ATTRIBUTE_GCP_RESOURCE_NAME ] : `//firestore.googleapis.com/projects/${ firestore . projectId } /databases/${ firestore . databaseId } ` ,
9951064 } ) ;
9961065 } ) ;
9971066 }
0 commit comments