Giter VIP home page Giter VIP logo

Comments (5)

intolerance avatar intolerance commented on August 20, 2024

Hey @NeilDes as far as I can tell, the @version key is set by the agent.cfg's SchemaVersion setting and is not representative of the agent version.

  • Initialize Agent and retrieve the SchemaVersion (version) the agent.cfg file.

cppagent_dev/src/config.cpp

Lines 634 to 641 in 08093f4

// Check for schema version
string schemaVersion = get_with_default(reader, "SchemaVersion", "");
g_logger << LINFO << "Starting agent on port " << port;
if (!m_agent)
m_agent = new Agent(m_devicesFile, bufferSize, maxAssets,
schemaVersion, checkpointFrequency,
m_pretty);

  • The Agent constructor initializes the XmlPrinter and JsonPrinter using the version argument passed to it. (schema version from agent.cfg).

Agent::Agent(
const string& configXmlPath,
int bufferSize,
int maxAssets,
const std::string &version,
std::chrono::milliseconds checkpointFreq,
bool pretty) :
m_putEnabled(false),
m_logStreamData(false), m_pretty(pretty)
{
m_mimeTypes["xsl"] = "text/xsl";
m_mimeTypes["xml"] = "text/xml";
m_mimeTypes["json"] = "application/json";
m_mimeTypes["css"] = "text/css";
m_mimeTypes["xsd"] = "text/xml";
m_mimeTypes["jpg"] = "image/jpeg";
m_mimeTypes["jpeg"] = "image/jpeg";
m_mimeTypes["png"] = "image/png";
m_mimeTypes["ico"] = "image/x-icon";
// Create the XmlPrinter
XmlPrinter *xmlPrinter = new XmlPrinter(version, m_pretty);
m_printers["xml"].reset(xmlPrinter);
JsonPrinter *jsonPrinter = new JsonPrinter(version, m_pretty);
m_printers["json"].reset(jsonPrinter);

  • The JsonPrinter uses the version argument as m_version internally for the header definitions.

probeAssetHeader(m_version, hostname(), instanceId,

However, on the XmlPrinter the version is set by the Agent's Build version:

// Create the header
AutoElement header(writer, "Header");
addAttribute(writer, "creationTime", getCurrentTime(GMT));
static std::string sHostname;
if (sHostname.empty())
{
if (dlib::get_local_hostname(sHostname))
sHostname = "localhost";
}
addAttribute(writer, "sender", sHostname);
addAttribute(writer, "instanceId", intToString(instanceId));
char version[32] = {0};
sprintf(version, "%d.%d.%d.%d", AGENT_VERSION_MAJOR, AGENT_VERSION_MINOR, AGENT_VERSION_PATCH,
AGENT_VERSION_BUILD);
addAttribute(writer, "version", version);

@wsobel Any particular reason why the version element is different for the XML / JSON variants or is this to be considered a bug?

from cppagent_dev.

NeilDes avatar NeilDes commented on August 20, 2024

The header section 'version' should be the Agent executable version. Not the schema version. (like in xml)
Now that I look closer, I see that the schema version is not being output in json at all.

from cppagent_dev.

NeilDes avatar NeilDes commented on August 20, 2024

The header section 'version' should be the Agent executable version. Not the schema version. (like in xml)
Now that I look closer, I see that the schema version is not being output in json at all.

from cppagent_dev.

intolerance avatar intolerance commented on August 20, 2024

@NeilDes -- this was resolved by #35 -- Can you please review the new header and determine if we can close this issue or not?

from cppagent_dev.

NeilDes avatar NeilDes commented on August 20, 2024

Looks great! Thanks guys.

from cppagent_dev.

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.