Code Monkey home page Code Monkey logo

Comments (3)

workato-integration avatar workato-integration commented on May 24, 2024

https://issues.newrelic.com/browse/NEWRELIC-8871

from infra-integrations-sdk.

alvarocabanas avatar alvarocabanas commented on May 24, 2024

Hello, I have tried creating a simple go binary mocking the response you comment:

package main

import (
	"fmt"
)

func main() {
	fmt.Println(`{"integration_version":"0.1.0","protocol_version":"2","data":[{"metrics":[{"some-data3":4000,"event_type":"CustomSample"}],"inventory":{"instance":{"version":"3.0.1"}},"events":[{"category":"status","summary":"restart"}]}],"name":"com.myorganization.svctest"}`)
}

I build it as nri-custom, and it gets correctly computed by the agent when setting it up in the integrations configuration:

integrations:
  - name: nri-custom
    labels:
      environment: staging

The same applies when creating the binary using the SDK:

package main

import (
	"github.com/newrelic/infra-integrations-sdk/data/metric"
	"github.com/newrelic/infra-integrations-sdk/integration"
	"github.com/newrelic/infra-integrations-sdk/log"
)

var (
	integrationVersion = "0.0.0"
)

const (
	integrationName = "custom"
)

func main() {
	i, err := integration.New(integrationName, integrationVersion)
	fatalIfErr(err)

	e := i.LocalEntity()
	fatalIfErr(err)

	if err := e.Inventory.SetItem("instance", "version", "3.0.1"); err != nil {
		log.Error("fail to set inventory item: %s", err)
	}

	ms := e.NewMetricSet("CustomSample")
	err = ms.SetMetric("some-data", 4000, metric.GAUGE)
	fatalIfErr(err)

	fatalIfErr(i.Publish())
}

func fatalIfErr(err error) {
	if err != nil {
		log.Fatal(err)
	}
}

So, the payload is a valid JSON but maybe there are some extra characters on your output that are causing the error.

from infra-integrations-sdk.

rmarops avatar rmarops commented on May 24, 2024

thanks for the support

from infra-integrations-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.