Esempio n. 1
0
        // Using dependency injection will guarantee that you use the same configuration for telemetry collected automatically and manually.
        public GitHubFunctions(TelemetryConfiguration telemetryConfiguration, IHttpClient httpClient, IAdlsClient adlsClient, GitHubConfigManager configManager)
        {
            this.telemetryClient = new TelemetryClient(telemetryConfiguration);
            this.httpClient      = httpClient;
            this.apiDomain       = configManager.GetApiDomain();
            this.adlsClient      = adlsClient;
            this.configManager   = configManager;
            this.configManager.SetTelemetryClient(this.telemetryClient);

            if (this.adlsClient.AdlsClient == null)
            {
                Dictionary <string, string> properties = new Dictionary <string, string>()
                {
                    { "ResourceName", "ADLS Client" },
                };
                this.telemetryClient.TrackEvent("UninitializedResource", properties);
            }
        }
Esempio n. 2
0
        public void Setup()
        {
            string jsonInput = @"
            {
                'Authentication' : {
                    'Type' : 'Basic',
                    'Identity' : 'msftgits',
                    'PersonalAccessTokenEnvironmentVariable' : 'PersonalAccessToken'
                },
                'Storage': [
                    {
                        'Type': 'AzureDataLakeStorageV1',
                        'RootFolder': 'GitHub',
                        'Version': 'v1'
                    },
                    {
                        'Type': 'AzureBlob',
                        'RootContainer': 'github',
                        'OutputQueueName': 'github'
                    }
                ],
                'Collectors' : {
                    'Main' : {},
                    'Onboarding' : {
                        'Authentication' : {
                            'Type' : 'GitHubApp',
                            'AppId' : '7',
                            'GitHubAppKeyUri' : 'https://dummyuri.com/'
                        },
                    }
                },
                'ApiDomain':  'api.github.com'
            }";

            this.configManager   = new GitHubConfigManager(jsonInput);
            this.telemetryClient = new NoopTelemetryClient();
            this.httpClient      = new GitHubHttpClient(new FixedHttpClient(), new NoopRateLimiter(), new NoopCache <ConditionalRequestTableEntity>(), this.telemetryClient);
        }