-
Notifications
You must be signed in to change notification settings - Fork 544
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(instrumentation-react-native-navigation) tweaks and improvements…
… + adding logs
- Loading branch information
1 parent
a7265bf
commit c47c8c1
Showing
14 changed files
with
437 additions
and
143 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,6 @@ typings/ | |
|
||
# Optional npm cache directory | ||
.npm | ||
.npmrc | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
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
10 changes: 8 additions & 2 deletions
10
plugins/node/instrumentation-react-native-navigation/package.json
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
33 changes: 25 additions & 8 deletions
33
...s/node/instrumentation-react-native-navigation/src/components/NativeNavigationTracker.tsx
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 |
---|---|---|
@@ -1,33 +1,50 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { forwardRef, ReactNode } from 'react'; | ||
import { TracerProvider } from '@opentelemetry/api'; | ||
import { TracerOptions, TracerProvider } from '@opentelemetry/api'; | ||
|
||
import useTrace from '../utils/hooks/useTrace'; | ||
import useNativeNavigationTracker, { | ||
NativeNavRef, | ||
} from '../hooks/useNativeNavigationTracker'; | ||
import { NavigationTrackerConfig } from '../types/navigation'; | ||
|
||
export type NativeNavigationTrackerRef = NativeNavRef; | ||
type NativeNavigationTrackerRef = NativeNavRef; | ||
|
||
interface NativeNavigationTrackerProps { | ||
children: ReactNode; | ||
// selected provider, should be configured by the app consumer | ||
provider?: TracerProvider; | ||
// in case a provider is passed | ||
options?: TracerOptions; | ||
config?: NavigationTrackerConfig; | ||
} | ||
|
||
const NativeNavigationTracker = forwardRef< | ||
NativeNavigationTrackerRef, | ||
NativeNavigationTrackerProps | ||
>(({ children, provider }, ref) => { | ||
>(({ children, provider, options, config }, ref) => { | ||
// Initializing a Trace instance | ||
const tracer = useTrace( | ||
{ name: 'native-navigation', version: '0.1.0' }, | ||
provider | ||
); | ||
const tracer = useTrace(provider, options); | ||
|
||
useNativeNavigationTracker(ref, tracer); | ||
useNativeNavigationTracker(ref, tracer, config); | ||
|
||
return <>{children}</>; | ||
}); | ||
|
||
NativeNavigationTracker.displayName = 'NativeNavigationTracker'; | ||
export default NativeNavigationTracker; | ||
export type { NativeNavigationTrackerRef }; |
31 changes: 24 additions & 7 deletions
31
plugins/node/instrumentation-react-native-navigation/src/components/NavigationTracker.tsx
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
Oops, something went wrong.