<commit_before>// Copyright 2017 Microsoft. All rights reserved.
// MIT License

package main

import (
	"os"

	"github.com/Azure/azure-container-networking/cni"
	"github.com/Azure/azure-container-networking/cni/network"
	"github.com/Azure/azure-container-networking/common"
	"github.com/Azure/azure-container-networking/log"
	"github.com/Azure/azure-container-networking/telemetry"
)

const (
	hostNetAgentURL = "http://169.254.169.254/machine/plugins?comp=netagent&type=cnireport"
	ipamQueryURL    = "http://169.254.169.254/machine/plugins?comp=nmagent&type=getinterfaceinfov1"
	pluginName      = "CNI"
	reportType      = "application/json"
)

// Version is populated by make during build.
var version string

// Main is the entry point for CNI network plugin.
func main() {
	var config common.PluginConfig
	var err error
	config.Version = version

	reportManager := &telemetry.ReportManager{HostNetAgentURL: hostNetAgentURL, IpamQueryURL: ipamQueryURL, ReportType: reportType}

	reportManager.Report, err = reportManager.GetReport(pluginName, config.Version)
	if err != nil {
		log.Printf("GetReport failed due to %v", err)
		reportManager.Report.ErrorMessage = err.Error()
	}

	report := reportManager.Report

	if !report.GetReportState() {
		log.Printf("GetReport state file didn't exist. Setting flag to true")
	}

	report.Context = "AzureCNI"

	err = reportManager.SendReport()
	if err != nil {
		log.Printf("SendReport failed due to %v", err)
	} else {
		if err = report.SetReportState(); err != nil {
			log.Printf("SetReportState failed due to %v", err)

			report.ErrorMessage = err.Error()
			if reportManager.SendReport() != nil {
				log.Printf("SendReport failed due to %v", err)
			}<commit_msg>report will be sent only once except for reporting error message<commit_after>// Copyright 2017 Microsoft. All rights reserved.
// MIT License

package main

import (
	"os"

	"github.com/Azure/azure-container-networking/cni"
	"github.com/Azure/azure-container-networking/cni/network"
	"github.com/Azure/azure-container-networking/common"
	"github.com/Azure/azure-container-networking/log"
	"github.com/Azure/azure-container-networking/telemetry"
)

const (
	//hostNetAgentURL = "http://169.254.169.254/machine/plugins?comp=netagent&type=cnireport"
	hostNetAgentURL = "http://localhost:3500/"
	ipamQueryURL    = "http://169.254.169.254/machine/plugins?comp=nmagent&type=getinterfaceinfov1"
	pluginName      = "CNI"
	reportType      = "application/json"
)

// Version is populated by make during build.
var version string

// Main is the entry point for CNI network plugin.
func main() {
	var config common.PluginConfig
	var err error
	config.Version = version

	reportManager := &telemetry.ReportManager{HostNetAgentURL: hostNetAgentURL, IpamQueryURL: ipamQueryURL, ReportType: reportType}

	reportManager.Report, err = reportManager.GetReport(pluginName, config.Version)
	if err != nil {
		log.Printf("GetReport failed due to %v", err)
		reportManager.Report.ErrorMessage = err.Error()
	}

	report := reportManager.Report

	if !report.GetReportState() {
		log.Printf("GetReport state file didn't exist. Setting flag to true")

		report.Context = "AzureCNI"

		err = reportManager.SendReport()
		if err != nil {
			log.Printf("SendReport failed due to %v", err)
		} else {
			if err = report.SetReportState(); err != nil {
				log.Printf("SetReportState failed due to %v", err)

				report.ErrorMessage = err.Error()
				if reportManager.SendReport() != nil {
					log.Printf("SendReport failed due to %v", err)
				}
			}
{'fraction_non_alphanumeric': 0.12231030577576443, 'fraction_numerical': 0.017553793884484713, 'mean_word_length': 4.28101644245142, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5255369', 'n_tokens_mistral': 1228, 'n_tokens_neox': 1127, 'n_words': 266}